[mastodon-client] always sort timelines by id (descending)
This commit is contained in:
parent
9ecffcb1f9
commit
19470265f3
1 changed files with 14 additions and 5 deletions
|
@ -1841,7 +1841,7 @@ export default class Misskey implements MegalodonInterface {
|
||||||
.post<Array<MisskeyAPI.Entity.Note>>('/api/notes/global-timeline', params)
|
.post<Array<MisskeyAPI.Entity.Note>>('/api/notes/global-timeline', params)
|
||||||
.then(async res => ({
|
.then(async res => ({
|
||||||
...res,
|
...res,
|
||||||
data: await Promise.all(res.data.map(n => this.noteWithDetails(n, this.baseUrlToHost(this.baseUrl), accountCache)))
|
data: (await Promise.all(res.data.map(n => this.noteWithDetails(n, this.baseUrlToHost(this.baseUrl), accountCache)))).sort(this.sortByIdDesc)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1899,7 +1899,7 @@ export default class Misskey implements MegalodonInterface {
|
||||||
.post<Array<MisskeyAPI.Entity.Note>>('/api/notes/local-timeline', params)
|
.post<Array<MisskeyAPI.Entity.Note>>('/api/notes/local-timeline', params)
|
||||||
.then(async res => ({
|
.then(async res => ({
|
||||||
...res,
|
...res,
|
||||||
data: await Promise.all(res.data.map(n => this.noteWithDetails(n, this.baseUrlToHost(this.baseUrl), accountCache)))
|
data: (await Promise.all(res.data.map(n => this.noteWithDetails(n, this.baseUrlToHost(this.baseUrl), accountCache)))).sort(this.sortByIdDesc)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1963,7 +1963,7 @@ export default class Misskey implements MegalodonInterface {
|
||||||
.post<Array<MisskeyAPI.Entity.Note>>('/api/notes/search-by-tag', params)
|
.post<Array<MisskeyAPI.Entity.Note>>('/api/notes/search-by-tag', params)
|
||||||
.then(async res => ({
|
.then(async res => ({
|
||||||
...res,
|
...res,
|
||||||
data: await Promise.all(res.data.map(n => this.noteWithDetails(n, this.baseUrlToHost(this.baseUrl), accountCache)))
|
data: (await Promise.all(res.data.map(n => this.noteWithDetails(n, this.baseUrlToHost(this.baseUrl), accountCache)))).sort(this.sortByIdDesc)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2018,7 +2018,7 @@ export default class Misskey implements MegalodonInterface {
|
||||||
.post<Array<MisskeyAPI.Entity.Note>>('/api/notes/timeline', params)
|
.post<Array<MisskeyAPI.Entity.Note>>('/api/notes/timeline', params)
|
||||||
.then(async res => ({
|
.then(async res => ({
|
||||||
...res,
|
...res,
|
||||||
data: await Promise.all(res.data.map(n => this.noteWithDetails(n, this.baseUrlToHost(this.baseUrl), accountCache)))
|
data: (await Promise.all(res.data.map(n => this.noteWithDetails(n, this.baseUrlToHost(this.baseUrl), accountCache)))).sort(this.sortByIdDesc)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2074,7 +2074,7 @@ export default class Misskey implements MegalodonInterface {
|
||||||
}
|
}
|
||||||
return this.client
|
return this.client
|
||||||
.post<Array<MisskeyAPI.Entity.Note>>('/api/notes/user-list-timeline', params)
|
.post<Array<MisskeyAPI.Entity.Note>>('/api/notes/user-list-timeline', params)
|
||||||
.then(async res => ({ ...res, data: await Promise.all(res.data.map(n => this.noteWithDetails(n, this.baseUrlToHost(this.baseUrl), accountCache))) }))
|
.then(async res => ({ ...res, data: (await Promise.all(res.data.map(n => this.noteWithDetails(n, this.baseUrlToHost(this.baseUrl), accountCache)))).sort(this.sortByIdDesc) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ======================================
|
// ======================================
|
||||||
|
@ -2144,6 +2144,15 @@ export default class Misskey implements MegalodonInterface {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private sortByIdDesc(a: Entity.Status, b: Entity.Status): number {
|
||||||
|
if (a.id < b.id)
|
||||||
|
return 1;
|
||||||
|
if (a.id > b.id)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// ======================================
|
// ======================================
|
||||||
// timelines/lists
|
// timelines/lists
|
||||||
// ======================================
|
// ======================================
|
||||||
|
|
Loading…
Reference in a new issue