mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 04:03:49 +01:00
[mastodon-client] return actual status bookmark state
This commit is contained in:
parent
0529576277
commit
0518683b5e
@ -1243,9 +1243,17 @@ export default class Misskey implements MegalodonInterface {
|
||||
|
||||
public async noteWithDetails(n: MisskeyAPI.Entity.Note, host: string, cache: AccountCache): Promise<MegalodonEntity.Status> {
|
||||
const status = await this.addUserDetailsToStatus(this.converter.note(n, host), cache);
|
||||
status.bookmarked = await this.isStatusBookmarked(n.id);
|
||||
return this.addMentionsToStatus(status, cache);
|
||||
}
|
||||
|
||||
public async isStatusBookmarked(id: string) : Promise<boolean> {
|
||||
return this.client
|
||||
.post<MisskeyAPI.Entity.State>('/api/notes/state', {
|
||||
noteId: id
|
||||
}).then(p => p.data.isFavorited ?? false);
|
||||
}
|
||||
|
||||
public async addUserDetailsToStatus(status: Entity.Status, cache: AccountCache) : Promise<Entity.Status> {
|
||||
if (status.account.followers_count === 0 && status.account.followers_count === 0 && status.account.statuses_count === 0)
|
||||
status.account = await this.getAccountCached(status.account.id, status.account.acct, cache) ?? status.account;
|
||||
|
@ -40,7 +40,8 @@ namespace MisskeyAPI {
|
||||
export type GetAll = MisskeyEntity.GetAll
|
||||
export type UserKey = MisskeyEntity.UserKey
|
||||
export type Session = MisskeyEntity.Session
|
||||
export type Stats = MisskeyEntity.Stats
|
||||
export type Stats = MisskeyEntity.Stats
|
||||
export type State = MisskeyEntity.State
|
||||
export type APIEmoji = { emojis: Emoji[] }
|
||||
}
|
||||
|
||||
|
7
packages/megalodon/src/misskey/entities/state.ts
Normal file
7
packages/megalodon/src/misskey/entities/state.ts
Normal file
@ -0,0 +1,7 @@
|
||||
namespace MisskeyEntity {
|
||||
export type State = {
|
||||
isFavorited: boolean
|
||||
isMutedThread: boolean
|
||||
isWatching: boolean
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user