From 4c900f108a4f619a4f6ad37f2f33d6a3eef481e3 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 2 Jan 2019 15:27:37 +0300 Subject: 2019 is here, update deps --- src/main/resources/templates/views/login.html | 2 +- src/main/resources/templates/views/partial/footer.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main/resources') diff --git a/src/main/resources/templates/views/login.html b/src/main/resources/templates/views/login.html index a538cb26..11900c8d 100644 --- a/src/main/resources/templates/views/login.html +++ b/src/main/resources/templates/views/login.html @@ -117,7 +117,7 @@
  • учеба
  • -
    juick.com © 2008-2018   Контакты · Помощь
    +
    juick.com © 2008-2019   Контакты · Помощь
    {{ i18n("messages","label.register") }}: diff --git a/src/main/resources/templates/views/partial/footer.html b/src/main/resources/templates/views/partial/footer.html index 35972254..bb6ccb97 100644 --- a/src/main/resources/templates/views/partial/footer.html +++ b/src/main/resources/templates/views/partial/footer.html @@ -8,7 +8,7 @@
    -
    {{ msg | formatMessage }}
    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 @@ {{ msg.user.name }} -
    {{ msg.timestamp | prettyTime }}
    +
    {{ msg.created | prettyTime }}
    {{ msg | formatMessage }}
    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 @@
    -
    @@ -140,9 +140,9 @@ {% endif %}
    -
    diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index ad375e99..7f46968f 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -433,7 +433,7 @@ public class ServerTests { Timestamp.class, mid).toInstant(); assertThat(rts, greaterThan(ts)); Message msg = messagesService.getReply(mid, rid); - assertThat(rts, equalTo(msg.getTimestamp())); + assertThat(rts, equalTo(msg.getCreated())); messagesService.deleteMessage(ugnich_id, mid); } @@ -470,7 +470,7 @@ public class ServerTests { .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) .andExpect(jsonPath("$[0].mid", is(msg.getMid()))) .andExpect(jsonPath("$[0].timestamp", - is(DateFormattersHolder.getMessageFormatterInstance().format(msg.getTimestamp())))) + is(DateFormattersHolder.getMessageFormatterInstance().format(msg.getCreated())))) .andExpect(jsonPath("$[0].body", is(msg.getText()))) .andExpect(jsonPath("$[0].attachment.url", is(String.format("https://i.juick.com/p/%d.png", msg.getMid())))) @@ -726,7 +726,7 @@ public class ServerTests { Message msg2 = yoyoMsg.getNewMessage().get(); int mid = msg2.getMid(); Timestamp last = jdbcTemplate.queryForObject("SELECT lastmessage FROM users WHERE id=?", Timestamp.class, user.getUid()); - assertThat(last.toInstant(), equalTo(yoyoMsg.getNewMessage().get().getTimestamp())); + assertThat(last.toInstant(), equalTo(yoyoMsg.getNewMessage().get().getCreated())); assertEquals("should be message", true, commandsManager.processCommand(user, String.format("#%d", mid), emptyUri).getText().startsWith("@me")); int readerUid = userService.createUser("dummyReader", "dummySecret"); @@ -771,7 +771,7 @@ public class ServerTests { Message reply = messagesService.getReplies(user, mid).stream().filter(m -> m.getRid() == 3).findFirst() .orElse(new Message()); Timestamp lastreply = jdbcTemplate.queryForObject("SELECT lastmessage FROM users WHERE id=?", Timestamp.class, user.getUid()); - assertThat(lastreply.toInstant(), equalTo(reply.getTimestamp())); + assertThat(lastreply.toInstant(), equalTo(reply.getCreated())); assertEquals("should be reply to second comment", 2, reply.getReplyto()); assertThat(commandsManager.processCommand(readerUser, "#" + mid + " *yo *there", emptyUri) .getText(), startsWith("Reply posted")); @@ -1038,7 +1038,7 @@ public class ServerTests { Message msg = new Message(); msg.setTags(tags); Instant currentDate = Instant.now(); - msg.setTimestamp(currentDate); + msg.setCreated(currentDate); String jsonMessage = jsonMapper.writeValueAsString(msg); assertEquals("date should be in timestamp field", DateFormattersHolder.getMessageFormatterInstance().format(currentDate), JsonPath.read(jsonMessage, "$.timestamp")); @@ -1210,7 +1210,7 @@ public class ServerTests { Message original = jsonMapper.readValue(result.getResponse().getContentAsString(), CommandResult.class) .getNewMessage().get(); assertThat(original.getText(), equalTo("YO")); - assertThat(original.getUpdatedAt(), equalTo(original.getTimestamp())); + assertThat(original.getUpdatedAt(), equalTo(original.getCreated())); // to have updated_at greater than ts Thread.sleep(1000); result = mockMvc.perform(post("/api/update").with(httpBasic(ugnichName, ugnichPassword)) @@ -1219,7 +1219,7 @@ public class ServerTests { Message edited = jsonMapper.readValue(result.getResponse().getContentAsString(), CommandResult.class) .getNewMessage().get(); assertThat(edited.getText(), equalTo("PEOPLE")); - assertThat(edited.getUpdatedAt(), greaterThan(edited.getTimestamp())); + assertThat(edited.getUpdatedAt(), greaterThan(edited.getCreated())); mockMvc.perform(post("/api/update").with(httpBasic(freefdName, freefdPassword)) .param("mid", String.valueOf(original.getMid())) .param("body", "PEOPLE")).andExpect(status().is(403)); @@ -1228,7 +1228,7 @@ public class ServerTests { .param("body", "HEY")).andExpect(status().is2xxSuccessful()).andReturn(); CommandResult comment = jsonMapper.readValue(result.getResponse().getContentAsString(), CommandResult.class); assertThat(comment.getNewMessage().get().getText(), is("HEY")); - assertThat(comment.getNewMessage().get().getUpdatedAt(), is(comment.getNewMessage().get().getTimestamp())); + assertThat(comment.getNewMessage().get().getUpdatedAt(), is(comment.getNewMessage().get().getCreated())); // to have updated_at greater than ts Thread.sleep(1000); result = mockMvc.perform(post("/api/update").with(httpBasic(freefdName, freefdPassword)) @@ -1238,7 +1238,7 @@ public class ServerTests { Message editedComment = jsonMapper.readValue(result.getResponse().getContentAsString(), CommandResult.class) .getNewMessage().get(); assertThat(editedComment.getText(), is("HEY, JOE")); - assertThat(editedComment.getUpdatedAt(), greaterThan(editedComment.getTimestamp())); + assertThat(editedComment.getUpdatedAt(), greaterThan(editedComment.getCreated())); messagesService.deleteMessage(ugnich.getUid(), original.getMid()); } @Test diff --git a/src/test/java/com/juick/test/util/MockUtils.java b/src/test/java/com/juick/test/util/MockUtils.java index 017af4d1..8f6b821d 100644 --- a/src/test/java/com/juick/test/util/MockUtils.java +++ b/src/test/java/com/juick/test/util/MockUtils.java @@ -34,7 +34,7 @@ public class MockUtils { msg.setMid(mid); msg.setUser(user); msg.setText(messageText == null ? generator.generate(24) : messageText); - msg.setTimestamp(Instant.now()); + msg.setCreated(Instant.now()); return msg; } -- cgit v1.2.3 From e7873d0707b9057f63bac5540df8577c96921e3b Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 6 Mar 2019 21:05:52 +0300 Subject: Fix illegal reflective access from PebbleTemplates --- src/main/resources/templates/layouts/note.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/resources') diff --git a/src/main/resources/templates/layouts/note.html b/src/main/resources/templates/layouts/note.html index 42b939c0..e832dc63 100644 --- a/src/main/resources/templates/layouts/note.html +++ b/src/main/resources/templates/layouts/note.html @@ -1,5 +1,5 @@ {% import "views/macros/tags" %}

    {{ msg | formatMessage }}

    -{% if msg.tags.size > 0 %} +{% if msg.tags | length > 0 %}
    {{ allTags(baseUri, msg.tags | tagsList) }}
    {% endif %} \ No newline at end of file -- cgit v1.2.3 From 7a9630b9e753a4aec2806e229554370e2d59f820 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 15 Mar 2019 17:07:05 +0300 Subject: timestamp precision in messages --- .../V1.18__increase messages and replies timestamp precision.sql | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 src/main/resources/db/migration/V1.18__increase messages and replies timestamp precision.sql (limited to 'src/main/resources') diff --git a/src/main/resources/db/migration/V1.18__increase messages and replies timestamp precision.sql b/src/main/resources/db/migration/V1.18__increase messages and replies timestamp precision.sql new file mode 100644 index 00000000..5b298c46 --- /dev/null +++ b/src/main/resources/db/migration/V1.18__increase messages and replies timestamp precision.sql @@ -0,0 +1,5 @@ +ALTER TABLE replies MODIFY COLUMN ts timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP; +ALTER TABLE messages MODIFY COLUMN ts timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP; +ALTER TABLE messages MODIFY COLUMN updated timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP; +ALTER TABLE messages_txt MODIFY COLUMN updated_at timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP; +ALTER TABLE users MODIFY COLUMN lastmessage timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP; -- cgit v1.2.3