From 6ed9796f935ebc10879fa4323b02bd0887434b34 Mon Sep 17 00:00:00 2001
From: AkiraFukushima
Date: Sat, 30 Dec 2023 11:47:31 +0900
Subject: [PATCH] Add edited_at field for Mastodon and Pleroma status
---
megalodon/src/entities/status.ts | 1 +
megalodon/src/firefish/api_client.ts | 1 +
megalodon/src/friendica/api_client.ts | 1 +
megalodon/src/mastodon/api_client.ts | 1 +
megalodon/src/mastodon/entities/status.ts | 1 +
megalodon/src/pleroma/api_client.ts | 1 +
megalodon/src/pleroma/entities/status.ts | 1 +
megalodon/test/integration/mastodon.spec.ts | 1 +
megalodon/test/integration/mastodon/api_client.spec.ts | 1 +
megalodon/test/integration/pleroma.spec.ts | 1 +
megalodon/test/unit/mastodon/web_socket.spec.ts | 1 +
megalodon/test/unit/parser.spec.ts | 1 +
megalodon/test/unit/pleroma/api_client.spec.ts | 2 ++
13 files changed, 14 insertions(+)
diff --git a/megalodon/src/entities/status.ts b/megalodon/src/entities/status.ts
index f144a8772..69b03bd61 100644
--- a/megalodon/src/entities/status.ts
+++ b/megalodon/src/entities/status.ts
@@ -18,6 +18,7 @@ export type Status = {
content: string
plain_content: string | null
created_at: string
+ edited_at: string | null
emojis: Emoji[]
replies_count: number
reblogs_count: number
diff --git a/megalodon/src/firefish/api_client.ts b/megalodon/src/firefish/api_client.ts
index 03d727949..195a880e7 100644
--- a/megalodon/src/firefish/api_client.ts
+++ b/megalodon/src/firefish/api_client.ts
@@ -300,6 +300,7 @@ namespace FirefishAPI {
: '',
plain_content: n.text ? n.text : null,
created_at: n.createdAt,
+ edited_at: null,
// Remove reaction emojis with names containing @ from the emojis list.
emojis: Array.isArray(n.emojis) ? n.emojis.filter(e => !e.name.includes('@')).map(e => emoji(e)) : [],
replies_count: n.repliesCount,
diff --git a/megalodon/src/friendica/api_client.ts b/megalodon/src/friendica/api_client.ts
index 3663d1652..48b743c78 100644
--- a/megalodon/src/friendica/api_client.ts
+++ b/megalodon/src/friendica/api_client.ts
@@ -681,6 +681,7 @@ namespace FriendicaAPI {
content: s.content,
plain_content: null,
created_at: s.created_at,
+ 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/megalodon/src/mastodon/api_client.ts b/megalodon/src/mastodon/api_client.ts
index 70d3fa144..81aa7df32 100644
--- a/megalodon/src/mastodon/api_client.ts
+++ b/megalodon/src/mastodon/api_client.ts
@@ -570,6 +570,7 @@ namespace MastodonAPI {
content: s.content,
plain_content: null,
created_at: s.created_at,
+ edited_at: s.edited_at,
emojis: Array.isArray(s.emojis) ? s.emojis.map(e => emoji(e)) : [],
replies_count: s.replies_count,
reblogs_count: s.reblogs_count,
diff --git a/megalodon/src/mastodon/entities/status.ts b/megalodon/src/mastodon/entities/status.ts
index 3c54667e4..9dbf2b0c3 100644
--- a/megalodon/src/mastodon/entities/status.ts
+++ b/megalodon/src/mastodon/entities/status.ts
@@ -16,6 +16,7 @@ export type Status = {
reblog: Status | null
content: string
created_at: string
+ edited_at: string | null
emojis: Emoji[]
replies_count: number
reblogs_count: number
diff --git a/megalodon/src/pleroma/api_client.ts b/megalodon/src/pleroma/api_client.ts
index 67f1da7ae..d57589af7 100644
--- a/megalodon/src/pleroma/api_client.ts
+++ b/megalodon/src/pleroma/api_client.ts
@@ -356,6 +356,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,
emojis: Array.isArray(s.emojis) ? s.emojis.map(e => emoji(e)) : [],
replies_count: s.replies_count,
reblogs_count: s.reblogs_count,
diff --git a/megalodon/src/pleroma/entities/status.ts b/megalodon/src/pleroma/entities/status.ts
index b3eaf38f5..9de605757 100644
--- a/megalodon/src/pleroma/entities/status.ts
+++ b/megalodon/src/pleroma/entities/status.ts
@@ -17,6 +17,7 @@ export type Status = {
reblog: Status | null
content: string
created_at: string
+ edited_at: string | null
emojis: Emoji[]
replies_count: number
reblogs_count: number
diff --git a/megalodon/test/integration/mastodon.spec.ts b/megalodon/test/integration/mastodon.spec.ts
index e5e465754..31266ba23 100644
--- a/megalodon/test/integration/mastodon.spec.ts
+++ b/megalodon/test/integration/mastodon.spec.ts
@@ -50,6 +50,7 @@ const status: MastodonEntity.Status = {
reblog: null,
content: 'hoge',
created_at: '2019-03-26T21:40:32',
+ edited_at: null,
emojis: [],
replies_count: 0,
reblogs_count: 0,
diff --git a/megalodon/test/integration/mastodon/api_client.spec.ts b/megalodon/test/integration/mastodon/api_client.spec.ts
index 950105152..51caf4e22 100644
--- a/megalodon/test/integration/mastodon/api_client.spec.ts
+++ b/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/megalodon/test/integration/pleroma.spec.ts b/megalodon/test/integration/pleroma.spec.ts
index c00499b65..a549483f0 100644
--- a/megalodon/test/integration/pleroma.spec.ts
+++ b/megalodon/test/integration/pleroma.spec.ts
@@ -49,6 +49,7 @@ const status: PleromaEntity.Status = {
reblog: null,
content: 'hoge',
created_at: '2019-03-26T21:40:32',
+ edited_at: null,
emojis: [],
replies_count: 0,
reblogs_count: 0,
diff --git a/megalodon/test/unit/mastodon/web_socket.spec.ts b/megalodon/test/unit/mastodon/web_socket.spec.ts
index 136e59318..6a041ed3c 100644
--- a/megalodon/test/unit/mastodon/web_socket.spec.ts
+++ b/megalodon/test/unit/mastodon/web_socket.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/megalodon/test/unit/parser.spec.ts b/megalodon/test/unit/parser.spec.ts
index 94c1d9802..74264552d 100644
--- a/megalodon/test/unit/parser.spec.ts
+++ b/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/megalodon/test/unit/pleroma/api_client.spec.ts b/megalodon/test/unit/pleroma/api_client.spec.ts
index 266531cc7..414b9025f 100644
--- a/megalodon/test/unit/pleroma/api_client.spec.ts
+++ b/megalodon/test/unit/pleroma/api_client.spec.ts
@@ -145,6 +145,7 @@ describe('api_client', () => {
reblog: null,
content: content,
created_at: '2019-03-26T21:40:32',
+ edited_at: null,
emojis: [],
replies_count: 0,
reblogs_count: 0,
@@ -192,6 +193,7 @@ describe('api_client', () => {
reblog: null,
content: content,
created_at: '2019-03-26T21:40:32',
+ edited_at: null,
emojis: [],
replies_count: 0,
reblogs_count: 0,