Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85829582
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/changelog.d/mastodon-quote-entity.fix b/changelog.d/mastodon-quote-entity.fix
new file mode 100644
index 0000000000..197404842d
--- /dev/null
+++ b/changelog.d/mastodon-quote-entity.fix
@@ -0,0 +1 @@
+Timelines load again when the server sends Mastodon-style quotes.
diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js
index 6868a98050..9a6ce1687d 100644
--- a/src/services/entity_normalizer/entity_normalizer.service.js
+++ b/src/services/entity_normalizer/entity_normalizer.service.js
@@ -287,12 +287,20 @@ export const parseStatus = (data) => {
output.summary = data.spoiler_text
}
- const quoteRaw = pleroma?.quote || data.quote
+ // `quote` is a status (Akkoma) or a Mastodon 4.4+ quote entity
+ // ({ state, quoted_status } or, one level deep, { state, quoted_status_id }).
+ const quoteEntity = data.quote?.state ? data.quote : undefined
+ const quoteStatus = quoteEntity ? quoteEntity.quoted_status : data.quote
+ const quoteRaw = pleroma?.quote || quoteStatus
const quoteData = quoteRaw ? parseStatus(quoteRaw) : undefined
output.quote = quoteData
output.quote_id =
- data.quote?.id ?? data.quote_id ?? quoteData?.id ?? pleroma?.quote_id
- output.quote_url = data.quote?.url ?? quoteData?.url ?? pleroma?.quote_url
+ quoteStatus?.id ??
+ quoteEntity?.quoted_status_id ??
+ data.quote_id ??
+ quoteData?.id ??
+ pleroma?.quote_id
+ output.quote_url = quoteStatus?.url ?? quoteData?.url ?? pleroma?.quote_url
output.in_reply_to_status_id = data.in_reply_to_id
output.in_reply_to_user_id = data.in_reply_to_account_id
diff --git a/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js b/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js
index c68c832a0f..7fae38ce1f 100644
--- a/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js
+++ b/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js
@@ -119,6 +119,49 @@ describe('API Entities normalizer', () => {
'deadbeef',
)
})
+
+ describe('Mastodon quote entity', () => {
+ const quoted = makeMockStatusMasto({ id: 'quoted', url: 'https://q' })
+
+ it('reads the quoted status out of the entity', () => {
+ const parsed = parseStatus(
+ makeMockStatusMasto({
+ pleroma: { local: true, quote: null },
+ quote: { state: 'accepted', quoted_status: quoted },
+ }),
+ )
+ expect(parsed.quote).to.have.property('id', 'quoted')
+ expect(parsed.quote_id).to.equal('quoted')
+ expect(parsed.quote_url).to.equal('https://q')
+ })
+
+ it('keeps only the id of a shallow quote', () => {
+ const parsed = parseStatus(
+ makeMockStatusMasto({
+ pleroma: { local: true, quote: null, quote_id: 'quoted' },
+ quote: { state: 'accepted', quoted_status_id: 'quoted' },
+ }),
+ )
+ expect(parsed.quote).to.equal(undefined)
+ expect(parsed.quote_id).to.equal('quoted')
+ })
+
+ it('has no quote when the quoted post is gone', () => {
+ const parsed = parseStatus(
+ makeMockStatusMasto({
+ pleroma: { local: true, quote: null },
+ quote: { state: 'deleted', quoted_status: null },
+ }),
+ )
+ expect(parsed.quote).to.equal(undefined)
+ })
+
+ it('still reads a quote that is a plain status', () => {
+ const parsed = parseStatus(makeMockStatusMasto({ quote: quoted }))
+ expect(parsed.quote).to.have.property('id', 'quoted')
+ expect(parsed.quote_id).to.equal('quoted')
+ })
+ })
})
})
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Oct 31, 9:32 PM (14 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1801839
Default Alt Text
(3 KB)
Attached To
Mode
rPUFE pleroma-fe-upstream
Attached
Detach File
Event Timeline