From dd0f2fcf5b2d1bd471d7577be5e632923d8dfb9a Mon Sep 17 00:00:00 2001 From: Justin Date: Thu, 18 Aug 2022 14:23:34 -0400 Subject: [PATCH 1/4] Support 'in review' sensitive content --- app/soapbox/__fixtures__/pleroma-status.json | 183 ++++++++++++++++++ .../truthsocial-status-in-moderation.json | 85 ++++++++ app/soapbox/components/media_gallery.js | Bin 21642 -> 22253 bytes app/soapbox/components/status-media.tsx | 1 + .../components/ui/button/useButtonStyles.ts | 3 +- app/soapbox/features/test_timeline/index.tsx | 2 + app/soapbox/normalizers/status.ts | 2 +- app/soapbox/utils/status.ts | 4 +- 8 files changed, 277 insertions(+), 3 deletions(-) create mode 100644 app/soapbox/__fixtures__/pleroma-status.json create mode 100644 app/soapbox/__fixtures__/truthsocial-status-in-moderation.json diff --git a/app/soapbox/__fixtures__/pleroma-status.json b/app/soapbox/__fixtures__/pleroma-status.json new file mode 100644 index 0000000000..69f84afabd --- /dev/null +++ b/app/soapbox/__fixtures__/pleroma-status.json @@ -0,0 +1,183 @@ +{ + "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": 2465, + "following_count": 1581, + "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-10T18:19:50", + "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, + "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": 23648, + "url": "https://gleasonator.com/users/alex", + "username": "alex" + }, + "application": null, + "bookmarked": false, + "card": null, + "content": "

Good morning! Hope you have a wonderful day.

", + "created_at": "2020-03-23T19:33:06.000Z", + "emojis": [], + "favourited": false, + "favourites_count": 49, + "id": "103874034845713213", + "in_reply_to_account_id": null, + "in_reply_to_id": null, + "language": null, + "media_attachments": [], + "mentions": [], + "muted": false, + "pinned": true, + "pleroma": { + "content": { + "text/plain": "What is tolerance?" + }, + "conversation_id": "3023268", + "direct_conversation_id": null, + "emoji_reactions": [ + { + "count": 3, + "me": false, + "name": "❤️" + } + ], + "expires_at": null, + "in_reply_to_account_acct": null, + "local": true, + "parent_visible": false, + "pinned_at": "2021-11-23T01:38:44.000Z", + "quote": null, + "quote_url": null, + "quote_visible": false, + "spoiler_text": { + "text/plain": "" + }, + "thread_muted": false + }, + "poll": null, + "reblog": null, + "reblogged": false, + "reblogs_count": 27, + "replies_count": 15, + "sensitive": false, + "spoiler_text": "", + "tags": [], + "text": null, + "uri": "https://gleasonator.com/users/alex/statuses/103874034847713213", + "url": "https://gleasonator.com/notice/103874034847713213", + "visibility": "public" +} diff --git a/app/soapbox/__fixtures__/truthsocial-status-in-moderation.json b/app/soapbox/__fixtures__/truthsocial-status-in-moderation.json new file mode 100644 index 0000000000..e9402876ff --- /dev/null +++ b/app/soapbox/__fixtures__/truthsocial-status-in-moderation.json @@ -0,0 +1,85 @@ +{ + "id": "108046224464672537", + "created_at": "2022-03-30T15:40:53.287Z", + "in_reply_to_id": null, + "in_reply_to_account_id": null, + "sensitive": false, + "spoiler_text": "", + "visibility": "self", + "language": null, + "uri": "https://truthsocial.com/users/alex/statuses/108046244464677537", + "url": "https://truthsocial.com/@alex/108046244464677537", + "replies_count": 0, + "reblogs_count": 0, + "favourites_count": 0, + "favourited": false, + "reblogged": false, + "muted": false, + "bookmarked": false, + "pinned": false, + "content": "

A federal agent inspects a 'lumber' truck after smelling alcohol during the prohibition period. Los Angeles, 1926 (during the Prohibition era).

", + "reblog": null, + "application": { + "name": "Soapbox FE", + "website": "https://soapbox.pub/" + }, + "account": { + "id": "107759994408336377", + "username": "alex", + "acct": "alex", + "display_name": "Alex Gleason", + "locked": false, + "bot": false, + "discoverable": null, + "group": false, + "created_at": "2022-02-08T00:00:00.000Z", + "note": "

Launching Truth Social

", + "url": "https://truthsocial.com/@alex", + "avatar": "https://static-assets.truthsocial.com/tmtg:prime-truth-social-assets/accounts/avatars/107/759/994/408/336/377/original/119cb0dd1fa615b7.png", + "avatar_static": "https://static-assets.truthsocial.com/tmtg:prime-truth-social-assets/accounts/avatars/107/759/994/408/336/377/original/119cb0dd1fa615b7.png", + "header": "https://static-assets.truthsocial.com/tmtg:prime-truth-social-assets/accounts/headers/107/759/994/408/336/377/original/31f62b0453ccf554.png", + "header_static": "https://static-assets.truthsocial.com/tmtg:prime-truth-social-assets/accounts/headers/107/759/994/408/336/377/original/31f62b0453ccf554.png", + "followers_count": 4713, + "following_count": 43, + "statuses_count": 7, + "last_status_at": "2022-03-30", + "verified": true, + "location": "Texas", + "website": "https://soapbox.pub/", + "emojis": [], + "fields": [] + }, + "media_attachments": [ + { + "id": "108635651287436632", + "type": "image", + "url": "https://static-assets-1.truthsocial.com/tmtg:prime-ts-assets/media_attachments/files/108/635/651/487/436/632/original/7873bda5a7ab45d3.jpeg", + "preview_url": "https://static-assets-1.truthsocial.com/tmtg:prime-ts-assets/media_attachments/files/108/635/651/487/436/632/small/7873bda5a7ab45d3.jpeg", + "external_video_id": null, + "remote_url": null, + "preview_remote_url": null, + "text_url": "https://truthsocial.com/media/_Kc-2w2Pe7knhYJV-CM", + "meta": { + "original": { + "width": 1080, + "height": 841, + "size": "1080x841", + "aspect": 1.2841854934601664 + }, + "small": { + "width": 907, + "height": 706, + "size": "907x706", + "aspect": 1.2847025495750708 + } + }, + "description": null, + "blurhash": "UIIY5?4n~q9FIUIUD%WB?bt7M{t7of%MofIU" + } + ], + "mentions": [], + "tags": [], + "emojis": [], + "card": null, + "poll": null +} diff --git a/app/soapbox/components/media_gallery.js b/app/soapbox/components/media_gallery.js index a49f4ab7524ebd0a981ce3ec202c850bf86b79be..defe361dcd937e1f722242f0564d71e36a9540a3 100644 GIT binary patch delta 728 zcmZXR&uSA<6vj!Ff^9=7r7^ZuPg>|Cb}mV!tzv1dxUy364{_sWCb^SbdvhnuoJks! z;$G0rc>r-KSXA-?b}epP>Cy)f#GT;6J0_zw4h+Mb`+etp=XamHjD0mWh=YQG$RwMfUA1^Tc%-`}`$a+yxKK=*emfNYj-?mJ5WZOc?JDF7;hw5;4+cGq{`39$7`<3XJ&vql z7SPFT-<1J!c*NFo#tlF(;O4OVP$HDik%fn;mhgowIjpQes^T`9Rs~1I;c9FR&~36c z?T8G$9t`v`Bnipool_&aX`d@!plEUE{aHKHH}g+pmrm&haj?_m+lCz=y2_wrVT)ET zOw!xpEFC1yo$=FMx>cHcVAxjWpz7%qwhTPxH^6fP4W!Cs4cg2Jq=fq5W4oRP#d6?C zeh312!)Fx@P{Vr|_$Zvt@He6p4p=no8moC$hh5L*ve!03IMMZ(q2OXDs9LI~TW>~^ zzY3jq`6%<>az`T-nk_EPAwR?@k*|?+)?w@Px_CE^b>7f0+I5}UpdZDZk;-Q2JIVYE veJh@g|I1A$oF2N}0HsjcuWQsUB&kpur+4{rx?fIdzB6M0v|CEhv+~bhFxKKs delta 483 zcmY+9ze^lJ6vx>>K!S=85`!n?RgMt{Pf`5EiP#xI410!vq?p~E^M;$9S!QOvyQo+S zqSgBcw6qX}ZPMDL38`aiD@y(W3uj|eSUlc)UwH5P`QBdyN9V!ibua$zr4<0E0b#k* zWbu_>Kyv4+;Q(-`Z>m`9yBNmtu?n`PD+L|9dLIDZuih3nAAi2Uok zhZidwCqX~BZpLfm-+x^CG&BjZWY(^;wA8n$Gfdfx8Lk|(X(N{snolj#Ch=@lyb52V z3I`4{It@nWD&Yz3NU%+o=yo|pEN&%6XEc(zp*98ox7`$uPt49h!c1$y3)_Zu>3p?X zYL0gtjlCr|Ae0n}`%@jaz>~zBcD+%`I = ({ Date: Mon, 22 Aug 2022 13:18:52 -0400 Subject: [PATCH 2/4] I18n --- app/soapbox/components/media_gallery.js | Bin 22253 -> 23310 bytes app/soapbox/locales/en.json | 4 ++++ 2 files changed, 4 insertions(+) diff --git a/app/soapbox/components/media_gallery.js b/app/soapbox/components/media_gallery.js index defe361dcd937e1f722242f0564d71e36a9540a3..90c2f2f5d72ee586b737b7501d78438dc4a75b0a 100644 GIT binary patch delta 813 zcmaiyF^>{K6vso(Q$bG5orq$T7n%hFi^*xD*-K6fBvKq-x4&j!LfODqjy0qn zi-!2Eol67EmK^gG?z*}4nFZEdzm?3F1;9MVl8UHE+NTrh>F7yMSw_1Humq@6Dan93 z)}y|eStk}SI@S^RIux@)phD=lMgb*~!Yp9ni@6 Date: Mon, 22 Aug 2022 13:23:37 -0400 Subject: [PATCH 3/4] Add custom support link --- app/soapbox/components/media_gallery.js | Bin 23310 -> 23700 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/app/soapbox/components/media_gallery.js b/app/soapbox/components/media_gallery.js index 90c2f2f5d72ee586b737b7501d78438dc4a75b0a..2b4a5b02ea66d0a5e3c02ecc50c2a50d8e3badfc 100644 GIT binary patch delta 427 zcmeC%#yDjsv*_CV8l!m4at(ZfQwkQch|>QGP*4WkG7OUT$K+<_6_Nb#@(y&dm?KzHv!{4bcO- zSVO(Iw4flrs6<^;K}}6TW3pqIB%{sbhan=9KZJ2iz7{GoSs|2V^0IKf$uePfV77FG zz~rnj4={UEmYOb!U=0W1C=DF$YL2-N}8 zGGVflzlN(p42rM^(`O>Y!E&dBcqhLO;R3T~L`Z|>Hb+Rp)c`GJve5^-AH>wG1$szy J^Wz9@CII9elWPC~ delta 158 zcmbQTld*3byyU7ue0+UO_JtiLvSDE}0hy^1QC%@+Bp6nQ5#+y-;nr5r6pOKoAldnG6 zFhq3nhA@uFUZFyhH$?JJz7t^xG(mQ Date: Mon, 22 Aug 2022 13:58:06 -0400 Subject: [PATCH 4/4] fix operator --- app/soapbox/components/media_gallery.js | Bin 23700 -> 23701 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/app/soapbox/components/media_gallery.js b/app/soapbox/components/media_gallery.js index 2b4a5b02ea66d0a5e3c02ecc50c2a50d8e3badfc..9d23c7f724f84ca2b7fd1f27d4efe2e91a509679 100644 GIT binary patch delta 14 VcmbQTlX2=!#tphbn{|RRxBxBZ1#kcW delta 14 VcmbQblX1#U#tphboArXyxd1Kj1#tiX