From c5646cf87375ed2371cc953ce730218e08421366 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 14 Apr 2022 14:46:07 -0500 Subject: [PATCH] Add a TestTimeline for previewing certain types of posts --- ...tatus-vertical-video-without-metadata.json | 108 ++++++++++++++++++ .../features/developers/developers_menu.js | Bin 3028 -> 3465 bytes app/soapbox/features/test_timeline/index.tsx | 53 +++++++++ app/soapbox/features/ui/index.js | Bin 28599 -> 28745 bytes .../features/ui/util/async-components.js | Bin 15466 -> 15590 bytes 5 files changed, 161 insertions(+) create mode 100644 app/soapbox/__fixtures__/pleroma-status-vertical-video-without-metadata.json create mode 100644 app/soapbox/features/test_timeline/index.tsx diff --git a/app/soapbox/__fixtures__/pleroma-status-vertical-video-without-metadata.json b/app/soapbox/__fixtures__/pleroma-status-vertical-video-without-metadata.json new file mode 100644 index 0000000000..edb24b9ef0 --- /dev/null +++ b/app/soapbox/__fixtures__/pleroma-status-vertical-video-without-metadata.json @@ -0,0 +1,108 @@ +{ + "account": { + "acct": "alex", + "avatar": "https://freespeechextremist.com/images/avi.png", + "avatar_static": "https://freespeechextremist.com/images/avi.png", + "bot": false, + "created_at": "2022-02-28T01:55:05.000Z", + "display_name": "Alex Gleason", + "emojis": [], + "fields": [], + "followers_count": 1, + "following_count": 0, + "header": "https://freespeechextremist.com/images/banner.png", + "header_static": "https://freespeechextremist.com/images/banner.png", + "id": "AGv8wCadU7DqWgMqNk", + "locked": false, + "note": "I'm testing out compatibility with an older Pleroma version", + "pleroma": { + "accepts_chat_messages": true, + "ap_id": "https://freespeechextremist.com/users/alex", + "background_image": null, + "confirmation_pending": false, + "favicon": null, + "hide_favorites": true, + "hide_followers": false, + "hide_followers_count": false, + "hide_follows": false, + "hide_follows_count": false, + "is_admin": false, + "is_moderator": false, + "relationship": {}, + "skip_thread_containment": false, + "tags": [] + }, + "source": { + "fields": [], + "note": "I'm testing out compatibility with an older Pleroma version", + "pleroma": { + "actor_type": "Person", + "discoverable": true + }, + "sensitive": false + }, + "statuses_count": 1, + "url": "https://freespeechextremist.com/users/alex", + "username": "alex" + }, + "application": { + "name": "Web", + "website": null + }, + "bookmarked": false, + "card": null, + "content": "
0f66e92f339705ccc03079b8f647048e15730adf2cc9eaa1071c7c7cf6884b1b.webm", + "created_at": "2022-04-14T19:42:48.000Z", + "emojis": [], + "favourited": false, + "favourites_count": 0, + "id": "AIRxLeIzncpCtsr2hs", + "in_reply_to_account_id": null, + "in_reply_to_id": null, + "language": null, + "media_attachments": [ + { + "description": "0f66e92f339705ccc03079b8f647048e15730adf2cc9eaa1071c7c7cf6884b1b.webm", + "id": "1142674091", + "pleroma": { + "mime_type": "video/webm" + }, + "preview_url": "https://freespeechextremist.com/media/3e34b808-1c84-4ef3-ba56-67cc86b7911a/0f66e92f339705ccc03079b8f647048e15730adf2cc9eaa1071c7c7cf6884b1b.webm?name=0f66e92f339705ccc03079b8f647048e15730adf2cc9eaa1071c7c7cf6884b1b.webm", + "remote_url": "https://freespeechextremist.com/media/3e34b808-1c84-4ef3-ba56-67cc86b7911a/0f66e92f339705ccc03079b8f647048e15730adf2cc9eaa1071c7c7cf6884b1b.webm?name=0f66e92f339705ccc03079b8f647048e15730adf2cc9eaa1071c7c7cf6884b1b.webm", + "text_url": "https://freespeechextremist.com/media/3e34b808-1c84-4ef3-ba56-67cc86b7911a/0f66e92f339705ccc03079b8f647048e15730adf2cc9eaa1071c7c7cf6884b1b.webm?name=0f66e92f339705ccc03079b8f647048e15730adf2cc9eaa1071c7c7cf6884b1b.webm", + "type": "video", + "url": "https://freespeechextremist.com/media/3e34b808-1c84-4ef3-ba56-67cc86b7911a/0f66e92f339705ccc03079b8f647048e15730adf2cc9eaa1071c7c7cf6884b1b.webm?name=0f66e92f339705ccc03079b8f647048e15730adf2cc9eaa1071c7c7cf6884b1b.webm" + } + ], + "mentions": [], + "muted": false, + "pinned": false, + "pleroma": { + "content": { + "text/plain": "0f66e92f339705ccc03079b8f647048e15730adf2cc9eaa1071c7c7cf6884b1b.webm" + }, + "conversation_id": 97191096, + "direct_conversation_id": null, + "emoji_reactions": [], + "expires_at": null, + "in_reply_to_account_acct": null, + "local": true, + "parent_visible": false, + "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://freespeechextremist.com/objects/419b2cad-656a-4dbc-b2b5-94bb75e0afc8", + "url": "https://freespeechextremist.com/notice/AIRxLeIzncpCtsr2hs", + "visibility": "public" +} diff --git a/app/soapbox/features/developers/developers_menu.js b/app/soapbox/features/developers/developers_menu.js index 832c0bd609bfa4bf2aae877464a922448aa38609..f4ab7f8ca7fc9957d445a55240b8e2e46c79a208 100644 GIT binary patch delta 93 zcmca2-YLC7ies`D8#hNuW^QUuW?t%Kd5-OznaTNi#rkQfsgpl)lp2<#7MH}s|)kA=a6rhSW-(&yA3;;W&BSQcH delta 12 TcmeB_z9POsievM6&Rxs^A8Q1v diff --git a/app/soapbox/features/test_timeline/index.tsx b/app/soapbox/features/test_timeline/index.tsx new file mode 100644 index 0000000000..ace235b8f2 --- /dev/null +++ b/app/soapbox/features/test_timeline/index.tsx @@ -0,0 +1,53 @@ +import React from 'react'; +import { defineMessages, useIntl, FormattedMessage } from 'react-intl'; +import { useDispatch } from 'react-redux'; + +import { importFetchedStatuses } from 'soapbox/actions/importer'; +import { expandTimelineSuccess } from 'soapbox/actions/timelines'; +import SubNavigation from 'soapbox/components/sub_navigation'; + +import { Column } from '../../components/ui'; +import StatusListContainer from '../ui/containers/status_list_container'; + +const messages = defineMessages({ + title: { id: 'column.test', defaultMessage: 'Test timeline' }, +}); + +/** + * List of mock statuses to display in the timeline. + * These get embedded into the build, but only in this chunk, so it's okay. + */ +const MOCK_STATUSES: any[] = [ + require('soapbox/__fixtures__/pleroma-status-with-poll.json'), + require('soapbox/__fixtures__/pleroma-status-vertical-video-without-metadata.json'), + require('soapbox/__fixtures__/pleroma-status-with-poll-with-emojis.json'), + require('soapbox/__fixtures__/pleroma-quote-of-quote-post.json'), + require('soapbox/__fixtures__/truthsocial-status-with-external-video.json'), +]; + +const timelineId = 'test'; +const onlyMedia = false; + +const TestTimeline: React.FC = () => { + const intl = useIntl(); + const dispatch = useDispatch(); + + React.useEffect(() => { + dispatch(importFetchedStatuses(MOCK_STATUSES)); + dispatch(expandTimelineSuccess(timelineId, MOCK_STATUSES, null, false, false, false)); + }, []); + + return ( + + + } + divideType='space' + /> + + ); +}; + +export default TestTimeline; diff --git a/app/soapbox/features/ui/index.js b/app/soapbox/features/ui/index.js index bc50ca1145de2b897b8efb1ab2f9a01920a31244..6fdae02b8708a60f311ddaa0ed6ed3b889d1d274 100644 GIT binary patch delta 57 zcmdmfpYh}a#tm+Kyb1~-sl_EBnYpPsnR%O?`P7X$^h+ST$?qNXnL<)03ur1%PEeHF JoZuL)2LNiG6fgh) delta 19 bcmX^4fN}eM#tm+Ko5T22j5q&r^wk3ZS`Kn?Ai_PQ)n=}9=Uj=6X