mute silenced notes in frontend
This commit is contained in:
parent
24e14c78fd
commit
64694be004
8 changed files with 39 additions and 3 deletions
|
|
@ -409,6 +409,7 @@ export class WebhookTestService {
|
|||
isMutingNote: false,
|
||||
isFavorited: false,
|
||||
isRenoted: false,
|
||||
isSilenced: false,
|
||||
visibility: note.visibility,
|
||||
mentions: note.mentions,
|
||||
visibleUserIds: note.visibleUserIds,
|
||||
|
|
|
|||
|
|
@ -642,13 +642,26 @@ export class NoteEntityService implements OnModuleInit {
|
|||
.getExists() : false),
|
||||
]);
|
||||
|
||||
const packedUser = packedUsers?.get(note.userId) ?? this.userEntityService.pack(note.user ?? note.userId, me);
|
||||
const isSilenced = Promise.resolve(packedUser).then(async u => {
|
||||
if (!u.isSilenced && !u.instance?.isSilenced) return false;
|
||||
if (note.userId === meId) return false;
|
||||
|
||||
if (meId) {
|
||||
const followings = opts._hint_?.userFollowings ?? await this.cacheService.userFollowingsCache.fetch(meId);
|
||||
if (followings.has(note.userId)) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
const packed: Packed<'Note'> = await awaitAll({
|
||||
id: note.id,
|
||||
threadId,
|
||||
createdAt: this.idService.parse(note.id).date.toISOString(),
|
||||
updatedAt: note.updatedAt ? note.updatedAt.toISOString() : undefined,
|
||||
userId: note.userId,
|
||||
user: packedUsers?.get(note.userId) ?? this.userEntityService.pack(note.user ?? note.userId, me),
|
||||
user: packedUser,
|
||||
text: text,
|
||||
cw: note.cw,
|
||||
mandatoryCW: note.mandatoryCW,
|
||||
|
|
@ -689,6 +702,7 @@ export class NoteEntityService implements OnModuleInit {
|
|||
isMutingNote: mutedNotes.has(note.id),
|
||||
isFavorited,
|
||||
isRenoted,
|
||||
isSilenced,
|
||||
|
||||
...(meId && Object.keys(reactions).length > 0 ? {
|
||||
myReaction: this.populateMyReaction({
|
||||
|
|
|
|||
|
|
@ -193,6 +193,10 @@ export const packedNoteSchema = {
|
|||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
isSilenced: {
|
||||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
emojis: {
|
||||
type: 'object',
|
||||
optional: true, nullable: false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue