diff --git a/app/soapbox/__fixtures__/pleroma-status-reply-with-mentions.json b/app/soapbox/__fixtures__/pleroma-status-reply-with-mentions.json
new file mode 100644
index 000000000..21caf17e0
--- /dev/null
+++ b/app/soapbox/__fixtures__/pleroma-status-reply-with-mentions.json
@@ -0,0 +1,207 @@
+{
+ "account": {
+ "acct": "alex",
+ "avatar": "https://media.gleasonator.com/6d64aecb17348b23aaff78db4687b9476cb0da1c07cc6a819c2e6ec7144c18b1.png",
+ "avatar_static": "https://media.gleasonator.com/6d64aecb17348b23aaff78db4687b9476cb0da1c07cc6a819c2e6ec7144c18b1.png",
+ "bot": false,
+ "created_at": "2020-01-08T01:25:43.000Z",
+ "display_name": "Alex Gleason",
+ "emojis": [],
+ "fields": [
+ {
+ "name": "Website",
+ "value": "https://alexgleason.me"
+ },
+ {
+ "name": "Soapbox",
+ "value": "https://soapbox.pub"
+ },
+ {
+ "name": "Email",
+ "value": "alex@alexgleason.me"
+ },
+ {
+ "name": "Gender identity",
+ "value": "Soyboy"
+ },
+ {
+ "name": "Donate (PayPal)",
+ "value": "https://paypal.me/gleasonator"
+ },
+ {
+ "name": "$BTC",
+ "value": "bc1q9cx35adpm73aq2fw40ye6ts8hfxqzjr5unwg0n"
+ },
+ {
+ "name": "$ETH",
+ "value": "0xAc9aB5Fc04Dc1cB1789Af75b523Bd23C70B2D717"
+ },
+ {
+ "name": "$DOGE",
+ "value": "D5zVZs6jrRakaPVGiErkQiHt9sayzm6V5D"
+ },
+ {
+ "name": "$XMR",
+ "value": "45JDCLrjJ4bgVUSbbs2yjy9m5Mf4VLPW8fG7jw9sq5u69rXZZopQogZNeyYkMBnXpkaip4p4QwaaJNhdTotPa9g44DBCzdK"
+ }
+ ],
+ "followers_count": 2536,
+ "following_count": 1587,
+ "fqn": "alex@gleasonator.com",
+ "header": "https://media.gleasonator.com/accounts/headers/000/000/001/original/9d0e4dbf1c9dbc8f.png",
+ "header_static": "https://media.gleasonator.com/accounts/headers/000/000/001/original/9d0e4dbf1c9dbc8f.png",
+ "id": "9v5bmRalQvjOy0ECcC",
+ "last_status_at": "2022-03-26T15:13:42",
+ "locked": false,
+ "note": "I create Fediverse software that empowers people online.
I'm vegan btw
Note: If you have a question for me, please tag me publicly. This gives the opportunity for others to chime in, and bystanders to learn.",
+ "pleroma": {
+ "accepts_chat_messages": true,
+ "also_known_as": [
+ "https://mitra.social/users/alex"
+ ],
+ "ap_id": "https://gleasonator.com/users/alex",
+ "background_image": null,
+ "birthday": "1993-07-03",
+ "favicon": "https://gleasonator.com/favicon.png",
+ "hide_favorites": true,
+ "hide_followers": false,
+ "hide_followers_count": false,
+ "hide_follows": false,
+ "hide_follows_count": false,
+ "is_admin": true,
+ "is_confirmed": true,
+ "is_moderator": false,
+ "is_suggested": true,
+ "location": null,
+ "relationship": {},
+ "skip_thread_containment": false,
+ "tags": []
+ },
+ "source": {
+ "fields": [
+ {
+ "name": "Website",
+ "value": "https://alexgleason.me"
+ },
+ {
+ "name": "Soapbox",
+ "value": "https://soapbox.pub"
+ },
+ {
+ "name": "Email",
+ "value": "alex@alexgleason.me"
+ },
+ {
+ "name": "Gender identity",
+ "value": "Soyboy"
+ },
+ {
+ "name": "Donate (PayPal)",
+ "value": "https://paypal.me/gleasonator"
+ },
+ {
+ "name": "$BTC",
+ "value": "bc1q9cx35adpm73aq2fw40ye6ts8hfxqzjr5unwg0n"
+ },
+ {
+ "name": "$ETH",
+ "value": "0xAc9aB5Fc04Dc1cB1789Af75b523Bd23C70B2D717"
+ },
+ {
+ "name": "$DOGE",
+ "value": "D5zVZs6jrRakaPVGiErkQiHt9sayzm6V5D"
+ },
+ {
+ "name": "$XMR",
+ "value": "45JDCLrjJ4bgVUSbbs2yjy9m5Mf4VLPW8fG7jw9sq5u69rXZZopQogZNeyYkMBnXpkaip4p4QwaaJNhdTotPa9g44DBCzdK"
+ }
+ ],
+ "note": "I create Fediverse software that empowers people online.\r\n\r\nI'm vegan btw\r\n\r\nNote: If you have a question for me, please tag me publicly. This gives the opportunity for others to chime in, and bystanders to learn.",
+ "pleroma": {
+ "actor_type": "Person",
+ "discoverable": false
+ },
+ "sensitive": false
+ },
+ "statuses_count": 23825,
+ "url": "https://gleasonator.com/users/alex",
+ "username": "alex"
+ },
+ "application": {
+ "name": "Soapbox FE",
+ "website": "https://soapbox.pub/"
+ },
+ "bookmarked": false,
+ "card": null,
+ "content": "
DMs are definitely only federated to the servers of the recipients tho. So if I DM a kfcc user, the kfcc admins can see it, but no other instance admins can.
", + "created_at": "2022-03-21T05:04:45.000Z", + "emojis": [], + "favourited": false, + "favourites_count": 5, + "id": "AHcweewcCh0iPUtMdk", + "in_reply_to_account_id": "9v5bo8xPghEnkedGzo", + "in_reply_to_id": "AHcwFrnbH1Xb2RqxhQ", + "language": null, + "media_attachments": [], + "mentions": [ + { + "acct": "crunklord420@kiwifarms.cc", + "id": "9v5bo8xPghEnkedGzo", + "url": "https://kiwifarms.cc/users/crunklord420", + "username": "crunklord420" + }, + { + "acct": "becassine@kiwifarms.cc", + "id": "A6W9i7UOhgpBBOkcEK", + "url": "https://kiwifarms.cc/users/becassine", + "username": "becassine" + }, + { + "acct": "King_Porgi@poa.st", + "id": "A5U7Z228z3h3dBdg6C", + "url": "https://poa.st/users/King_Porgi", + "username": "King_Porgi" + }, + { + "acct": "ademan@thebag.social", + "id": "A79wLvOahABnWFnwWm", + "url": "https://thebag.social/users/ademan", + "username": "ademan" + } + ], + "muted": false, + "pinned": false, + "pleroma": { + "content": { + "text/plain": "DMs are definitely only federated to the servers of the recipients tho. So if I DM a kfcc user, the kfcc admins can see it, but no other instance admins can." + }, + "content_type": null, + "conversation_id": "AHcrQt04eG9qB87g3s", + "direct_conversation_id": null, + "emoji_reactions": [], + "expires_at": null, + "in_reply_to_account_acct": "crunklord420@kiwifarms.cc", + "local": true, + "parent_visible": true, + "pinned_at": null, + "quote": null, + "quote_url": null, + "quote_visible": false, + "spoiler_text": { + "text/plain": "" + }, + "thread_muted": false + }, + "poll": null, + "reblog": null, + "reblogged": false, + "reblogs_count": 0, + "replies_count": 2, + "sensitive": false, + "spoiler_text": "", + "tags": [], + "text": null, + "uri": "https://gleasonator.com/objects/0981bab7-a086-4ed9-b938-adc3ed9d5f51", + "url": "https://gleasonator.com/notice/AHcweewcCh0iPUtMdk", + "visibility": "public" +} diff --git a/app/soapbox/normalizers/status.ts b/app/soapbox/normalizers/status.ts index 9d2322e99..9ea660fc9 100644 --- a/app/soapbox/normalizers/status.ts +++ b/app/soapbox/normalizers/status.ts @@ -27,7 +27,6 @@ export const StatusRecord = ImmutableRecord({ emojis: ImmutableList(), favourited: false, favourites_count: 0, - filtered: false, in_reply_to_account_id: null, in_reply_to_id: null, id: '', @@ -52,6 +51,7 @@ export const StatusRecord = ImmutableRecord({ // Internal fields contentHtml: '', + filtered: false, hidden: false, search_index: '', spoilerHtml: '', diff --git a/app/soapbox/reducers/__tests__/statuses-test.js b/app/soapbox/reducers/__tests__/statuses-test.js index 130aa4ec6..94b798048 100644 --- a/app/soapbox/reducers/__tests__/statuses-test.js +++ b/app/soapbox/reducers/__tests__/statuses-test.js @@ -136,6 +136,26 @@ Promoting free speech, even for people and ideas you dislike`; const result = reducer(undefined, action).getIn(['103874034847713213', 'search_index']); expect(result).toEqual(expected); }); + + it('builds search_index with mentions', () => { + const status = require('soapbox/__fixtures__/pleroma-status-reply-with-mentions.json'); + const action = { type: STATUS_IMPORT, status }; + + const expected = `DMs are definitely only federated to the servers of the recipients tho. So if I DM a kfcc user, the kfcc admins can see it, but no other instance admins can. + + + +crunklord420 + +becassine + +King_Porgi + +ademan`; + + const result = reducer(undefined, action).getIn(['AHcweewcCh0iPUtMdk', 'search_index']); + expect(result).toEqual(expected); + }); }); describe('STATUS_CREATE_REQUEST', () => { diff --git a/app/soapbox/reducers/statuses.ts b/app/soapbox/reducers/statuses.ts index 2f0f4dd0d..27ecc4292 100644 --- a/app/soapbox/reducers/statuses.ts +++ b/app/soapbox/reducers/statuses.ts @@ -55,8 +55,8 @@ const getPollOptionTitles = (status: StatusRecord): Array