diff --git a/packages/backend/src/server/api/mastodon/converters.ts b/packages/backend/src/server/api/mastodon/converters.ts index 20fccec21d..60e25c0dfd 100644 --- a/packages/backend/src/server/api/mastodon/converters.ts +++ b/packages/backend/src/server/api/mastodon/converters.ts @@ -83,7 +83,7 @@ export class MastoConverters { } return 'unknown'; } - + public encodeFile(f: any): Entity.Attachment { return { id: f.id, @@ -279,7 +279,8 @@ export class MastoConverters { emoji_reactions: status.emoji_reactions, bookmarked: false, quote: isQuote ? await this.convertReblog(status.reblog) : false, - edited_at: note.updatedAt?.toISOString(), + // optional chaining cannot be used, as it evaluates to undefined, not null + edited_at: note.updatedAt ? note.updatedAt.toISOString() : null, }); } } diff --git a/packages/megalodon/src/entities/status.ts b/packages/megalodon/src/entities/status.ts index da36a04717..a38e1ea9f7 100644 --- a/packages/megalodon/src/entities/status.ts +++ b/packages/megalodon/src/entities/status.ts @@ -19,6 +19,7 @@ namespace Entity { content: string plain_content?: string | null created_at: string + edited_at: string | null emojis: Emoji[] replies_count: number reblogs_count: number diff --git a/packages/megalodon/src/friendica/api_client.ts b/packages/megalodon/src/friendica/api_client.ts index 1f27fd6d20..b0d3399784 100644 --- a/packages/megalodon/src/friendica/api_client.ts +++ b/packages/megalodon/src/friendica/api_client.ts @@ -725,6 +725,7 @@ namespace FriendicaAPI { content: s.content, plain_content: null, created_at: s.created_at, + edited_at: s.edited_at || null, emojis: Array.isArray(s.emojis) ? s.emojis.map(e => emoji(e)) : [], replies_count: s.replies_count, reblogs_count: s.reblogs_count, diff --git a/packages/megalodon/src/friendica/entities/status.ts b/packages/megalodon/src/friendica/entities/status.ts index 9d2e8b9666..014da84ee1 100644 --- a/packages/megalodon/src/friendica/entities/status.ts +++ b/packages/megalodon/src/friendica/entities/status.ts @@ -17,6 +17,7 @@ namespace FriendicaEntity { reblog: Status | null content: string created_at: string + edited_at?: string | null emojis: Emoji[] replies_count: number reblogs_count: number diff --git a/packages/megalodon/src/mastodon/api_client.ts b/packages/megalodon/src/mastodon/api_client.ts index 58f56d1013..ba4bd36ead 100644 --- a/packages/megalodon/src/mastodon/api_client.ts +++ b/packages/megalodon/src/mastodon/api_client.ts @@ -628,6 +628,7 @@ namespace MastodonAPI { content: s.content, plain_content: null, created_at: s.created_at, + edited_at: s.edited_at || null, emojis: Array.isArray(s.emojis) ? s.emojis.map(e => emoji(e)) : [], replies_count: s.replies_count, reblogs_count: s.reblogs_count, diff --git a/packages/megalodon/src/mastodon/entities/status.ts b/packages/megalodon/src/mastodon/entities/status.ts index 9624e9c72a..54b5d3bfe3 100644 --- a/packages/megalodon/src/mastodon/entities/status.ts +++ b/packages/megalodon/src/mastodon/entities/status.ts @@ -18,6 +18,7 @@ namespace MastodonEntity { reblog: Status | null content: string created_at: string + edited_at?: string | null emojis: Emoji[] replies_count: number reblogs_count: number diff --git a/packages/megalodon/src/misskey/api_client.ts b/packages/megalodon/src/misskey/api_client.ts index 520928c9fe..0591691110 100644 --- a/packages/megalodon/src/misskey/api_client.ts +++ b/packages/megalodon/src/misskey/api_client.ts @@ -283,6 +283,7 @@ namespace MisskeyAPI { : '', plain_content: n.text ? n.text : null, created_at: n.createdAt, + edited_at: n.updatedAt || null, emojis: mapEmojis(n.emojis).concat(mapReactionEmojis(n.reactionEmojis)), replies_count: n.repliesCount, reblogs_count: n.renoteCount, diff --git a/packages/megalodon/src/misskey/entities/note.ts b/packages/megalodon/src/misskey/entities/note.ts index 08c5f10aea..a7b208b153 100644 --- a/packages/megalodon/src/misskey/entities/note.ts +++ b/packages/megalodon/src/misskey/entities/note.ts @@ -7,6 +7,7 @@ namespace MisskeyEntity { export type Note = { id: string createdAt: string + updatedAt?: string | null userId: string user: User text: string | null diff --git a/packages/megalodon/src/pleroma/api_client.ts b/packages/megalodon/src/pleroma/api_client.ts index 99d964353e..c20350b67c 100644 --- a/packages/megalodon/src/pleroma/api_client.ts +++ b/packages/megalodon/src/pleroma/api_client.ts @@ -357,6 +357,7 @@ namespace PleromaAPI { content: s.content, plain_content: s.pleroma.content?.['text/plain'] ? s.pleroma.content['text/plain'] : null, created_at: s.created_at, + edited_at: s.edited_at || null, emojis: Array.isArray(s.emojis) ? s.emojis.map(e => emoji(e)) : [], replies_count: s.replies_count, reblogs_count: s.reblogs_count, diff --git a/packages/megalodon/src/pleroma/entities/status.ts b/packages/megalodon/src/pleroma/entities/status.ts index 1949ec954c..7c2b887e53 100644 --- a/packages/megalodon/src/pleroma/entities/status.ts +++ b/packages/megalodon/src/pleroma/entities/status.ts @@ -18,6 +18,7 @@ namespace PleromaEntity { reblog: Status | null content: string created_at: string + edited_at?: string | null emojis: Emoji[] replies_count: number reblogs_count: number diff --git a/packages/megalodon/test/integration/mastodon/api_client.spec.ts b/packages/megalodon/test/integration/mastodon/api_client.spec.ts index 950105152c..51caf4e227 100644 --- a/packages/megalodon/test/integration/mastodon/api_client.spec.ts +++ b/packages/megalodon/test/integration/mastodon/api_client.spec.ts @@ -49,6 +49,7 @@ const status: Entity.Status = { content: 'hoge', plain_content: null, created_at: '2019-03-26T21:40:32', + edited_at: null, emojis: [], replies_count: 0, reblogs_count: 0, diff --git a/packages/megalodon/test/unit/parser.spec.ts b/packages/megalodon/test/unit/parser.spec.ts index 94c1d98029..74264552d6 100644 --- a/packages/megalodon/test/unit/parser.spec.ts +++ b/packages/megalodon/test/unit/parser.spec.ts @@ -38,6 +38,7 @@ const status: Entity.Status = { content: 'hoge', plain_content: 'hoge', created_at: '2019-03-26T21:40:32', + edited_at: null, emojis: [], replies_count: 0, reblogs_count: 0, diff --git a/packages/megalodon/test/unit/webo_socket.spec.ts b/packages/megalodon/test/unit/webo_socket.spec.ts index bb9f997a57..b3b684efb4 100644 --- a/packages/megalodon/test/unit/webo_socket.spec.ts +++ b/packages/megalodon/test/unit/webo_socket.spec.ts @@ -37,6 +37,7 @@ const status: Entity.Status = { content: 'hoge', plain_content: 'hoge', created_at: '2019-03-26T21:40:32', + edited_at: null, emojis: [], replies_count: 0, reblogs_count: 0,