mirror of
https://github.com/styppo/hamstr.git
synced 2024-10-18 05:23:28 +00:00
Merge pull request #39 from gislik/fix/38-notes-from-the-future
fix: notes from the future
This commit is contained in:
commit
7055335e46
@ -12,7 +12,7 @@
|
|||||||
const ESLintPlugin = require('eslint-webpack-plugin')
|
const ESLintPlugin = require('eslint-webpack-plugin')
|
||||||
|
|
||||||
|
|
||||||
const { configure } = require('quasar/wrappers');
|
const { configure } = require('quasar/wrappers')
|
||||||
|
|
||||||
module.exports = configure(function (ctx) {
|
module.exports = configure(function (ctx) {
|
||||||
return {
|
return {
|
||||||
@ -230,8 +230,6 @@ module.exports = configure(function (ctx) {
|
|||||||
.use(ESLintPlugin, [{ extensions: [ 'js' ] }])
|
.use(ESLintPlugin, [{ extensions: [ 'js' ] }])
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
chainWebpackPreload (chain) {
|
chainWebpackPreload (chain) {
|
||||||
chain.plugin('eslint-webpack-plugin')
|
chain.plugin('eslint-webpack-plugin')
|
||||||
.use(ESLintPlugin, [{ extensions: [ 'js' ] }])
|
.use(ESLintPlugin, [{ extensions: [ 'js' ] }])
|
||||||
@ -239,4 +237,4 @@ module.exports = configure(function (ctx) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
@ -31,6 +31,12 @@ import DateUtils from 'src/utils/DateUtils'
|
|||||||
import Bots from 'src/utils/bots'
|
import Bots from 'src/utils/bots'
|
||||||
|
|
||||||
const feedOrder = (a, b) => b[0].createdAt - a[0].createdAt
|
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
|
const MAX_ITEMS_VISIBLE = 25
|
||||||
|
|
||||||
@ -94,7 +100,8 @@ export default {
|
|||||||
const items = notes
|
const items = notes
|
||||||
.concat(data)
|
.concat(data)
|
||||||
.filter((note) => this.filterNote(note, this.feed.hideBots))
|
.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)
|
.sort(feedOrder)
|
||||||
.filter(
|
.filter(
|
||||||
(item, pos, array) => !pos || item[0].id !== array[pos - 1][0].id
|
(item, pos, array) => !pos || item[0].id !== array[pos - 1][0].id
|
||||||
@ -110,6 +117,7 @@ export default {
|
|||||||
})
|
})
|
||||||
this.stream.on('update', (note) => {
|
this.stream.on('update', (note) => {
|
||||||
if (!this.filterNote(note, this.feed.hideBots)) return
|
if (!this.filterNote(note, this.feed.hideBots)) return
|
||||||
|
note = maxDate(now())(note)
|
||||||
if (note.createdAt >= this.timestampNewest) {
|
if (note.createdAt >= this.timestampNewest) {
|
||||||
this.newer.push([note]) // TODO Single element thread
|
this.newer.push([note]) // TODO Single element thread
|
||||||
} else if (note.createdAt >= this.timestampOldest) {
|
} else if (note.createdAt >= this.timestampOldest) {
|
||||||
|
Loading…
Reference in New Issue
Block a user