[mastodon-client] Correctly return status.tags

This commit is contained in:
Laura Hausmann 2023-10-05 17:19:40 +02:00
parent d39a3f2f66
commit 73ac3048ef
No known key found for this signature in database
GPG Key ID: D044E84C5BE01605
2 changed files with 8 additions and 2 deletions

View File

@ -90,6 +90,13 @@ export class NoteConverter {
? UserNotePinings.exist({where: {userId: user.id, noteId: note.id}})
: undefined;
const tags = note.tags.map(tag => {
return {
name: tag,
url: `${config.url}/tags/${tag}`
} as MastodonEntity.Tag;
});
// noinspection ES6MissingAwait
return await awaitAll({
id: note.id,
@ -118,7 +125,7 @@ export class NoteConverter {
visibility: VisibilityConverter.encode(note.visibility),
media_attachments: files.then(files => files.length > 0 ? files.map((f) => FileConverter.encode(f)) : []),
mentions: mentions,
tags: [], //FIXME
tags: tags,
card: null, //FIXME
poll: note.hasPoll ? populatePoll(note, user?.id ?? null).then(p => PollConverter.encode(p, note.id)) : null,
application: null, //FIXME

View File

@ -13,7 +13,6 @@ export class NotificationConverter {
public static async encode(notification: Notification, localUser: ILocalUser, cache: AccountCache = UserHelpers.getFreshAccountCache()): Promise<MastodonEntity.Notification> {
if (notification.notifieeId !== localUser.id) throw new Error('User is not recipient of notification');
//TODO: Test this (poll ended etc)
const account = notification.notifierId
? UserHelpers.getUserCached(notification.notifierId, cache).then(p => UserConverter.encode(p))
: UserConverter.encode(localUser);