aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-03-01 19:49:10 +0300
committerGravatar Vitaly Takmazov2019-03-01 19:49:10 +0300
commitece568a4bcd0ff8a2f84c974a458a2f498fd135d (patch)
tree58282836e2bc3bcc29f72630bdfba76202730909 /src/main
parentaabad2347aaf52e225541cb954e98ab509e9aa2f (diff)
Message::timestamp -> Message::created
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/juick/Message.java17
-rw-r--r--src/main/java/com/juick/formatters/PlainTextFormatter.java2
-rw-r--r--src/main/java/com/juick/server/ActivityPubManager.java2
-rw-r--r--src/main/java/com/juick/server/api/rss/MessagesView.java2
-rw-r--r--src/main/java/com/juick/service/MessagesServiceImpl.java4
-rw-r--r--src/main/java/com/juick/service/PMQueriesServiceImpl.java6
-rw-r--r--src/main/resources/templates/views/partial/message.html6
-rw-r--r--src/main/resources/templates/views/pm_inbox.html2
-rw-r--r--src/main/resources/templates/views/pm_sent.html2
-rw-r--r--src/main/resources/templates/views/thread.html12
10 files changed, 26 insertions, 29 deletions
diff --git a/src/main/java/com/juick/Message.java b/src/main/java/com/juick/Message.java
index fb6be67c..2035d4c6 100644
--- a/src/main/java/com/juick/Message.java
+++ b/src/main/java/com/juick/Message.java
@@ -21,7 +21,6 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.juick.adapters.SimpleDateAdapter;
import com.juick.model.Entity;
-import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import javax.annotation.Nonnull;
@@ -46,8 +45,8 @@ public class Message implements Comparable {
private int replyto = 0;
private String text = null;
private User user = null;
- private final Set<Tag> tags;
- private Instant ts;
+ private Set<Tag> tags;
+ private Instant created;
private Instant updated;
private Instant updatedAt;
private boolean unread;
@@ -181,12 +180,12 @@ public class Message implements Comparable {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "UTC")
@XmlAttribute(name = "ts")
@XmlJavaTypeAdapter(SimpleDateAdapter.class)
- public Instant getTimestamp() {
- return ts;
+ public Instant getCreated() {
+ return created;
}
- public void setTimestamp(Instant timestamp) {
- this.ts = timestamp;
+ public void setCreated(Instant timestamp) {
+ this.created = timestamp;
}
@XmlTransient
@@ -224,9 +223,7 @@ public class Message implements Comparable {
}
public void setTags(Set<Tag> tags) {
- this.tags.clear();
- if (CollectionUtils.isNotEmpty(tags))
- this.tags.addAll(tags);
+ this.tags = tags;
}
@XmlAttribute
diff --git a/src/main/java/com/juick/formatters/PlainTextFormatter.java b/src/main/java/com/juick/formatters/PlainTextFormatter.java
index 4cb07950..41d24e93 100644
--- a/src/main/java/com/juick/formatters/PlainTextFormatter.java
+++ b/src/main/java/com/juick/formatters/PlainTextFormatter.java
@@ -57,7 +57,7 @@ public class PlainTextFormatter {
public static String formatPostSummary(Message m) {
int cropLength = 384;
- String timeAgo = pt.format(Date.from(m.getTimestamp()));
+ String timeAgo = pt.format(Date.from(m.getCreated()));
String repliesCount = m.getReplies() == 1 ? "; 1 reply" : m.getReplies() == 0 ? ""
: String.format("; %d replies", m.getReplies());
StringBuilder sb = new StringBuilder();
diff --git a/src/main/java/com/juick/server/ActivityPubManager.java b/src/main/java/com/juick/server/ActivityPubManager.java
index 24cc2123..a5398325 100644
--- a/src/main/java/com/juick/server/ActivityPubManager.java
+++ b/src/main/java/com/juick/server/ActivityPubManager.java
@@ -269,7 +269,7 @@ public class ActivityPubManager implements ActivityListener, NotificationListene
note.setTo(Collections.singletonList("https://www.w3.org/ns/activitystreams#Public"));
note.setCc(Collections.singletonList(followersUri(msg.getUser())));
}
- note.setPublished(msg.getTimestamp());
+ note.setPublished(msg.getCreated());
if (StringUtils.isNotBlank(msg.getAttachmentType())) {
Image attachment = new Image();
attachment.setId(msg.getAttachment().getMedium().getUrl());
diff --git a/src/main/java/com/juick/server/api/rss/MessagesView.java b/src/main/java/com/juick/server/api/rss/MessagesView.java
index 05bc0bd6..2c05c8cb 100644
--- a/src/main/java/com/juick/server/api/rss/MessagesView.java
+++ b/src/main/java/com/juick/server/api/rss/MessagesView.java
@@ -126,7 +126,7 @@ public class MessagesView extends AbstractRssFeedView {
description.setType("text/html");
description.setValue(messageDescription);
item.setDescription(description);
- item.setPubDate(Date.from(msg.getTimestamp()));
+ item.setPubDate(Date.from(msg.getCreated()));
item.setComments(messageUrl);
msg.getTags().stream().map(t -> {
Category category = new Category();
diff --git a/src/main/java/com/juick/service/MessagesServiceImpl.java b/src/main/java/com/juick/service/MessagesServiceImpl.java
index e95742ab..33c9cee1 100644
--- a/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -90,7 +90,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
user.setBanned(rs.getBoolean(6));
user.setUri(URI.create(Optional.ofNullable(rs.getString(22)).orElse(StringUtils.EMPTY)));
msg.setUser(user);
- msg.setTimestamp(rs.getTimestamp(7).toInstant());
+ msg.setCreated(rs.getTimestamp(7).toInstant());
msg.ReadOnly = rs.getBoolean(8);
msg.setPrivacy(rs.getInt(9));
msg.FriendsOnly = msg.getPrivacy() < 0;
@@ -426,7 +426,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
URI.create(Optional.ofNullable(rs.getString(11)).orElse(StringUtils.EMPTY)));
}
msg.setReplyto(rs.getInt(3));
- msg.setTimestamp(rs.getTimestamp(4).toInstant());
+ msg.setCreated(rs.getTimestamp(4).toInstant());
msg.setAttachmentType(rs.getString(5));
msg.setText(rs.getString(6));
String quote = rs.getString(7);
diff --git a/src/main/java/com/juick/service/PMQueriesServiceImpl.java b/src/main/java/com/juick/service/PMQueriesServiceImpl.java
index 712e4b0e..f1f98024 100644
--- a/src/main/java/com/juick/service/PMQueriesServiceImpl.java
+++ b/src/main/java/com/juick/service/PMQueriesServiceImpl.java
@@ -105,7 +105,7 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe
user.setName(rs.getString(4));
msg.setUser(user);
msg.setText(rs.getString(2).trim());
- msg.setTimestamp(rs.getTimestamp(3).toInstant());
+ msg.setCreated(rs.getTimestamp(3).toInstant());
return msg;
});
}
@@ -122,7 +122,7 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe
msg.getUser().setUid(rs.getInt(1));
msg.getUser().setName(rs.getString(2));
msg.setText(rs.getString(3).trim());
- msg.setTimestamp(rs.getTimestamp(4).toInstant());
+ msg.setCreated(rs.getTimestamp(4).toInstant());
return msg;
},
uid);
@@ -141,7 +141,7 @@ public class PMQueriesServiceImpl extends BaseJdbcService implements PMQueriesSe
msg.getUser().setUid(rs.getInt(1));
msg.getUser().setName(rs.getString(2));
msg.setText(rs.getString(3).trim());
- msg.setTimestamp(rs.getTimestamp(4).toInstant());
+ msg.setCreated(rs.getTimestamp(4).toInstant());
return msg;
},
uid);
diff --git a/src/main/resources/templates/views/partial/message.html b/src/main/resources/templates/views/partial/message.html
index b1d27ae5..bb36b25e 100644
--- a/src/main/resources/templates/views/partial/message.html
+++ b/src/main/resources/templates/views/partial/message.html
@@ -8,9 +8,9 @@
</div>
<div class="msg-ts">
<a href="/{{ msg.user.name }}/{{ msg.mid }}">
- <time datetime="{{ msg.timestamp | timestamp | date('yyyy-MM-dd HH:mm:ss') }}Z"
- title="{{ msg.timestamp | timestamp | date('yyyy-MM-dd HH:mm:ss') }} GMT">
- {{ msg.timestamp | prettyTime }}
+ <time datetime="{{ msg.created | timestamp | date('yyyy-MM-dd HH:mm:ss') }}Z"
+ title="{{ msg.created | timestamp | date('yyyy-MM-dd HH:mm:ss') }} GMT">
+ {{ msg.created | prettyTime }}
</time>
</a>
</div>
diff --git a/src/main/resources/templates/views/pm_inbox.html b/src/main/resources/templates/views/pm_inbox.html
index 4f97bc86..f89b2923 100644
--- a/src/main/resources/templates/views/pm_inbox.html
+++ b/src/main/resources/templates/views/pm_inbox.html
@@ -12,7 +12,7 @@
<img src="{{ msg.user.avatar }}" alt="{{ msg.user.name }}"/>
</a>
</div>
- <div class="msg-ts">{{ msg.timestamp | prettyTime }}</div>
+ <div class="msg-ts">{{ msg.created | prettyTime }}</div>
</div>
<div class="msg-txt">{{ msg | formatMessage }}</div>
diff --git a/src/main/resources/templates/views/pm_sent.html b/src/main/resources/templates/views/pm_sent.html
index ace25301..f0af71d3 100644
--- a/src/main/resources/templates/views/pm_sent.html
+++ b/src/main/resources/templates/views/pm_sent.html
@@ -19,7 +19,7 @@
<img src="{{ msg.user.avatar }}" alt="{{ msg.user.name }}"/>
</a>
</div>
- <div class="msg-ts">{{ msg.timestamp | prettyTime }}</div>
+ <div class="msg-ts">{{ msg.created | prettyTime }}</div>
</div>
<div class="msg-txt">{{ msg | formatMessage }}</div>
</div>
diff --git a/src/main/resources/templates/views/thread.html b/src/main/resources/templates/views/thread.html
index 90c9d4a0..2092cc1b 100644
--- a/src/main/resources/templates/views/thread.html
+++ b/src/main/resources/templates/views/thread.html
@@ -13,9 +13,9 @@
</span>
<div class="msg-ts">
<a href="/{{ msg.user.name }}/{{ msg.mid }}">
- <time datetime="{{ msg.timestamp | timestamp | date('yyyy-MM-dd HH:mm:ss') }}Z"
- title="{{ msg.timestamp | timestamp | date('yyyy-MM-dd HH:mm:ss') }} GMT">
- {{ msg.timestamp | prettyTime }}
+ <time datetime="{{ msg.created | timestamp | date('yyyy-MM-dd HH:mm:ss') }}Z"
+ title="{{ msg.created | timestamp | date('yyyy-MM-dd HH:mm:ss') }} GMT">
+ {{ msg.created | prettyTime }}
</time>
</a>
</div>
@@ -140,9 +140,9 @@
{% endif %}
<div class="msg-ts">
<a href="/{{ msg.mid }}#{{ msg.rid }}">
- <time datetime="{{ msg.timestamp | timestamp | date('yyyy-MM-dd HH:mm:ss') }}Z"
- title="{{ msg.timestamp | timestamp | date('yyyy-MM-dd HH:mm:ss') }} GMT">
- {{ msg.timestamp | prettyTime }}
+ <time datetime="{{ msg.created | timestamp | date('yyyy-MM-dd HH:mm:ss') }}Z"
+ title="{{ msg.created | timestamp | date('yyyy-MM-dd HH:mm:ss') }} GMT">
+ {{ msg.created | prettyTime }}
</time>
</a>
</div>