From f702155222ee6e0068c7ba98075724d36064faf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gi=CC=81sli=20Kristja=CC=81nsson?= Date: Thu, 2 Feb 2023 00:31:32 +0000 Subject: [PATCH 1/2] fix: linter errors --- quasar.config.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/quasar.config.js b/quasar.config.js index 070de88..353d03b 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -12,7 +12,7 @@ const ESLintPlugin = require('eslint-webpack-plugin') -const { configure } = require('quasar/wrappers'); +const { configure } = require('quasar/wrappers') module.exports = configure(function (ctx) { return { @@ -230,8 +230,6 @@ module.exports = configure(function (ctx) { .use(ESLintPlugin, [{ extensions: [ 'js' ] }]) }, - - chainWebpackPreload (chain) { chain.plugin('eslint-webpack-plugin') .use(ESLintPlugin, [{ extensions: [ 'js' ] }]) @@ -239,4 +237,4 @@ module.exports = configure(function (ctx) { } } -}); +}) From 24e5b37c254151325b7a3509ef8fd36097f651f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gi=CC=81sli=20Kristja=CC=81nsson?= Date: Thu, 2 Feb 2023 00:24:10 +0000 Subject: [PATCH 2/2] fix: timestamp for notes from the future #38 --- src/components/Feed/Feed.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/Feed/Feed.vue b/src/components/Feed/Feed.vue index 8fb6a0a..14c769a 100644 --- a/src/components/Feed/Feed.vue +++ b/src/components/Feed/Feed.vue @@ -31,6 +31,12 @@ import DateUtils from 'src/utils/DateUtils' import Bots from 'src/utils/bots' const feedOrder = (a, b) => b[0].createdAt - a[0].createdAt +const maxDate = (max) => (note) => { + if (note.createdAt > max) + note.createdAt = max + return note +} +const now = () => new Date().getTime() / 1000 const MAX_ITEMS_VISIBLE = 25 @@ -94,7 +100,8 @@ export default { const items = notes .concat(data) .filter((note) => this.filterNote(note, this.feed.hideBots)) - .map((note) => [note]) // TODO Single element thread + .map(maxDate(now())) + .map(note => [note]) // TODO Single element thread .sort(feedOrder) .filter( (item, pos, array) => !pos || item[0].id !== array[pos - 1][0].id @@ -110,6 +117,7 @@ export default { }) this.stream.on('update', (note) => { if (!this.filterNote(note, this.feed.hideBots)) return + note = maxDate(now())(note) if (note.createdAt >= this.timestampNewest) { this.newer.push([note]) // TODO Single element thread } else if (note.createdAt >= this.timestampOldest) {