fix(feed): always insert new feed item
This commit is contained in:
parent
5dfc4ddc38
commit
e0f43191fb
@ -53,6 +53,11 @@ module.exports = class Feed {
|
|||||||
this.feed[index] = Object.assign(this.feed[index], data) // just push up element
|
this.feed[index] = Object.assign(this.feed[index], data) // just push up element
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if(typeof data == 'object')
|
||||||
|
{
|
||||||
|
data.feedDate = Math.floor(Date.now() / 1000)
|
||||||
|
}
|
||||||
|
|
||||||
if(this.feed.length >= this.max)
|
if(this.feed.length >= this.max)
|
||||||
{
|
{
|
||||||
//cleanup
|
//cleanup
|
||||||
@ -63,15 +68,14 @@ module.exports = class Feed {
|
|||||||
break
|
break
|
||||||
|
|
||||||
if(this.feed.length >= this.max)
|
if(this.feed.length >= this.max)
|
||||||
return // two much for feed
|
this.feed[this.feed.length - 1] = data // replace last one
|
||||||
|
else
|
||||||
|
this.feed.push(data) // insert
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if(typeof data == 'object')
|
|
||||||
{
|
{
|
||||||
data.feedDate = Math.floor(Date.now() / 1000)
|
this.feed.push(data) // insert
|
||||||
}
|
}
|
||||||
|
|
||||||
this.feed.push(data) // insert
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this._order()
|
this._order()
|
||||||
|
Loading…
Reference in New Issue
Block a user