From 1023c2f90ba0ce1c3277220832a5a3007430cd53 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 15 Nov 2023 13:19:17 +0100 Subject: [PATCH 1/5] Fix more whitespace and comment discrepancies --- .../flavours/glitch/actions/notifications.js | 5 +---- app/javascript/flavours/glitch/components/hashtag.jsx | 4 ++-- app/javascript/flavours/glitch/components/status.jsx | 2 ++ .../account_gallery/components/media_item.jsx | 4 +--- .../features/compose/components/reply_indicator.jsx | 2 -- .../glitch/features/compose/components/search.jsx | 11 +++++------ .../features/compose/components/text_icon_button.jsx | 3 +-- .../features/compose/components/upload_progress.jsx | 2 +- .../glitch/features/emoji/emoji_compressed.js | 2 +- .../glitch/features/explore/components/story.jsx | 1 - .../flavours/glitch/features/explore/tags.jsx | 2 -- .../flavours/glitch/features/favourites/index.jsx | 1 - .../glitch/features/follow_requests/index.jsx | 1 - .../getting_started/components/announcements.jsx | 2 +- .../glitch/features/list_adder/components/list.jsx | 2 +- .../glitch/features/list_editor/components/search.jsx | 2 +- .../flavours/glitch/features/list_timeline/index.jsx | 2 +- .../notifications/components/clear_column_button.jsx | 2 +- .../features/notifications/components/filter_bar.jsx | 2 +- .../flavours/glitch/features/report/statuses.jsx | 1 - .../glitch/features/ui/components/compose_panel.jsx | 1 - .../glitch/features/ui/components/media_modal.jsx | 2 +- .../glitch/features/ui/components/sign_in_banner.jsx | 1 + .../glitch/features/ui/util/react_router_helpers.jsx | 2 +- 24 files changed, 23 insertions(+), 36 deletions(-) diff --git a/app/javascript/flavours/glitch/actions/notifications.js b/app/javascript/flavours/glitch/actions/notifications.js index e98b843863..72d55d7bd0 100644 --- a/app/javascript/flavours/glitch/actions/notifications.js +++ b/app/javascript/flavours/glitch/actions/notifications.js @@ -21,10 +21,7 @@ import { submitMarkers } from './markers'; import { register as registerPushNotifications } from './push_notifications'; import { saveSettings } from './settings'; - - - -export const NOTIFICATIONS_UPDATE = 'NOTIFICATIONS_UPDATE'; +export const NOTIFICATIONS_UPDATE = 'NOTIFICATIONS_UPDATE'; export const NOTIFICATIONS_UPDATE_NOOP = 'NOTIFICATIONS_UPDATE_NOOP'; // tracking the notif cleaning request diff --git a/app/javascript/flavours/glitch/components/hashtag.jsx b/app/javascript/flavours/glitch/components/hashtag.jsx index 9821cf1858..956834b47a 100644 --- a/app/javascript/flavours/glitch/components/hashtag.jsx +++ b/app/javascript/flavours/glitch/components/hashtag.jsx @@ -25,11 +25,11 @@ class SilentErrorBoundary extends Component { error: false, }; - componentDidCatch () { + componentDidCatch() { this.setState({ error: true }); } - render () { + render() { if (this.state.error) { return null; } diff --git a/app/javascript/flavours/glitch/components/status.jsx b/app/javascript/flavours/glitch/components/status.jsx index f71fd40f77..9339f3e4df 100644 --- a/app/javascript/flavours/glitch/components/status.jsx +++ b/app/javascript/flavours/glitch/components/status.jsx @@ -16,6 +16,8 @@ import { autoUnfoldCW } from 'flavours/glitch/utils/content_warning'; import { withOptionalRouter, WithOptionalRouterPropTypes } from 'flavours/glitch/utils/react_router'; import Card from '../features/status/components/card'; +// We use the component (and not the container) since we do not want +// to use the progress bar to show download progress import Bundle from '../features/ui/components/bundle'; import { MediaGallery, Video, Audio } from '../features/ui/util/async-components'; import { displayMedia } from '../initial_state'; diff --git a/app/javascript/flavours/glitch/features/account_gallery/components/media_item.jsx b/app/javascript/flavours/glitch/features/account_gallery/components/media_item.jsx index aa31468396..aaa872b0aa 100644 --- a/app/javascript/flavours/glitch/features/account_gallery/components/media_item.jsx +++ b/app/javascript/flavours/glitch/features/account_gallery/components/media_item.jsx @@ -6,11 +6,9 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { Blurhash } from 'flavours/glitch/components/blurhash'; -import { Icon } from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import { autoPlayGif, displayMedia, useBlurhash } from 'flavours/glitch/initial_state'; - - export default class MediaItem extends ImmutablePureComponent { static propTypes = { diff --git a/app/javascript/flavours/glitch/features/compose/components/reply_indicator.jsx b/app/javascript/flavours/glitch/features/compose/components/reply_indicator.jsx index 51da8f297d..941a789328 100644 --- a/app/javascript/flavours/glitch/features/compose/components/reply_indicator.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/reply_indicator.jsx @@ -28,7 +28,6 @@ class ReplyIndicator extends ImmutablePureComponent { } }; - // Rendering. render () { const { status, intl } = this.props; @@ -40,7 +39,6 @@ class ReplyIndicator extends ImmutablePureComponent { const content = status.get('content'); const attachments = status.get('media_attachments'); - // The result. return (
diff --git a/app/javascript/flavours/glitch/features/compose/components/search.jsx b/app/javascript/flavours/glitch/features/compose/components/search.jsx index 09627bb4fa..ed717f215b 100644 --- a/app/javascript/flavours/glitch/features/compose/components/search.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/search.jsx @@ -82,13 +82,9 @@ class Search extends PureComponent { }; handleClear = e => { - const { - onClear, - submitted, - value, - } = this.props; + const { value, submitted, onClear } = this.props; - e.preventDefault(); // Prevents focus change ?? + e.preventDefault(); if (value.length > 0 || submitted) { onClear(); @@ -160,6 +156,7 @@ class Search extends PureComponent { search.forget(e); } } + break; } }; @@ -342,6 +339,7 @@ class Search extends PureComponent { +
{options.length === 0 && ( <> @@ -361,6 +359,7 @@ class Search extends PureComponent {
)} + {options.length > 0 && ( <>

diff --git a/app/javascript/flavours/glitch/features/compose/components/text_icon_button.jsx b/app/javascript/flavours/glitch/features/compose/components/text_icon_button.jsx index 780e063b2e..9e5ec4237c 100644 --- a/app/javascript/flavours/glitch/features/compose/components/text_icon_button.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/text_icon_button.jsx @@ -27,8 +27,7 @@ export default class TextIconButton extends PureComponent { className={`text-icon-button ${active ? 'active' : ''}`} aria-expanded={active} onClick={this.props.onClick} - aria-controls={ariaControls} - style={iconStyle} + aria-controls={ariaControls} style={iconStyle} > {label} diff --git a/app/javascript/flavours/glitch/features/compose/components/upload_progress.jsx b/app/javascript/flavours/glitch/features/compose/components/upload_progress.jsx index 928446c728..cda57d2d85 100644 --- a/app/javascript/flavours/glitch/features/compose/components/upload_progress.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/upload_progress.jsx @@ -5,7 +5,7 @@ import { FormattedMessage } from 'react-intl'; import spring from 'react-motion/lib/spring'; -import { Icon } from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import Motion from '../../ui/util/optional_motion'; diff --git a/app/javascript/flavours/glitch/features/emoji/emoji_compressed.js b/app/javascript/flavours/glitch/features/emoji/emoji_compressed.js index 6af8a93e54..70ac5e176f 100644 --- a/app/javascript/flavours/glitch/features/emoji/emoji_compressed.js +++ b/app/javascript/flavours/glitch/features/emoji/emoji_compressed.js @@ -93,7 +93,7 @@ Object.keys(emojiIndex.emojis).forEach(key => { let { short_names, search, unified } = emojiMartData.emojis[key]; if (short_names[0] !== key) { - throw new Error('The compresser expects the first short_code to be the ' + + throw new Error('The compressor expects the first short_code to be the ' + 'key. It may need to be rewritten if the emoji change such that this ' + 'is no longer the case.'); } diff --git a/app/javascript/flavours/glitch/features/explore/components/story.jsx b/app/javascript/flavours/glitch/features/explore/components/story.jsx index 8dc92a4d91..0e5ab92122 100644 --- a/app/javascript/flavours/glitch/features/explore/components/story.jsx +++ b/app/javascript/flavours/glitch/features/explore/components/story.jsx @@ -11,7 +11,6 @@ import { RelativeTimestamp } from 'flavours/glitch/components/relative_timestamp import { ShortNumber } from 'flavours/glitch/components/short_number'; import { Skeleton } from 'flavours/glitch/components/skeleton'; - export default class Story extends PureComponent { static propTypes = { diff --git a/app/javascript/flavours/glitch/features/explore/tags.jsx b/app/javascript/flavours/glitch/features/explore/tags.jsx index bebc9bbb53..5f88a79eb6 100644 --- a/app/javascript/flavours/glitch/features/explore/tags.jsx +++ b/app/javascript/flavours/glitch/features/explore/tags.jsx @@ -14,8 +14,6 @@ import { ImmutableHashtag as Hashtag } from 'flavours/glitch/components/hashtag' import { LoadingIndicator } from 'flavours/glitch/components/loading_indicator'; import { WithRouterPropTypes } from 'flavours/glitch/utils/react_router'; - - const mapStateToProps = state => ({ hashtags: state.getIn(['trends', 'tags', 'items']), isLoadingHashtags: state.getIn(['trends', 'tags', 'isLoading']), diff --git a/app/javascript/flavours/glitch/features/favourites/index.jsx b/app/javascript/flavours/glitch/features/favourites/index.jsx index 623312a2fb..ef24b7c79f 100644 --- a/app/javascript/flavours/glitch/features/favourites/index.jsx +++ b/app/javascript/flavours/glitch/features/favourites/index.jsx @@ -18,7 +18,6 @@ import ScrollableList from 'flavours/glitch/components/scrollable_list'; import AccountContainer from 'flavours/glitch/containers/account_container'; import Column from 'flavours/glitch/features/ui/components/column'; - const messages = defineMessages({ heading: { id: 'column.favourited_by', defaultMessage: 'Favourited by' }, refresh: { id: 'refresh', defaultMessage: 'Refresh' }, diff --git a/app/javascript/flavours/glitch/features/follow_requests/index.jsx b/app/javascript/flavours/glitch/features/follow_requests/index.jsx index b0092c88ff..f5ff56d98e 100644 --- a/app/javascript/flavours/glitch/features/follow_requests/index.jsx +++ b/app/javascript/flavours/glitch/features/follow_requests/index.jsx @@ -69,7 +69,6 @@ class FollowRequests extends ImmutablePureComponent { return ( - ({ availableStatusIds: OrderedSet(state.getIn(['timelines', `account:${accountId}:with_replies`, 'items'])), isLoading: state.getIn(['timelines', `account:${accountId}:with_replies`, 'isLoading']), diff --git a/app/javascript/flavours/glitch/features/ui/components/compose_panel.jsx b/app/javascript/flavours/glitch/features/ui/components/compose_panel.jsx index 1b92ac398f..3f9ba99e4f 100644 --- a/app/javascript/flavours/glitch/features/ui/components/compose_panel.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/compose_panel.jsx @@ -11,7 +11,6 @@ import SearchContainer from 'flavours/glitch/features/compose/containers/search_ import LinkFooter from './link_footer'; - class ComposePanel extends PureComponent { static contextTypes = { diff --git a/app/javascript/flavours/glitch/features/ui/components/media_modal.jsx b/app/javascript/flavours/glitch/features/ui/components/media_modal.jsx index 29821c388f..d3d74136f1 100644 --- a/app/javascript/flavours/glitch/features/ui/components/media_modal.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/media_modal.jsx @@ -11,7 +11,7 @@ import ReactSwipeableViews from 'react-swipeable-views'; import { getAverageFromBlurhash } from 'flavours/glitch/blurhash'; import { GIFV } from 'flavours/glitch/components/gifv'; -import { Icon } from 'flavours/glitch/components/icon'; +import { Icon } from 'flavours/glitch/components/icon'; import { IconButton } from 'flavours/glitch/components/icon_button'; import Footer from 'flavours/glitch/features/picture_in_picture/components/footer'; import Video from 'flavours/glitch/features/video'; diff --git a/app/javascript/flavours/glitch/features/ui/components/sign_in_banner.jsx b/app/javascript/flavours/glitch/features/ui/components/sign_in_banner.jsx index 184a8d103f..5db3cb492b 100644 --- a/app/javascript/flavours/glitch/features/ui/components/sign_in_banner.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/sign_in_banner.jsx @@ -2,6 +2,7 @@ import { useCallback } from 'react'; import { FormattedMessage } from 'react-intl'; + import { openModal } from 'flavours/glitch/actions/modal'; import { registrationsOpen, sso_redirect } from 'flavours/glitch/initial_state'; import { useAppDispatch, useAppSelector } from 'flavours/glitch/store'; diff --git a/app/javascript/flavours/glitch/features/ui/util/react_router_helpers.jsx b/app/javascript/flavours/glitch/features/ui/util/react_router_helpers.jsx index aeb21c2490..c0ee31bf68 100644 --- a/app/javascript/flavours/glitch/features/ui/util/react_router_helpers.jsx +++ b/app/javascript/flavours/glitch/features/ui/util/react_router_helpers.jsx @@ -30,7 +30,7 @@ WrappedSwitch.propTypes = { children: PropTypes.node, }; -// Small Wraper to extract the params from the route and pass +// Small Wrapper to extract the params from the route and pass // them to the rendered component, together with the content to // be rendered inside (the children) export class WrappedRoute extends Component { From 349579e31875c11a5de8daa9fdc95280c0ee4c24 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 15 Nov 2023 13:19:37 +0100 Subject: [PATCH 2/5] Fix more code discrepancies --- app/javascript/flavours/glitch/components/modal_root.jsx | 5 +++-- app/javascript/flavours/glitch/features/emoji/emoji.js | 1 - app/javascript/flavours/glitch/features/mutes/index.jsx | 2 +- .../flavours/glitch/features/public_timeline/index.jsx | 8 ++++---- app/javascript/flavours/glitch/reducers/index.ts | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/javascript/flavours/glitch/components/modal_root.jsx b/app/javascript/flavours/glitch/components/modal_root.jsx index cebc1040a7..f338c4ec0e 100644 --- a/app/javascript/flavours/glitch/components/modal_root.jsx +++ b/app/javascript/flavours/glitch/components/modal_root.jsx @@ -110,8 +110,9 @@ class ModalRoot extends PureComponent { } _handleModalClose () { - this.unlistenHistory(); - + if (this.unlistenHistory) { + this.unlistenHistory(); + } const { state } = this.history.location; if (state && state.mastodonModalKey === this._modalHistoryKey) { this.history.goBack(); diff --git a/app/javascript/flavours/glitch/features/emoji/emoji.js b/app/javascript/flavours/glitch/features/emoji/emoji.js index 6a2bb416e2..1e6aae2394 100644 --- a/app/javascript/flavours/glitch/features/emoji/emoji.js +++ b/app/javascript/flavours/glitch/features/emoji/emoji.js @@ -138,7 +138,6 @@ const emojify = (str, customEmojis = {}) => { }; export default emojify; -export { unicodeMapping }; export const buildCustomEmojis = (customEmojis) => { const emojis = []; diff --git a/app/javascript/flavours/glitch/features/mutes/index.jsx b/app/javascript/flavours/glitch/features/mutes/index.jsx index 82c1dce85b..f9c42378a5 100644 --- a/app/javascript/flavours/glitch/features/mutes/index.jsx +++ b/app/javascript/flavours/glitch/features/mutes/index.jsx @@ -48,7 +48,7 @@ class Mutes extends ImmutablePureComponent { }, 300, { leading: true }); render () { - const { intl, accountIds, hasMore, multiColumn, isLoading } = this.props; + const { intl, hasMore, accountIds, multiColumn, isLoading } = this.props; if (!accountIds) { return ( diff --git a/app/javascript/flavours/glitch/features/public_timeline/index.jsx b/app/javascript/flavours/glitch/features/public_timeline/index.jsx index 05466c22fa..8c373d99ab 100644 --- a/app/javascript/flavours/glitch/features/public_timeline/index.jsx +++ b/app/javascript/flavours/glitch/features/public_timeline/index.jsx @@ -44,14 +44,14 @@ const mapStateToProps = (state, { columnId }) => { class PublicTimeline extends PureComponent { - static defaultProps = { - onlyMedia: false, - }; - static contextTypes = { identity: PropTypes.object, }; + static defaultProps = { + onlyMedia: false, + }; + static propTypes = { dispatch: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, diff --git a/app/javascript/flavours/glitch/reducers/index.ts b/app/javascript/flavours/glitch/reducers/index.ts index a87e75fcad..79febbce3d 100644 --- a/app/javascript/flavours/glitch/reducers/index.ts +++ b/app/javascript/flavours/glitch/reducers/index.ts @@ -68,8 +68,8 @@ const reducers = { push_notifications, mutes, blocks, - server, boosts, + server, contexts, compose, search, From 50eb67349448e41b99e87db42b4e882084ea27ba Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 15 Nov 2023 13:59:15 +0100 Subject: [PATCH 3/5] Fix some markup discrepancies --- .../compose/components/emoji_picker_dropdown.jsx | 12 ++++++------ .../features/compose/components/text_icon_button.jsx | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/javascript/flavours/glitch/features/compose/components/emoji_picker_dropdown.jsx b/app/javascript/flavours/glitch/features/compose/components/emoji_picker_dropdown.jsx index c2c8030615..4195316794 100644 --- a/app/javascript/flavours/glitch/features/compose/components/emoji_picker_dropdown.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/emoji_picker_dropdown.jsx @@ -103,12 +103,12 @@ class ModifierPickerMenu extends PureComponent { return (
- - - - - - + + + + + +
); } diff --git a/app/javascript/flavours/glitch/features/compose/components/text_icon_button.jsx b/app/javascript/flavours/glitch/features/compose/components/text_icon_button.jsx index 9e5ec4237c..166d022b88 100644 --- a/app/javascript/flavours/glitch/features/compose/components/text_icon_button.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/text_icon_button.jsx @@ -22,6 +22,7 @@ export default class TextIconButton extends PureComponent { return (