diff --git a/app/soapbox/__fixtures__/fedibird-quote-of-quote-post.json b/app/soapbox/__fixtures__/fedibird-quote-of-quote-post.json new file mode 100644 index 000000000..c00c81860 --- /dev/null +++ b/app/soapbox/__fixtures__/fedibird-quote-of-quote-post.json @@ -0,0 +1,109 @@ +{ + "id": "107673570598783346", + "created_at": "2022-01-23T20:05:01.372Z", + "in_reply_to_id": null, + "in_reply_to_account_id": null, + "sensitive": false, + "spoiler_text": "", + "visibility": "public", + "language": "en", + "uri": "https://fedibird.com/users/alex/statuses/107673570598783346", + "url": "https://fedibird.com/@alex/107673570598783346", + "replies_count": 0, + "reblogs_count": 0, + "favourites_count": 0, + "emoji_reactions_count": 0, + "emoji_reactions": [], + "content": "

test quote of a quote
QT: https://fedibird.com/@alex/107673570082615319

", + "quote_id": "107673570082615319", + "reblog": null, + "application": { + "name": "Web", + "website": null + }, + "account": { + "id": "66768", + "username": "alex", + "acct": "alex", + "display_name": "", + "locked": false, + "bot": false, + "discoverable": null, + "group": false, + "created_at": "2020-01-27T00:00:00.000Z", + "note": "

", + "url": "https://fedibird.com/@alex", + "avatar": "https://fedibird.com/avatars/original/missing.png", + "avatar_static": "https://fedibird.com/avatars/original/missing.png", + "header": "https://fedibird.com/headers/original/missing.png", + "header_static": "https://fedibird.com/headers/original/missing.png", + "followers_count": 0, + "following_count": 1, + "subscribing_count": 0, + "statuses_count": 3, + "last_status_at": "2022-01-23", + "emojis": [], + "fields": [] + }, + "media_attachments": [], + "mentions": [], + "tags": [], + "emojis": [], + "card": null, + "poll": null, + "quote": { + "id": "107673570082615319", + "created_at": "2022-01-23T20:04:53.494Z", + "in_reply_to_id": null, + "in_reply_to_account_id": null, + "sensitive": false, + "spoiler_text": "", + "visibility": "public", + "language": "en", + "uri": "https://fedibird.com/users/alex/statuses/107673570082615319", + "url": "https://fedibird.com/@alex/107673570082615319", + "replies_count": 0, + "reblogs_count": 0, + "favourites_count": 0, + "emoji_reactions_count": 0, + "emoji_reactions": [], + "content": "

test quote
QT: https://fedibird.com/@alex/107673569214329435

", + "quote_id": "107673569214329435", + "quote": null, + "reblog": null, + "application": { + "name": "Web", + "website": null + }, + "account": { + "id": "66768", + "username": "alex", + "acct": "alex", + "display_name": "", + "locked": false, + "bot": false, + "discoverable": null, + "group": false, + "created_at": "2020-01-27T00:00:00.000Z", + "note": "

", + "url": "https://fedibird.com/@alex", + "avatar": "https://fedibird.com/avatars/original/missing.png", + "avatar_static": "https://fedibird.com/avatars/original/missing.png", + "header": "https://fedibird.com/headers/original/missing.png", + "header_static": "https://fedibird.com/headers/original/missing.png", + "followers_count": 0, + "following_count": 1, + "subscribing_count": 0, + "statuses_count": 3, + "last_status_at": "2022-01-23", + "emojis": [], + "fields": [] + }, + "media_attachments": [], + "mentions": [], + "tags": [], + "emojis": [], + "card": null, + "poll": null + } +} diff --git a/app/soapbox/__fixtures__/fedibird-quote-post.json b/app/soapbox/__fixtures__/fedibird-quote-post.json new file mode 100644 index 000000000..610ab45c6 --- /dev/null +++ b/app/soapbox/__fixtures__/fedibird-quote-post.json @@ -0,0 +1,108 @@ +{ + "id": "107673570082615319", + "created_at": "2022-01-23T20:04:53.494Z", + "in_reply_to_id": null, + "in_reply_to_account_id": null, + "sensitive": false, + "spoiler_text": "", + "visibility": "public", + "language": "en", + "uri": "https://fedibird.com/users/alex/statuses/107673570082615319", + "url": "https://fedibird.com/@alex/107673570082615319", + "replies_count": 0, + "reblogs_count": 0, + "favourites_count": 0, + "emoji_reactions_count": 0, + "emoji_reactions": [], + "content": "

test quote
QT: https://fedibird.com/@alex/107673569214329435

", + "quote_id": "107673569214329435", + "reblog": null, + "application": { + "name": "Web", + "website": null + }, + "account": { + "id": "66768", + "username": "alex", + "acct": "alex", + "display_name": "", + "locked": false, + "bot": false, + "discoverable": null, + "group": false, + "created_at": "2020-01-27T00:00:00.000Z", + "note": "

", + "url": "https://fedibird.com/@alex", + "avatar": "https://fedibird.com/avatars/original/missing.png", + "avatar_static": "https://fedibird.com/avatars/original/missing.png", + "header": "https://fedibird.com/headers/original/missing.png", + "header_static": "https://fedibird.com/headers/original/missing.png", + "followers_count": 0, + "following_count": 1, + "subscribing_count": 0, + "statuses_count": 3, + "last_status_at": "2022-01-23", + "emojis": [], + "fields": [] + }, + "media_attachments": [], + "mentions": [], + "tags": [], + "emojis": [], + "card": null, + "poll": null, + "quote": { + "id": "107673569214329435", + "created_at": "2022-01-23T20:04:40.249Z", + "in_reply_to_id": null, + "in_reply_to_account_id": null, + "sensitive": false, + "spoiler_text": "", + "visibility": "public", + "language": "en", + "uri": "https://fedibird.com/users/alex/statuses/107673569214329435", + "url": "https://fedibird.com/@alex/107673569214329435", + "replies_count": 0, + "reblogs_count": 0, + "favourites_count": 0, + "emoji_reactions_count": 0, + "emoji_reactions": [], + "content": "

test post

", + "quote": null, + "reblog": null, + "application": { + "name": "Web", + "website": null + }, + "account": { + "id": "66768", + "username": "alex", + "acct": "alex", + "display_name": "", + "locked": false, + "bot": false, + "discoverable": null, + "group": false, + "created_at": "2020-01-27T00:00:00.000Z", + "note": "

", + "url": "https://fedibird.com/@alex", + "avatar": "https://fedibird.com/avatars/original/missing.png", + "avatar_static": "https://fedibird.com/avatars/original/missing.png", + "header": "https://fedibird.com/headers/original/missing.png", + "header_static": "https://fedibird.com/headers/original/missing.png", + "followers_count": 0, + "following_count": 1, + "subscribing_count": 0, + "statuses_count": 3, + "last_status_at": "2022-01-23", + "emojis": [], + "fields": [] + }, + "media_attachments": [], + "mentions": [], + "tags": [], + "emojis": [], + "card": null, + "poll": null + } +} diff --git a/app/soapbox/__fixtures__/pleroma-quote-of-quote-post.json b/app/soapbox/__fixtures__/pleroma-quote-of-quote-post.json new file mode 100644 index 000000000..1156cdb3a --- /dev/null +++ b/app/soapbox/__fixtures__/pleroma-quote-of-quote-post.json @@ -0,0 +1,371 @@ +{ + "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": "Pleroma+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": 2220, + "following_count": 1544, + "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-01-24T21:02:44", + "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": [], + "ap_id": "https://gleasonator.com/users/alex", + "background_image": null, + "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, + "relationship": {}, + "skip_thread_containment": false, + "tags": [] + }, + "source": { + "fields": [ + { + "name": "Website", + "value": "https://alexgleason.me" + }, + { + "name": "Pleroma+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": 23004, + "url": "https://gleasonator.com/users/alex", + "username": "alex" + }, + "application": { + "name": "Soapbox FE", + "website": "https://soapbox.pub/" + }, + "bookmarked": false, + "card": null, + "content": "

Quote of quote post

", + "created_at": "2022-01-24T21:02:43.000Z", + "emojis": [], + "favourited": false, + "favourites_count": 0, + "id": "AFmFNKmfrR9CxtV01g", + "in_reply_to_account_id": null, + "in_reply_to_id": null, + "language": null, + "media_attachments": [], + "mentions": [ + { + "acct": "alex", + "id": "9v5bmRalQvjOy0ECcC", + "url": "https://gleasonator.com/users/alex", + "username": "alex" + } + ], + "muted": false, + "pinned": false, + "pleroma": { + "content": { + "text/plain": "Quote of quote post" + }, + "conversation_id": "AFmFNKkXzLRirIVIi8", + "direct_conversation_id": null, + "emoji_reactions": [], + "expires_at": null, + "in_reply_to_account_acct": null, + "local": true, + "parent_visible": false, + "pinned_at": null, + "quote": { + "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": "Pleroma+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": 2220, + "following_count": 1544, + "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-01-24T21:02:44", + "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": [], + "ap_id": "https://gleasonator.com/users/alex", + "background_image": null, + "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, + "relationship": {}, + "skip_thread_containment": false, + "tags": [] + }, + "source": { + "fields": [ + { + "name": "Website", + "value": "https://alexgleason.me" + }, + { + "name": "Pleroma+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": 23004, + "url": "https://gleasonator.com/users/alex", + "username": "alex" + }, + "application": { + "name": "Soapbox FE", + "website": "https://soapbox.pub/" + }, + "bookmarked": false, + "card": null, + "content": "

Quote post

", + "created_at": "2022-01-24T21:02:34.000Z", + "emojis": [], + "favourited": false, + "favourites_count": 0, + "id": "AFmFMSpITT9xcOJKcK", + "in_reply_to_account_id": null, + "in_reply_to_id": null, + "language": null, + "media_attachments": [], + "mentions": [ + { + "acct": "alex", + "id": "9v5bmRalQvjOy0ECcC", + "url": "https://gleasonator.com/users/alex", + "username": "alex" + } + ], + "muted": false, + "pinned": false, + "pleroma": { + "content": { + "text/plain": "Quote post" + }, + "conversation_id": "AFmFMSnWa3k3WtTur2", + "direct_conversation_id": null, + "emoji_reactions": [ + { + "count": 1, + "me": false, + "name": "👍" + } + ], + "expires_at": null, + "in_reply_to_account_acct": null, + "local": true, + "parent_visible": false, + "pinned_at": null, + "quote": null, + "quote_url": "https://gleasonator.com/objects/4f35159c-3794-4037-9269-a7c84f7137c7", + "spoiler_text": { + "text/plain": "" + }, + "thread_muted": false + }, + "poll": null, + "reblog": null, + "reblogged": false, + "reblogs_count": 0, + "replies_count": 0, + "sensitive": false, + "spoiler_text": "", + "tags": [], + "text": null, + "uri": "https://gleasonator.com/objects/54d93075-7d04-4016-a128-81f3843bca79", + "url": "https://gleasonator.com/notice/AFmFMSpITT9xcOJKcK", + "visibility": "public" + }, + "quote_url": "https://gleasonator.com/objects/54d93075-7d04-4016-a128-81f3843bca79", + "spoiler_text": { + "text/plain": "" + }, + "thread_muted": false + }, + "poll": null, + "reblog": null, + "reblogged": false, + "reblogs_count": 0, + "replies_count": 1, + "sensitive": false, + "spoiler_text": "", + "tags": [], + "text": null, + "uri": "https://gleasonator.com/objects/1e2cfb5a-ece5-42df-9ec1-13e5de6d9f5b", + "url": "https://gleasonator.com/notice/AFmFNKmfrR9CxtV01g", + "visibility": "public" +} diff --git a/app/soapbox/__fixtures__/pleroma-quote-post.json b/app/soapbox/__fixtures__/pleroma-quote-post.json new file mode 100644 index 000000000..994671ce4 --- /dev/null +++ b/app/soapbox/__fixtures__/pleroma-quote-post.json @@ -0,0 +1,364 @@ +{ + "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": "Pleroma+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": 2220, + "following_count": 1544, + "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-01-24T21:02:44", + "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": [], + "ap_id": "https://gleasonator.com/users/alex", + "background_image": null, + "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, + "relationship": {}, + "skip_thread_containment": false, + "tags": [] + }, + "source": { + "fields": [ + { + "name": "Website", + "value": "https://alexgleason.me" + }, + { + "name": "Pleroma+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": 23004, + "url": "https://gleasonator.com/users/alex", + "username": "alex" + }, + "application": { + "name": "Soapbox FE", + "website": "https://soapbox.pub/" + }, + "bookmarked": false, + "card": null, + "content": "

Quote post

", + "created_at": "2022-01-24T21:02:34.000Z", + "emojis": [], + "favourited": false, + "favourites_count": 0, + "id": "AFmFMSpITT9xcOJKcK", + "in_reply_to_account_id": null, + "in_reply_to_id": null, + "language": null, + "media_attachments": [], + "mentions": [ + { + "acct": "alex", + "id": "9v5bmRalQvjOy0ECcC", + "url": "https://gleasonator.com/users/alex", + "username": "alex" + } + ], + "muted": false, + "pinned": false, + "pleroma": { + "content": { + "text/plain": "Quote post" + }, + "conversation_id": "AFmFMSnWa3k3WtTur2", + "direct_conversation_id": null, + "emoji_reactions": [ + { + "count": 1, + "me": false, + "name": "👍" + } + ], + "expires_at": null, + "in_reply_to_account_acct": null, + "local": true, + "parent_visible": false, + "pinned_at": null, + "quote": { + "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": "Pleroma+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": 2220, + "following_count": 1544, + "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-01-24T21:02:44", + "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": [], + "ap_id": "https://gleasonator.com/users/alex", + "background_image": null, + "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, + "relationship": {}, + "skip_thread_containment": false, + "tags": [] + }, + "source": { + "fields": [ + { + "name": "Website", + "value": "https://alexgleason.me" + }, + { + "name": "Pleroma+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": 23004, + "url": "https://gleasonator.com/users/alex", + "username": "alex" + }, + "application": { + "name": "Soapbox FE", + "website": "https://soapbox.pub/" + }, + "bookmarked": false, + "card": null, + "content": "

Test post

", + "created_at": "2022-01-24T21:02:25.000Z", + "emojis": [], + "favourited": false, + "favourites_count": 0, + "id": "AFmFLcd6XYVdjWCrOS", + "in_reply_to_account_id": null, + "in_reply_to_id": null, + "language": null, + "media_attachments": [], + "mentions": [], + "muted": false, + "pinned": false, + "pleroma": { + "content": { + "text/plain": "Test post" + }, + "conversation_id": "AFmFLcaGi6EzaisayO", + "direct_conversation_id": null, + "emoji_reactions": [], + "expires_at": null, + "in_reply_to_account_acct": null, + "local": true, + "parent_visible": false, + "pinned_at": null, + "quote": null, + "quote_url": null, + "spoiler_text": { + "text/plain": "" + }, + "thread_muted": false + }, + "poll": null, + "reblog": null, + "reblogged": false, + "reblogs_count": 0, + "replies_count": 0, + "sensitive": false, + "spoiler_text": "", + "tags": [], + "text": null, + "uri": "https://gleasonator.com/objects/4f35159c-3794-4037-9269-a7c84f7137c7", + "url": "https://gleasonator.com/notice/AFmFLcd6XYVdjWCrOS", + "visibility": "public" + }, + "quote_url": "https://gleasonator.com/objects/4f35159c-3794-4037-9269-a7c84f7137c7", + "spoiler_text": { + "text/plain": "" + }, + "thread_muted": false + }, + "poll": null, + "reblog": null, + "reblogged": false, + "reblogs_count": 0, + "replies_count": 0, + "sensitive": false, + "spoiler_text": "", + "tags": [], + "text": null, + "uri": "https://gleasonator.com/objects/54d93075-7d04-4016-a128-81f3843bca79", + "url": "https://gleasonator.com/notice/AFmFMSpITT9xcOJKcK", + "visibility": "public" +} diff --git a/app/soapbox/actions/compose.js b/app/soapbox/actions/compose.js index 9801b40b2..4eca355d4 100644 --- a/app/soapbox/actions/compose.js +++ b/app/soapbox/actions/compose.js @@ -27,6 +27,8 @@ export const COMPOSE_SUBMIT_SUCCESS = 'COMPOSE_SUBMIT_SUCCESS'; export const COMPOSE_SUBMIT_FAIL = 'COMPOSE_SUBMIT_FAIL'; export const COMPOSE_REPLY = 'COMPOSE_REPLY'; export const COMPOSE_REPLY_CANCEL = 'COMPOSE_REPLY_CANCEL'; +export const COMPOSE_QUOTE = 'COMPOSE_QUOTE'; +export const COMPOSE_QUOTE_CANCEL = 'COMPOSE_QUOTE_CANCEL'; export const COMPOSE_DIRECT = 'COMPOSE_DIRECT'; export const COMPOSE_MENTION = 'COMPOSE_MENTION'; export const COMPOSE_RESET = 'COMPOSE_RESET'; @@ -119,6 +121,29 @@ export function cancelReplyCompose() { }; } +export function quoteCompose(status, routerHistory) { + return (dispatch, getState) => { + const state = getState(); + const instance = state.get('instance'); + const { explicitAddressing } = getFeatures(instance); + + dispatch({ + type: COMPOSE_QUOTE, + status: status, + account: state.getIn(['accounts', state.get('me')]), + explicitAddressing, + }); + + dispatch(openModal('COMPOSE')); + }; +} + +export function cancelQuoteCompose() { + return { + type: COMPOSE_QUOTE_CANCEL, + }; +} + export function resetCompose() { return { type: COMPOSE_RESET, @@ -212,7 +237,7 @@ export function submitCompose(routerHistory, force = false) { } if (to && status) { - const mentions = status.match(/(?:^|\s|\.)@([a-z0-9_]+(?:@[a-z0-9\.\-]+)?)/g); // not a perfect regex + const mentions = status.match(/(?:^|\s|\.)@([a-z0-9_]+(?:@[a-z0-9\.\-]+)?)/gi); // not a perfect regex if (mentions) to = to.union(mentions.map(mention => mention.trim().slice(1))); @@ -226,6 +251,7 @@ export function submitCompose(routerHistory, force = false) { const params = { status, in_reply_to_id: state.getIn(['compose', 'in_reply_to'], null), + quote_id: state.getIn(['compose', 'quote'], null), media_ids: media.map(item => item.get('id')), sensitive: state.getIn(['compose', 'sensitive']), spoiler_text: state.getIn(['compose', 'spoiler_text'], ''), diff --git a/app/soapbox/actions/importer/index.js b/app/soapbox/actions/importer/index.js index 407bb7c30..aee579695 100644 --- a/app/soapbox/actions/importer/index.js +++ b/app/soapbox/actions/importer/index.js @@ -13,12 +13,6 @@ export const STATUSES_IMPORT = 'STATUSES_IMPORT'; export const POLLS_IMPORT = 'POLLS_IMPORT'; export const ACCOUNT_FETCH_FAIL_FOR_USERNAME_LOOKUP = 'ACCOUNT_FETCH_FAIL_FOR_USERNAME_LOOKUP'; -function pushUnique(array, object) { - if (array.every(element => element.id !== object.id)) { - array.push(object); - } -} - export function importAccount(account) { return { type: ACCOUNT_IMPORT, account }; } @@ -49,7 +43,7 @@ export function importFetchedAccounts(accounts) { function processAccount(account) { if (!account.id) return; - pushUnique(normalAccounts, normalizeAccount(account)); + normalAccounts.push(normalizeAccount(account)); if (account.moved) { processAccount(account.moved); @@ -75,6 +69,15 @@ export function importFetchedStatus(status, idempotencyKey) { dispatch(importFetchedStatus(status.reblog)); } + // Fedibird quotes + if (status.quote && status.quote.id) { + dispatch(importFetchedStatus(status.quote)); + } + + if (status.pleroma && status.pleroma.quote && status.pleroma.quote.id) { + dispatch(importFetchedStatus(status.pleroma.quote)); + } + if (status.poll && status.poll.id) { dispatch(importFetchedPoll(status.poll)); } @@ -113,15 +116,24 @@ export function importFetchedStatuses(statuses) { const normalOldStatus = getState().getIn(['statuses', status.id]); const expandSpoilers = getSettings(getState()).get('expandSpoilers'); - pushUnique(normalStatuses, normalizeStatus(status, normalOldStatus, expandSpoilers)); - pushUnique(accounts, status.account); + normalStatuses.push(normalizeStatus(status, normalOldStatus, expandSpoilers)); + accounts.push(status.account); if (status.reblog && status.reblog.id) { processStatus(status.reblog); } + // Fedibird quotes + if (status.quote && status.quote.id) { + processStatus(status.quote); + } + + if (status.pleroma && status.pleroma.quote && status.pleroma.quote.id) { + processStatus(status.pleroma.quote); + } + if (status.poll && status.poll.id) { - pushUnique(polls, normalizePoll(status.poll)); + polls.push(normalizePoll(status.poll)); } } diff --git a/app/soapbox/actions/importer/normalizer.js b/app/soapbox/actions/importer/normalizer.js index 240abddcc..c8f1a83ef 100644 --- a/app/soapbox/actions/importer/normalizer.js +++ b/app/soapbox/actions/importer/normalizer.js @@ -37,7 +37,12 @@ export function normalizeAccount(account) { } export function normalizeStatus(status, normalOldStatus, expandSpoilers) { - const normalStatus = { ...status }; + const normalStatus = { ...status }; + + // Copy the pleroma object too, so we can modify our copy + if (status.pleroma) { + normalStatus.pleroma = { ...status.pleroma }; + } normalStatus.account = status.account.id; @@ -49,6 +54,18 @@ export function normalizeStatus(status, normalOldStatus, expandSpoilers) { normalStatus.poll = status.poll.id; } + if (status.pleroma && status.pleroma.quote && status.pleroma.quote.id) { + // Normalize quote to the top-level, so delete the original for performance + normalStatus.quote = status.pleroma.quote.id; + delete normalStatus.pleroma.quote; + } else if (status.quote && status.quote.id) { + // Fedibird compatibility, because why not + normalStatus.quote = status.quote.id; + } else if (status.quote_id) { + // Fedibird: fall back to quote_id + normalStatus.quote = status.quote_id; + } + // Only calculate these values when status first encountered // Otherwise keep the ones already in the reducer if (normalOldStatus) { diff --git a/app/soapbox/components/dropdown_menu.js b/app/soapbox/components/dropdown_menu.js index fa0d1ffd5..453f24d71 100644 --- a/app/soapbox/components/dropdown_menu.js +++ b/app/soapbox/components/dropdown_menu.js @@ -207,6 +207,8 @@ export default class Dropdown extends React.PureComponent { src: PropTypes.string, items: PropTypes.array.isRequired, size: PropTypes.number, + active: PropTypes.bool, + pressed: PropTypes.bool, title: PropTypes.string, disabled: PropTypes.bool, status: ImmutablePropTypes.map, @@ -217,6 +219,7 @@ export default class Dropdown extends React.PureComponent { dropdownPlacement: PropTypes.string, openDropdownId: PropTypes.number, openedViaKeyboard: PropTypes.bool, + text: PropTypes.string, }; static defaultProps = { @@ -302,7 +305,7 @@ export default class Dropdown extends React.PureComponent { } render() { - const { icon, src, items, size, title, disabled, dropdownPlacement, openDropdownId, openedViaKeyboard } = this.props; + const { icon, src, items, size, title, disabled, dropdownPlacement, openDropdownId, openedViaKeyboard, active, pressed, text } = this.props; const open = this.state.id === openDropdownId; return ( @@ -311,9 +314,11 @@ export default class Dropdown extends React.PureComponent { icon={icon} src={src} title={title} - active={open} + active={open || active} + pressed={pressed} disabled={disabled} size={size} + text={text} ref={this.setTargetRef} onClick={this.handleClick} onMouseDown={this.handleMouseDown} diff --git a/app/soapbox/components/modal_root.js b/app/soapbox/components/modal_root.js index 220d22f61..3b622e3e0 100644 --- a/app/soapbox/components/modal_root.js +++ b/app/soapbox/components/modal_root.js @@ -18,6 +18,7 @@ const checkComposeContent = compose => { compose.get('spoiler_text').length > 0, compose.get('media_attachments').size > 0, compose.get('in_reply_to') !== null, + compose.get('quote') !== null, compose.get('poll') !== null, ].some(check => check === true); }; diff --git a/app/soapbox/components/status.js b/app/soapbox/components/status.js index 2f5e12705..fe23bae02 100644 --- a/app/soapbox/components/status.js +++ b/app/soapbox/components/status.js @@ -10,6 +10,7 @@ import { Link, NavLink } from 'react-router-dom'; import HoverRefWrapper from 'soapbox/components/hover_ref_wrapper'; import Icon from 'soapbox/components/icon'; import PlaceholderCard from 'soapbox/features/placeholder/components/placeholder_card'; +import QuotedStatus from 'soapbox/features/status/containers/quoted_status_container'; import { getDomain } from 'soapbox/utils/accounts'; import Card from '../features/status/components/card'; @@ -70,6 +71,7 @@ class Status extends ImmutablePureComponent { onReply: PropTypes.func, onFavourite: PropTypes.func, onReblog: PropTypes.func, + onQuote: PropTypes.func, onDelete: PropTypes.func, onDirect: PropTypes.func, onChat: PropTypes.func, @@ -456,7 +458,7 @@ class Status extends ImmutablePureComponent { ); } - } else if (status.get('spoiler_text').length === 0 && status.get('card')) { + } else if (status.get('spoiler_text').length === 0 && !status.get('quote') && status.get('card')) { media = ( ; + } + if (otherAccounts && otherAccounts.size > 1) { statusAvatar = ; } else if (account === undefined || account === null) { @@ -551,6 +559,7 @@ class Status extends ImmutablePureComponent { {media} {poll} + {quote} { + const { me, onQuote, onOpenUnauthorizedModal, status } = this.props; + if (me) { + onQuote(status, this.context.router.history); + } else { + onOpenUnauthorizedModal('REBLOG'); + } + } + handleDeleteClick = () => { this.props.onDelete(this.props.status, this.context.router.history); } @@ -496,7 +507,7 @@ class StatusActionBar extends ImmutablePureComponent { } render() { - const { status, intl, allowedEmoji, emojiSelectorFocused, handleEmojiSelectorUnfocus, features } = this.props; + const { status, intl, allowedEmoji, emojiSelectorFocused, handleEmojiSelectorUnfocus, features, me } = this.props; const { emojiSelectorVisible } = this.state; const publicStatus = ['public', 'unlisted'].includes(status.get('visibility')); @@ -530,6 +541,47 @@ class StatusActionBar extends ImmutablePureComponent { reblogIcon = require('@tabler/icons/icons/lock.svg'); } + let reblogButton; + + if (me && features.quotePosts) { + const reblogMenu = [ + { + text: intl.formatMessage(status.get('reblogged') ? messages.cancel_reblog_private : messages.reblog), + action: this.handleReblogClick, + icon: require('@tabler/icons/icons/repeat.svg'), + }, + { + text: intl.formatMessage(messages.quotePost), + action: this.handleQuoteClick, + icon: require('@tabler/icons/icons/quote.svg'), + }, + ]; + + reblogButton = ( + + ); + } else { + reblogButton = ( + + ); + } + if (status.get('in_reply_to_id', null) === null) { replyTitle = intl.formatMessage(messages.reply); } else { @@ -553,8 +605,8 @@ class StatusActionBar extends ImmutablePureComponent { {replyCount !== 0 && {replyCount}} -
- +
+ {reblogButton} {reblogCount !== 0 && {reblogCount}}
{ onReblog(status, e) { dispatch((_, getState) => { const boostModal = getSettings(getState()).get('boostModal'); - if (e.shiftKey || !boostModal) { + if ((e && e.shiftKey) || !boostModal) { onModalReblog(status); } else { dispatch(openModal('BOOST', { status, onReblog: onModalReblog })); @@ -108,6 +109,21 @@ const mapDispatchToProps = (dispatch, { intl }) => { }); }, + onQuote(status, router) { + dispatch((_, getState) => { + const state = getState(); + if (state.getIn(['compose', 'text']).trim().length !== 0) { + dispatch(openModal('CONFIRM', { + message: intl.formatMessage(messages.replyMessage), + confirm: intl.formatMessage(messages.replyConfirm), + onConfirm: () => dispatch(quoteCompose(status, router)), + })); + } else { + dispatch(quoteCompose(status, router)); + } + }); + }, + onFavourite(status) { if (status.get('favourited')) { dispatch(unfavourite(status)); diff --git a/app/soapbox/features/chats/components/chat_message_list.js b/app/soapbox/features/chats/components/chat_message_list.js index e40f1a80b..d94b72d67 100644 --- a/app/soapbox/features/chats/components/chat_message_list.js +++ b/app/soapbox/features/chats/components/chat_message_list.js @@ -268,12 +268,15 @@ class ChatMessageList extends ImmutablePureComponent { icon: require('@tabler/icons/icons/trash.svg'), destructive: true, }, - { + ]; + + if (chatMessage.get('account_id') !== me) { + menu.push({ text: intl.formatMessage(messages.report), action: this.handleReportUser(chatMessage.get('account_id')), icon: require('@tabler/icons/icons/flag.svg'), - }, - ]; + }); + } return (
+ +
diff --git a/app/soapbox/features/compose/containers/quoted_status_container.js b/app/soapbox/features/compose/containers/quoted_status_container.js new file mode 100644 index 000000000..c15fa1764 --- /dev/null +++ b/app/soapbox/features/compose/containers/quoted_status_container.js @@ -0,0 +1,26 @@ +import { connect } from 'react-redux'; + +import { cancelQuoteCompose } from 'soapbox/actions/compose'; +import QuotedStatus from 'soapbox/features/status/components/quoted_status'; +import { makeGetStatus } from 'soapbox/selectors'; + +const makeMapStateToProps = () => { + const getStatus = makeGetStatus(); + + const mapStateToProps = state => ({ + status: getStatus(state, { id: state.getIn(['compose', 'quote']) }), + compose: true, + }); + + return mapStateToProps; +}; + +const mapDispatchToProps = dispatch => ({ + + onCancel() { + dispatch(cancelQuoteCompose()); + }, + +}); + +export default connect(makeMapStateToProps, mapDispatchToProps)(QuotedStatus); \ No newline at end of file diff --git a/app/soapbox/features/status/components/action_bar.js b/app/soapbox/features/status/components/action_bar.js index 4777a241e..e154b2d43 100644 --- a/app/soapbox/features/status/components/action_bar.js +++ b/app/soapbox/features/status/components/action_bar.js @@ -53,6 +53,7 @@ const messages = defineMessages({ reactionCry: { id: 'status.reactions.cry', defaultMessage: 'Sad' }, reactionWeary: { id: 'status.reactions.weary', defaultMessage: 'Weary' }, emojiPickerExpand: { id: 'status.reactions_expand', defaultMessage: 'Select emoji' }, + quotePost: { id: 'status.quote', defaultMessage: 'Quote post' }, }); const mapStateToProps = state => { @@ -87,6 +88,7 @@ class ActionBar extends React.PureComponent { status: ImmutablePropTypes.map.isRequired, onReply: PropTypes.func.isRequired, onReblog: PropTypes.func.isRequired, + onQuote: PropTypes.func.isRequired, onFavourite: PropTypes.func.isRequired, onEmojiReact: PropTypes.func.isRequired, onDelete: PropTypes.func.isRequired, @@ -143,6 +145,15 @@ class ActionBar extends React.PureComponent { } } + handleQuoteClick = () => { + const { me, onQuote, onOpenUnauthorizedModal, status } = this.props; + if (me) { + onQuote(status, this.context.router.history); + } else { + onOpenUnauthorizedModal('REBLOG'); + } + } + handleBookmarkClick = () => { this.props.onBookmark(this.props.status); } @@ -486,6 +497,47 @@ class ActionBar extends React.PureComponent { const reblog_disabled = (status.get('visibility') === 'direct' || status.get('visibility') === 'private'); + let reblogButton; + + if (me && features.quotePosts) { + const reblogMenu = [ + { + text: intl.formatMessage(status.get('reblogged') ? messages.cancel_reblog_private : messages.reblog), + action: this.handleReblogClick, + icon: require('@tabler/icons/icons/repeat.svg'), + }, + { + text: intl.formatMessage(messages.quotePost), + action: this.handleQuoteClick, + icon: require('@tabler/icons/icons/quote.svg'), + }, + ]; + + reblogButton = ( + + ); + } else { + reblogButton = ( + + ); + } + return (
@@ -497,14 +549,7 @@ class ActionBar extends React.PureComponent { />
- + {reblogButton}
); } - } else if (status.get('spoiler_text').length === 0) { + } else if (status.get('spoiler_text').length === 0 && !status.get('quote')) { media = ; } + let quote; + + if (status.get('quote')) { + quote = ; + } + if (status.get('visibility') === 'direct') { statusTypeIcon = ; } else if (status.get('visibility') === 'private') { @@ -201,6 +208,7 @@ class DetailedStatus extends ImmutablePureComponent { /> {media} + {quote}
diff --git a/app/soapbox/features/status/components/quoted_status.js b/app/soapbox/features/status/components/quoted_status.js new file mode 100644 index 000000000..3bb8b2367 --- /dev/null +++ b/app/soapbox/features/status/components/quoted_status.js @@ -0,0 +1,164 @@ +import PropTypes from 'prop-types'; +import React from 'react'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; +import { NavLink } from 'react-router-dom'; + +import AttachmentThumbs from 'soapbox/components/attachment_thumbs'; +import Avatar from 'soapbox/components/avatar'; +import DisplayName from 'soapbox/components/display_name'; +import IconButton from 'soapbox/components/icon_button'; +import RelativeTimestamp from 'soapbox/components/relative_timestamp'; +import { isRtl } from 'soapbox/rtl'; + +const messages = defineMessages({ + cancel: { id: 'reply_indicator.cancel', defaultMessage: 'Cancel' }, +}); + +export default @injectIntl +class QuotedStatus extends ImmutablePureComponent { + + static contextTypes = { + router: PropTypes.object, + }; + + static propTypes = { + status: ImmutablePropTypes.map, + onCancel: PropTypes.func, + intl: PropTypes.object.isRequired, + compose: PropTypes.bool, + }; + + handleExpandClick = e => { + const { compose, status } = this.props; + + if (!compose && e.button === 0) { + if (!this.context.router) { + return; + } + + this.context.router.history.push(`/@${status.getIn(['account', 'acct'])}/posts/${status.get('id')}`); + + e.preventDefault(); + } + } + + handleClose = e => { + this.props.onCancel(); + + e.preventDefault(); + } + + renderReplyMentions = () => { + const { status } = this.props; + + if (!status.get('in_reply_to_id')) { + return null; + } + + const to = status.get('mentions', []); + + if (to.size === 0) { + if (status.get('in_reply_to_account_id') === status.getIn(['account', 'id'])) { + return ( +
+ +
+ ); + } else { + return ( +
+ +
+ ); + } + } + + return ( +
+ `@${account.get('username')} `), + more: to.size > 2 && , + }} + /> +
+ ); + } + + render() { + const { status, onCancel, intl, compose } = this.props; + + if (!status) { + return null; + } + + const content = { __html: status.get('contentHtml') }; + const style = { + direction: isRtl(status.get('search_index')) ? 'rtl' : 'ltr', + }; + + const displayName = (<> +
+ + ); + + const quotedStatus = ( +
+
+ {onCancel + ? ( +
+ +
+ ) : ( +
+ +
+ )} + {compose ? ( +
+ {displayName} +
+ ) : ( + + {displayName} + + )} +
+ + {this.renderReplyMentions()} + +
+ + {status.get('media_attachments').size > 0 && ( + + )} +
+ ); + + if (compose) { + return ( +
+ {quotedStatus} +
+ ); + } + + return quotedStatus; + } + +} diff --git a/app/soapbox/features/status/containers/quoted_status_container.js b/app/soapbox/features/status/containers/quoted_status_container.js new file mode 100644 index 000000000..a375b2562 --- /dev/null +++ b/app/soapbox/features/status/containers/quoted_status_container.js @@ -0,0 +1,17 @@ +import { connect } from 'react-redux'; + +import { makeGetStatus } from 'soapbox/selectors'; + +import QuotedStatus from '../components/quoted_status'; + +const makeMapStateToProps = () => { + const getStatus = makeGetStatus(); + + const mapStateToProps = (state, { statusId }) => ({ + status: getStatus(state, { id: statusId }), + }); + + return mapStateToProps; +}; + +export default connect(makeMapStateToProps)(QuotedStatus); diff --git a/app/soapbox/features/status/index.js b/app/soapbox/features/status/index.js index e7839213a..eb6c670c7 100644 --- a/app/soapbox/features/status/index.js +++ b/app/soapbox/features/status/index.js @@ -28,6 +28,7 @@ import { replyCompose, mentionCompose, directCompose, + quoteCompose, } from '../../actions/compose'; import { simpleEmojiReact } from '../../actions/emoji_reacts'; import { @@ -258,6 +259,19 @@ class Status extends ImmutablePureComponent { }); } + handleQuoteClick = (status, e) => { + const { askReplyConfirmation, dispatch, intl } = this.props; + if (askReplyConfirmation) { + dispatch(openModal('CONFIRM', { + message: intl.formatMessage(messages.replyMessage), + confirm: intl.formatMessage(messages.replyConfirm), + onConfirm: () => dispatch(quoteCompose(status, this.context.router.history)), + })); + } else { + dispatch(quoteCompose(status, this.context.router.history)); + } + } + handleDeleteClick = (status, history, withRedraft = false) => { const { dispatch, intl } = this.props; @@ -681,6 +695,7 @@ class Status extends ImmutablePureComponent { onFavourite={this.handleFavouriteClick} onEmojiReact={this.handleEmojiReactClick} onReblog={this.handleReblogClick} + onQuote={this.handleQuoteClick} onDelete={this.handleDeleteClick} onDirect={this.handleDirectClick} onChat={this.handleChatClick} diff --git a/app/soapbox/features/ui/components/compose_modal.js b/app/soapbox/features/ui/components/compose_modal.js index 5503735cb..6c76ee57f 100644 --- a/app/soapbox/features/ui/components/compose_modal.js +++ b/app/soapbox/features/ui/components/compose_modal.js @@ -23,6 +23,7 @@ const mapStateToProps = state => { composeText: state.getIn(['compose', 'text']), privacy: state.getIn(['compose', 'privacy']), inReplyTo: state.getIn(['compose', 'in_reply_to']), + quote: state.getIn(['compose', 'quote']), }; }; @@ -35,6 +36,7 @@ class ComposeModal extends ImmutablePureComponent { composeText: PropTypes.string, privacy: PropTypes.string, inReplyTo: PropTypes.string, + quote: PropTypes.string, dispatch: PropTypes.func.isRequired, }; @@ -56,12 +58,14 @@ class ComposeModal extends ImmutablePureComponent { }; renderTitle = () => { - const { privacy, inReplyTo } = this.props; + const { privacy, inReplyTo, quote } = this.props; if (privacy === 'direct') { return ; } else if (inReplyTo) { return ; + } else if (quote) { + return ; } else { return ; } diff --git a/app/soapbox/features/ui/util/async-components.js b/app/soapbox/features/ui/util/async-components.js index 7111a43c5..341c59047 100644 --- a/app/soapbox/features/ui/util/async-components.js +++ b/app/soapbox/features/ui/util/async-components.js @@ -343,7 +343,7 @@ export function ProfileMediaPanel() { } export function PinnedAccountsPanel() { - return import(/* webpackChunkName: "features/pinned_accounts]" */'../components/pinned_accounts_panel'); + return import(/* webpackChunkName: "features/pinned_accounts" */'../components/pinned_accounts_panel'); } export function InstanceInfoPanel() { diff --git a/app/soapbox/locales/de.json b/app/soapbox/locales/de.json index 3f4a494b6..866cfcd22 100644 --- a/app/soapbox/locales/de.json +++ b/app/soapbox/locales/de.json @@ -116,7 +116,7 @@ "alert.unexpected.help_text": "Falls das Problem weiterhin besteht, benachrichtige einen Adminstrator mit einem Screenshot des Fehlers und dem verwendeten Browser. {clear_cookies} kann ebenfalls helfen. Dadurch wirst du automatisch abgemeldet.", "alert.unexpected.message": "Ein unerwarteter Fehler ist aufgetreten.", "alert.unexpected.return_home": "Zurück zur Startseite", - "alert.unexpected.title": "Oops!", + "alert.unexpected.title": "Hinweis:", "aliases.account.add": "Alias erstellen", "aliases.account_label": "Alter Account:", "aliases.aliases_list_delete": "Link zum Alias entfernen", @@ -257,8 +257,8 @@ "compose_form.poll.duration": "Umfragedauer", "compose_form.poll.option_placeholder": "Antwortmöglichkeit {number}", "compose_form.poll.remove_option": "Antwortmöglichkeit entfernen", - "compose_form.poll.switch_to_multiple": "Change poll to allow multiple choices", - "compose_form.poll.switch_to_single": "Change poll to allow for a single choice", + "compose_form.poll.switch_to_multiple": "Mehrere Antworten erlauben", + "compose_form.poll.switch_to_single": "Nur eine Antwort erlauben", "compose_form.publish": "Senden", "compose_form.publish_loud": "{publish}", "compose_form.schedule": "Beitrag bestätigen", @@ -306,7 +306,7 @@ "confirmations.unfollow.message": "Bist du dir sicher, dass du {name} entfolgen möchtest?", "crypto_donate.explanation_box.message": "{siteTitle} akzeptiert Kryptowährungen. Du kannst an eine der angegebenen Adressen eine Spende senden. Danke für deine Unterstützung!", "crypto_donate.explanation_box.title": "Spenden mit Kryptowährungen", - "crypto_donate_panel.actions.more": "{count} {count, plural, eine weitere {wallet} weitere {wallets}} anzeigen", + "crypto_donate_panel.actions.more": "{count} weitere {count, plural, one {Wallet} other {Wallets}} anzeigen", "crypto_donate_panel.heading": "Kryptowährungen spenden", "crypto_donate_panel.intro.message": "{siteTitle} akzeptiert Kryptowährungen, um dieses Angebot zu finanzieren. Danke für deine Unterstützung!", "datepicker.hint": "Beitrag veröffentlichen am…", @@ -348,7 +348,7 @@ "edit_profile.hints.bot": "This account mainly performs automated actions and might not be monitored", "edit_profile.hints.discoverable": "Display account in profile directory and allow indexing by external services", "edit_profile.hints.header": "Erlaubte Formate sind PNG, GIF oder JPG. Die Datei darf nicht größer als 2 MB sein. Das Bild wird automatisch auf 1500x500px verkleinert.", - "edit_profile.hints.hide_network": "Dein Follower und wem du folgst wird nicht in deinem Profil angezeit.", + "edit_profile.hints.hide_network": "Deine Follower und wem du folgst wird nicht in deinem Profil angezeit.", "edit_profile.hints.locked": "Follower müssen einzeln bestätigt werden.", "edit_profile.hints.meta_fields": "You can have up to {count, plural, one {# item} other {# items}} displayed as a table on your profile", "edit_profile.hints.stranger_notifications": "Nur Benachrichtigungen von Nutzern anzeigen, denen du folgst.", @@ -443,8 +443,8 @@ "follow_request.authorize": "Bestätigen", "follow_request.reject": "Ablehnen", "forms.copy": "Kopieren", - "forms.hide_password": "Hide password", - "forms.show_password": "Show password", + "forms.hide_password": "Passwort nicht anzeigen", + "forms.show_password": "Passwort anzeigen", "getting_started.open_source_notice": "{code_name} ist quelloffene Software. Du kannst auf GitLab unter {code_link} (v{code_version}) mitarbeiten oder Probleme melden.", "group.detail.archived_group": "Archived group", "group.members.empty": "Diese Gruppe hat noch keine Mitglieder.", @@ -487,7 +487,7 @@ "home_column.lists": "Listen", "home_column_header.all": "Alle", "home_column_header.fediverse": "Fediverse", - "home_column_header.home": "Startseite", + "home_column_header.home": "Start", "icon_button.icons": "Icons", "icon_button.label": "Icons auswählen", "icon_button.not_found": "Keine Icons!! (╯°□°)╯︵ ┻━┻", @@ -515,7 +515,7 @@ "introduction.interactions.favourite.text": "You can save a post for later, and let the author know that you liked it, by favoriting it.", "introduction.interactions.reblog.headline": "Teilen", "introduction.interactions.reblog.text": "You can share other people's posts with your followers by reposting them.", - "introduction.interactions.reply.headline": "Reply", + "introduction.interactions.reply.headline": "Antworten", "introduction.interactions.reply.text": "You can reply to other people's and your own posts, which will chain them together in a conversation.", "introduction.welcome.action": "Let's go!", "introduction.welcome.headline": "First steps", @@ -606,7 +606,7 @@ "navigation.developers": "Developers", "navigation.direct_messages": "Nachrichten", "navigation.home": "Start", - "navigation.invites": "Invites", + "navigation.invites": "Einladungen", "navigation.notifications": "Benachrichtigungen", "navigation.search": "Suche", "navigation_bar.account_aliases": "Account aliases", @@ -615,7 +615,7 @@ "navigation_bar.bookmarks": "Lesezeichen", "navigation_bar.compose": "Neuen Beitrag verfassen", "navigation_bar.compose_direct": "Direktnachrichten", - "navigation_bar.compose_reply": "Reply to post", + "navigation_bar.compose_reply": "Auf Beitrag antworten", "navigation_bar.domain_blocks": "Versteckte Domains", "navigation_bar.export_data": "Daten exportieren", "navigation_bar.favourites": "Favoriten", @@ -624,7 +624,7 @@ "navigation_bar.import_data": "Daten importieren", "navigation_bar.in_reply_to": "Antwort auf", "navigation_bar.info": "Über diesen Server", - "navigation_bar.invites": "Invites", + "navigation_bar.invites": "Einladungen", "navigation_bar.keyboard_shortcuts": "Tastenkombinationen", "navigation_bar.lists": "Listen", "navigation_bar.logout": "Abmelden", @@ -783,9 +783,9 @@ "reply_indicator.cancel": "Abbrechen", "reply_mentions.account.add": "Add to mentions", "reply_mentions.account.remove": "Remove from mentions", - "reply_mentions.more": "and {count} more", - "reply_mentions.reply": "Replying to {accounts}{more}", - "reply_mentions.reply_empty": "Replying to post", + "reply_mentions.more": "und {count, plural, one {einen weiteren Nutzer} other {# weitere Nutzer}}.", + "reply_mentions.reply": "Antwort an {accounts}{more}", + "reply_mentions.reply_empty": "Antwort auf einen Beitrag", "report.block": "{target} blockieren.", "report.block_hint": "Soll dieses Konto zusammen mit der Meldung auch gleich blockiert werden?", "report.forward": "An {target} weiterleiten", @@ -935,7 +935,7 @@ "tabs_bar.dashboard": "Steuerung", "tabs_bar.fediverse": "Fediverse", "tabs_bar.header": "Kontoinformtion", - "tabs_bar.home": "Startseite", + "tabs_bar.home": "Start", "tabs_bar.news": "News", "tabs_bar.notifications": "Benachrichtigungen", "tabs_bar.post": "Neuer Beitrag", @@ -973,3 +973,4 @@ "video.unmute": "Ton einschalten", "who_to_follow.title": "Vorschläge" } + diff --git a/app/soapbox/locales/pl.json b/app/soapbox/locales/pl.json index 431520dcd..e3ebca24d 100644 --- a/app/soapbox/locales/pl.json +++ b/app/soapbox/locales/pl.json @@ -177,7 +177,7 @@ "column.app_create": "Utwórz aplikację", "column.backups": "Kopie zapasowe", "column.blocks": "Zablokowani użytkownicy", - "column.bookmarks": "Załadki", + "column.bookmarks": "Zakładki", "column.chats": "Rozmowy", "column.community": "Lokalna oś czasu", "column.crypto_donate": "Przekaż kryptowalutę", @@ -329,7 +329,7 @@ "edit_federation.save": "Zapisz", "edit_federation.success": "Zaktualizowano federację {host}", "edit_federation.unlisted": "Wymuś oznaczanie wpisów jako niewypisane", - "edit_profile.error": "Akktualizacja profilu nie powiodła się", + "edit_profile.error": "Aktualizacja profilu nie powiodła się", "edit_profile.fields.accepts_email_list_label": "Zasubskrybuj newsletter", "edit_profile.fields.avatar_label": "Awatar", "edit_profile.fields.bio_label": "Opis", diff --git a/app/soapbox/reducers/__tests__/statuses-test.js b/app/soapbox/reducers/__tests__/statuses-test.js index 37a47256d..255d3d0a7 100644 --- a/app/soapbox/reducers/__tests__/statuses-test.js +++ b/app/soapbox/reducers/__tests__/statuses-test.js @@ -1,6 +1,7 @@ import { Map as ImmutableMap, fromJS } from 'immutable'; import { STATUS_IMPORT } from 'soapbox/actions/importer'; +import { normalizeStatus } from 'soapbox/actions/importer/normalizer'; import { STATUS_CREATE_REQUEST, STATUS_CREATE_FAIL, @@ -27,6 +28,17 @@ describe('statuses reducer', () => { expect(result).toEqual(expected); }); + + it('preserves the quote', () => { + const quotePost = require('soapbox/__fixtures__/pleroma-quote-post.json'); + const quotedQuotePost = require('soapbox/__fixtures__/pleroma-quote-of-quote-post.json'); + + let state = undefined; + state = reducer(state, { type: STATUS_IMPORT, status: normalizeStatus(quotePost) }); + state = reducer(state, { type: STATUS_IMPORT, status: normalizeStatus(quotedQuotePost.pleroma.quote) }); + + expect(state.getIn(['AFmFMSpITT9xcOJKcK', 'quote'])).toEqual('AFmFLcd6XYVdjWCrOS'); + }); }); describe('STATUS_CREATE_REQUEST', () => { diff --git a/app/soapbox/reducers/compose.js b/app/soapbox/reducers/compose.js index b11a62020..c0ee4af0b 100644 --- a/app/soapbox/reducers/compose.js +++ b/app/soapbox/reducers/compose.js @@ -8,6 +8,8 @@ import { COMPOSE_CHANGE, COMPOSE_REPLY, COMPOSE_REPLY_CANCEL, + COMPOSE_QUOTE, + COMPOSE_QUOTE_CANCEL, COMPOSE_DIRECT, COMPOSE_MENTION, COMPOSE_SUBMIT_REQUEST, @@ -65,6 +67,7 @@ const initialState = ImmutableMap({ focusDate: null, caretPosition: null, in_reply_to: null, + quote: null, is_composing: false, is_submitting: false, is_changing_upload: false, @@ -128,6 +131,7 @@ function clearAll(state) { map.set('is_submitting', false); map.set('is_changing_upload', false); map.set('in_reply_to', null); + map.set('quote', null); map.set('privacy', state.get('default_privacy')); map.set('sensitive', false); map.set('media_attachments', ImmutableList()); @@ -340,11 +344,25 @@ export default function compose(state = initialState, action) { map.set('spoiler_text', ''); } }); + case COMPOSE_QUOTE: + return state.withMutations(map => { + map.set('quote', action.status.get('id')); + map.set('to', undefined); + map.set('text', ''); + map.set('privacy', privacyPreference(action.status.get('visibility'), state.get('default_privacy'))); + map.set('focusDate', new Date()); + map.set('caretPosition', null); + map.set('idempotencyKey', uuid()); + map.set('content_type', state.get('default_content_type')); + map.set('spoiler', false); + map.set('spoiler_text', ''); + }); case COMPOSE_SUBMIT_REQUEST: return state.set('is_submitting', true); case COMPOSE_UPLOAD_CHANGE_REQUEST: return state.set('is_changing_upload', true); case COMPOSE_REPLY_CANCEL: + case COMPOSE_QUOTE_CANCEL: case COMPOSE_RESET: case COMPOSE_SUBMIT_SUCCESS: return clearAll(state); @@ -390,6 +408,8 @@ export default function compose(state = initialState, action) { case TIMELINE_DELETE: if (action.id === state.get('in_reply_to')) { return state.set('in_reply_to', null); + } if (action.id === state.get('quote')) { + return state.set('quote', null); } else { return state; } diff --git a/app/soapbox/reducers/search.js b/app/soapbox/reducers/search.js index 1d3b52432..86e4222a5 100644 --- a/app/soapbox/reducers/search.js +++ b/app/soapbox/reducers/search.js @@ -4,6 +4,7 @@ import { COMPOSE_MENTION, COMPOSE_REPLY, COMPOSE_DIRECT, + COMPOSE_QUOTE, } from '../actions/compose'; import { SEARCH_CHANGE, @@ -78,6 +79,7 @@ export default function search(state = initialState, action) { case COMPOSE_REPLY: case COMPOSE_MENTION: case COMPOSE_DIRECT: + case COMPOSE_QUOTE: return state.set('hidden', true); case SEARCH_FETCH_REQUEST: return handleSubmitted(state, action.value); diff --git a/app/soapbox/reducers/statuses.js b/app/soapbox/reducers/statuses.js index 144eb8eef..9c1f61109 100644 --- a/app/soapbox/reducers/statuses.js +++ b/app/soapbox/reducers/statuses.js @@ -43,13 +43,29 @@ const fixMentions = status => { return status.set('mentions', sorted); }; -const fixStatus = status => { +const isQuote = status => { + return Boolean(status.get('quote_id') || status.getIn(['pleroma', 'quote_url'])); +}; + +// Preserve quote if an existing status already has it +const fixQuote = (state, status) => { + const oldStatus = state.get(status.get('id')); + + if (oldStatus && !status.get('quote') && isQuote(status)) { + return status.set('quote', oldStatus.get('quote')); + } else { + return status; + } +}; + +const fixStatus = (state, status) => { return status.withMutations(status => { fixMentions(status); + fixQuote(state, status); }); }; -const importStatus = (state, status) => state.set(status.id, fixStatus(fromJS(status))); +const importStatus = (state, status) => state.set(status.id, fixStatus(state, fromJS(status))); const importStatuses = (state, statuses) => state.withMutations(mutable => statuses.forEach(status => importStatus(mutable, status))); diff --git a/app/soapbox/utils/features.js b/app/soapbox/utils/features.js index 1db43493f..1ce877a86 100644 --- a/app/soapbox/utils/features.js +++ b/app/soapbox/utils/features.js @@ -78,6 +78,7 @@ export const getFeatures = createSelector([ remoteInteractionsAPI: v.software === PLEROMA && gte(v.version, '2.4.50'), explicitAddressing: v.software === PLEROMA && gte(v.version, '1.0.0'), accountEndorsements: v.software === PLEROMA && gte(v.version, '2.4.50'), + quotePosts: v.software === PLEROMA && gte(v.version, '2.4.50'), birthDates: v.software === PLEROMA && gte(v.version, '2.4.50'), }; }); diff --git a/app/styles/components/compose-form.scss b/app/styles/components/compose-form.scss index 8c583edff..4c1537f4f 100644 --- a/app/styles/components/compose-form.scss +++ b/app/styles/components/compose-form.scss @@ -84,13 +84,27 @@ .spoiler-input__input { border-radius: 4px; } + &__quoted-status-wrapper { + background: var(--background-color); + + .quoted-status { + &:hover, + &:focus, + &:active { + background: transparent; + cursor: unset; + } + } + } + &.condensed { .autosuggest-textarea__textarea { min-height: 46px; border-radius: 5px; } - .compose-form__buttons-wrapper { + .compose-form__buttons-wrapper, + .compose-form__quoted-status-wrapper { height: 0; padding: 0; overflow: hidden; diff --git a/app/styles/components/dropdown-menu.scss b/app/styles/components/dropdown-menu.scss index 66d5832c5..5c705db81 100644 --- a/app/styles/components/dropdown-menu.scss +++ b/app/styles/components/dropdown-menu.scss @@ -62,7 +62,7 @@ box-sizing: border-box; overflow: hidden; margin: 0 6px; - padding: 4px 4px; + padding: 4px; border-radius: 6px; font-size: 15px; text-decoration: none; diff --git a/app/styles/components/reply-mentions.scss b/app/styles/components/reply-mentions.scss index 9eebb19d0..cd693803e 100644 --- a/app/styles/components/reply-mentions.scss +++ b/app/styles/components/reply-mentions.scss @@ -16,7 +16,8 @@ } .status__wrapper, -.detailed-status { +.detailed-status, +.quoted-status { .reply-mentions { display: block; margin: 4px 0 0 0; diff --git a/app/styles/components/status.scss b/app/styles/components/status.scss index c8fd1e55b..8c68f2bd6 100644 --- a/app/styles/components/status.scss +++ b/app/styles/components/status.scss @@ -338,6 +338,16 @@ font-weight: 500; color: var(--brand-color); } + + &--reblog { + > div { + display: flex; + + > .icon-button { + margin-right: 8px; + } + } + } } } @@ -588,6 +598,11 @@ a.status-card { .status-card__description { color: var(--primary-text-color--faint); + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 5; + -webkit-box-orient: vertical; } .status-card__host { @@ -746,3 +761,71 @@ a.status-card.compact:hover { .pending-status { opacity: 0.5; } + +.quoted-status { + margin-top: 14px; + border: 1px solid var(--brand-color--med); + border-radius: 10px; + padding: 12px; + transition: background 0.2s; + cursor: pointer; + + &:hover, + &:focus, + &:active { + background: var(--brand-color--faint); + } + + &__relative-time { + padding-top: 4px; + } + + &__display-name { + color: var(--primary-text-color); + display: block; + max-width: 100%; + line-height: 24px; + overflow: hidden; + padding-right: 25px; + text-decoration: none; + + .display-name__account { + color: var(--primary-text-color--faint); + } + } + + &__display-avatar { + float: left; + margin-right: 5px; + } + + .reply-mentions { + font-size: 14px; + } + + &__content { + margin-top: 5px; + font-size: 14px; + + a { + color: var(--highlight-text-color); + text-decoration: none; + + &:hover { + text-decoration: underline; + } + } + } + + .attachment-thumbs .media-gallery { + margin-top: 5px !important; + } +} + +/* Fedibird quote post compatibility */ +.status__content, +.quoted-status__content { + .quote-inline { + display: none; + } +} diff --git a/app/styles/ui.scss b/app/styles/ui.scss index a594752e5..de2ce5e3b 100644 --- a/app/styles/ui.scss +++ b/app/styles/ui.scss @@ -221,7 +221,8 @@ } .status__relative-time, -.notification__relative_time { +.notification__relative_time, +.quoted-status__relative-time { color: var(--primary-text-color--faint); float: right; font-size: 14px;