From 076f7534dbc0bcefee11f93c72c69d3c1893a26a Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Thu, 8 Dec 2022 14:32:45 +0000 Subject: [PATCH] Akkoma patches don't replace my history re-add CI lint stuff upload to $build-tag change SW path use default SW fix notifications streams use akkoma hashtag schema add local intl --- .gitignore | 1 + .woodpecker.yml | 30 ++++ app/javascript/core/settings.js | 4 +- .../flavours/glitch/actions/accounts.js | 4 +- .../flavours/glitch/actions/boosts.js | 2 +- .../actions/push_notifications/registerer.js | 5 +- .../flavours/glitch/actions/store.js | 2 +- .../flavours/glitch/actions/streaming.js | 1 + .../flavours/glitch/actions/timelines.js | 3 +- .../glitch/components/display_name.js | 2 +- .../flavours/glitch/components/hashtag.js | 5 +- .../intersection_observer_article.js | 5 +- .../glitch/components/media_gallery.js | 4 +- .../flavours/glitch/components/modal_root.js | 1 + .../flavours/glitch/components/permalink.js | 2 +- .../flavours/glitch/components/spoilers.js | 26 ++-- .../flavours/glitch/components/status.js | 12 +- .../glitch/components/status_action_bar.js | 2 +- .../glitch/components/status_content.js | 2 +- .../glitch/components/status_icons.js | 20 +-- .../components/status_visibility_icon.js | 2 + .../flavours/glitch/containers/mastodon.js | 2 +- .../features/account/components/action_bar.js | 2 +- .../features/account/components/header.js | 5 +- .../account_timeline/components/moved_note.js | 2 +- .../containers/header_container.js | 2 +- .../flavours/glitch/features/audio/index.js | 2 +- .../containers/column_settings_container.js | 2 +- .../compose/components/compose_form.js | 139 +++++++++--------- .../features/compose/components/dropdown.js | 2 +- .../features/compose/components/header.js | 8 +- .../compose/components/navigation_bar.js | 1 - .../features/compose/components/publisher.js | 1 + .../compose/components/search_results.js | 3 +- .../compose/components/textarea_icons.js | 3 +- .../compose/components/upload_form.js | 1 + .../containers/compose_form_container.js | 18 +-- .../compose/containers/warning_container.js | 4 +- .../flavours/glitch/features/compose/index.js | 1 + .../components/conversation.js | 2 +- .../glitch/features/getting_started/index.js | 4 +- .../features/local_settings/page/index.js | 8 +- .../local_settings/page/item/index.js | 5 +- .../components/pill_bar_button.js | 2 +- .../containers/search_container.js | 2 +- .../containers/column_settings_container.js | 2 +- .../standalone/public_timeline/index.js | 100 +++++++++++++ .../status/components/detailed_status.js | 4 +- .../flavours/glitch/features/status/index.js | 2 +- .../features/ui/components/boost_modal.js | 6 +- .../features/ui/components/column_link.js | 2 +- .../features/ui/components/doodle_modal.js | 4 +- .../features/ui/components/favourite_modal.js | 2 +- .../ui/components/navigation_panel.js | 4 +- .../ui/components/onboarding_modal.js | 2 +- .../flavours/glitch/features/ui/index.js | 4 +- .../flavours/glitch/features/video/index.js | 2 +- app/javascript/flavours/glitch/locales/pl.js | 4 +- .../flavours/glitch/reducers/compose.js | 16 +- .../flavours/glitch/reducers/contexts.js | 2 +- .../flavours/glitch/reducers/list_editor.js | 8 +- .../flavours/glitch/reducers/rules.js | 13 ++ app/javascript/flavours/glitch/stream.js | 22 +-- app/javascript/flavours/glitch/util/main.js | 28 ++++ .../flavours/glitch/utils/hashtag.js | 8 +- .../flavours/glitch/utils/react_helpers.js | 2 +- .../mastodon/containers/mastodon.js | 2 +- .../mastodon/service_worker/entry.js | 7 +- build.sh | 20 +++ config/webpack/shared.js | 6 +- dev.sh | 18 +++ package.json | 8 +- package.sh | 8 + yarn.lock | 15 +- 74 files changed, 456 insertions(+), 221 deletions(-) create mode 100644 .woodpecker.yml create mode 100644 app/javascript/flavours/glitch/features/standalone/public_timeline/index.js create mode 100644 app/javascript/flavours/glitch/reducers/rules.js create mode 100644 app/javascript/flavours/glitch/util/main.js create mode 100755 build.sh create mode 100755 dev.sh create mode 100755 package.sh diff --git a/.gitignore b/.gitignore index 7d76b8275..8dd4c8fa9 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ # Ignore bundler config and downloaded libraries. /.bundle +distribution /vendor/bundle # Ignore the default SQLite database. diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 000000000..a4be30677 --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,30 @@ +pipeline: + build: + when: + event: + - tag + - push + image: node:16 + commands: + - yarn + - TARGET=distribution ./build.sh + + release: + when: + event: + - tag + - push + image: node:16 + secrets: + - SCW_ACCESS_KEY + - SCW_SECRET_KEY + - SCW_DEFAULT_ORGANIZATION_ID + commands: + - apt-get update && apt-get install -y rclone wget zip + - wget https://github.com/scaleway/scaleway-cli/releases/download/v2.5.1/scaleway-cli_2.5.1_linux_amd64 + - mv scaleway-cli_2.5.1_linux_amd64 scaleway-cli + - chmod +x scaleway-cli + - ./scaleway-cli object config install type=rclone + - export BUILD_TAG=$${CI_COMMIT_TAG:-"$CI_COMMIT_BRANCH"} + - zip mastofe.zip -r distribution + - rclone copyto mastofe.zip scaleway:akkoma-updates/frontend/$BUILD_TAG/masto-fe.zip diff --git a/app/javascript/core/settings.js b/app/javascript/core/settings.js index d5bb9532c..d578463a3 100644 --- a/app/javascript/core/settings.js +++ b/app/javascript/core/settings.js @@ -2,7 +2,9 @@ import 'packs/public-path'; import escapeTextContentForBrowser from 'escape-html'; + const { delegate } = require('@rails/ujs'); + import emojify from '../mastodon/features/emoji/emoji'; delegate(document, '#account_display_name', 'input', ({ target }) => { @@ -65,7 +67,7 @@ delegate(document, '.input-copy button', 'click', ({ target }) => { input.blur(); target.parentNode.classList.add('copied'); - setTimeout(() => { + setTimeout(() => { target.parentNode.classList.remove('copied'); }, 700); } diff --git a/app/javascript/flavours/glitch/actions/accounts.js b/app/javascript/flavours/glitch/actions/accounts.js index dc670e50a..89a5f0fff 100644 --- a/app/javascript/flavours/glitch/actions/accounts.js +++ b/app/javascript/flavours/glitch/actions/accounts.js @@ -811,7 +811,7 @@ export function fetchPinnedAccounts() { return (dispatch, getState) => { dispatch(fetchPinnedAccountsRequest()); - api(getState).get(`/api/v1/endorsements`, { params: { limit: 0 } }).then(response => { + api(getState).get('/api/v1/endorsements', { params: { limit: 0 } }).then(response => { dispatch(importFetchedAccounts(response.data)); dispatch(fetchPinnedAccountsSuccess(response.data)); }).catch(err => dispatch(fetchPinnedAccountsFail(err))); @@ -873,7 +873,7 @@ export function changePinnedAccountsSuggestions(value) { return { type: PINNED_ACCOUNTS_EDITOR_SUGGESTIONS_CHANGE, value, - } + }; }; export function resetPinnedAccountsEditor() { diff --git a/app/javascript/flavours/glitch/actions/boosts.js b/app/javascript/flavours/glitch/actions/boosts.js index 6e14065d6..c0f0f3acc 100644 --- a/app/javascript/flavours/glitch/actions/boosts.js +++ b/app/javascript/flavours/glitch/actions/boosts.js @@ -11,7 +11,7 @@ export function initBoostModal(props) { dispatch({ type: BOOSTS_INIT_MODAL, - privacy + privacy, }); dispatch(openModal('BOOST', props)); diff --git a/app/javascript/flavours/glitch/actions/push_notifications/registerer.js b/app/javascript/flavours/glitch/actions/push_notifications/registerer.js index 762fe260c..34ddd872e 100644 --- a/app/javascript/flavours/glitch/actions/push_notifications/registerer.js +++ b/app/javascript/flavours/glitch/actions/push_notifications/registerer.js @@ -18,7 +18,10 @@ const urlBase64ToUint8Array = (base64String) => { return outputArray; }; -const getApplicationServerKey = () => document.querySelector('[name="applicationServerKey"]').getAttribute('content'); +const getApplicationServerKey = () => { + const k = document.querySelector('[name="applicationServerKey"]'); + return k === null ? '' : k.getAttribute('content'); +}; const getRegistration = () => navigator.serviceWorker.ready; diff --git a/app/javascript/flavours/glitch/actions/store.js b/app/javascript/flavours/glitch/actions/store.js index 9dbc0b214..9257a6efe 100644 --- a/app/javascript/flavours/glitch/actions/store.js +++ b/app/javascript/flavours/glitch/actions/store.js @@ -18,7 +18,7 @@ const applyMigrations = (state) => { if (state.getIn(['settings', 'notifications', 'showUnread']) !== false) { state.setIn(['settings', 'notifications', 'showUnread'], state.getIn(['local_settings', 'notifications', 'show_unread'])); } - state.removeIn(['local_settings', 'notifications', 'show_unread']) + state.removeIn(['local_settings', 'notifications', 'show_unread']); } }); }; diff --git a/app/javascript/flavours/glitch/actions/streaming.js b/app/javascript/flavours/glitch/actions/streaming.js index ffac1b258..193e8e30b 100644 --- a/app/javascript/flavours/glitch/actions/streaming.js +++ b/app/javascript/flavours/glitch/actions/streaming.js @@ -80,6 +80,7 @@ export const connectTimelineStream = (timelineId, channelName, params = {}, opti }, onReceive (data) { + console.log("recv", timelineId, data) switch(data.event) { case 'update': dispatch(updateTimeline(timelineId, JSON.parse(data.payload), options.accept)); diff --git a/app/javascript/flavours/glitch/actions/timelines.js b/app/javascript/flavours/glitch/actions/timelines.js index a1c4dd43a..7dc84be32 100644 --- a/app/javascript/flavours/glitch/actions/timelines.js +++ b/app/javascript/flavours/glitch/actions/timelines.js @@ -27,6 +27,7 @@ export const loadPending = timeline => ({ }); export function updateTimeline(timeline, status, accept) { + console.log("UPDATE", timeline, status); return (dispatch, getState) => { if (typeof accept === 'function' && !accept(status)) { return; @@ -55,7 +56,7 @@ export function updateTimeline(timeline, status, accept) { timeline, status, usePendingItems: preferPendingItems, - filtered + filtered, }); if (timeline === 'home') { diff --git a/app/javascript/flavours/glitch/components/display_name.js b/app/javascript/flavours/glitch/components/display_name.js index 1c2297578..46087b8b9 100644 --- a/app/javascript/flavours/glitch/components/display_name.js +++ b/app/javascript/flavours/glitch/components/display_name.js @@ -74,7 +74,7 @@ export default class DisplayName extends React.PureComponent { )).reduce((prev, cur) => [prev, ', ', cur]); if (others.size - 2 > 0) { - displayName.push(` +${others.size - 2}`); + displayName.push(` +${others.size - 2}`); } suffix = ( diff --git a/app/javascript/flavours/glitch/components/hashtag.js b/app/javascript/flavours/glitch/components/hashtag.js index 422b9a8fa..9a1b93fc1 100644 --- a/app/javascript/flavours/glitch/components/hashtag.js +++ b/app/javascript/flavours/glitch/components/hashtag.js @@ -55,8 +55,9 @@ export const ImmutableHashtag = ({ hashtag }) => ( name={hashtag.get('name')} href={hashtag.get('url')} to={`/tags/${hashtag.get('name')}`} - people={hashtag.getIn(['history', 0, 'accounts']) * 1 + hashtag.getIn(['history', 1, 'accounts']) * 1} - history={hashtag.get('history').reverse().map((day) => day.get('uses')).toArray()} + people={0} + uses={0} + history={[]} /> ); diff --git a/app/javascript/flavours/glitch/components/intersection_observer_article.js b/app/javascript/flavours/glitch/components/intersection_observer_article.js index b28e44e4c..f3ae7ac9a 100644 --- a/app/javascript/flavours/glitch/components/intersection_observer_article.js +++ b/app/javascript/flavours/glitch/components/intersection_observer_article.js @@ -121,8 +121,9 @@ export default class IntersectionObserverArticle extends React.Component { aria-setsize={listLength} data-id={id} tabIndex='0' - style={style}> - {children && React.cloneElement(children, { hidden: !isIntersecting && (isHidden || !!cachedHeight) })} + style={style} + > + {children && React.cloneElement(children, { hidden: !isIntersecting && (isHidden || !!cachedHeight) })} ); } diff --git a/app/javascript/flavours/glitch/components/media_gallery.js b/app/javascript/flavours/glitch/components/media_gallery.js index ac0d05926..36d2774fe 100644 --- a/app/javascript/flavours/glitch/components/media_gallery.js +++ b/app/javascript/flavours/glitch/components/media_gallery.js @@ -323,7 +323,7 @@ class MediaGallery extends React.PureComponent { _setDimensions () { const width = this.node.offsetWidth; - + if (width && width != this.state.width) { // offsetWidth triggers a layout, so only calculate when we need to if (this.props.cacheWidth) { @@ -360,7 +360,7 @@ class MediaGallery extends React.PureComponent { } else if (width) { style.height = width / (16/9); } else { - return (
); + return (
); } if (this.isStandaloneEligible()) { diff --git a/app/javascript/flavours/glitch/components/modal_root.js b/app/javascript/flavours/glitch/components/modal_root.js index 056277447..733b92d95 100644 --- a/app/javascript/flavours/glitch/components/modal_root.js +++ b/app/javascript/flavours/glitch/components/modal_root.js @@ -5,6 +5,7 @@ import { createBrowserHistory } from 'history'; import { multiply } from 'color-blend'; export default class ModalRoot extends React.PureComponent { + static contextTypes = { router: PropTypes.object, }; diff --git a/app/javascript/flavours/glitch/components/permalink.js b/app/javascript/flavours/glitch/components/permalink.js index 718b02115..cc16357f6 100644 --- a/app/javascript/flavours/glitch/components/permalink.js +++ b/app/javascript/flavours/glitch/components/permalink.js @@ -24,7 +24,7 @@ export default class Permalink extends React.PureComponent { if (this.context.router) { e.preventDefault(); - let state = {...this.context.router.history.location.state}; + let state = { ...this.context.router.history.location.state }; state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1; this.context.router.history.push(this.props.to, state); } diff --git a/app/javascript/flavours/glitch/components/spoilers.js b/app/javascript/flavours/glitch/components/spoilers.js index 8527403c1..5d1dd2388 100644 --- a/app/javascript/flavours/glitch/components/spoilers.js +++ b/app/javascript/flavours/glitch/components/spoilers.js @@ -4,6 +4,7 @@ import { FormattedMessage } from 'react-intl'; export default class Spoilers extends React.PureComponent { + static propTypes = { spoilerText: PropTypes.string, children: PropTypes.node, @@ -21,17 +22,17 @@ class Spoilers extends React.PureComponent { const { spoilerText, children } = this.props; const { hidden } = this.state; - const toggleText = hidden ? - : - ; + const toggleText = hidden ? + () : + (); return ([

@@ -43,8 +44,9 @@ class Spoilers extends React.PureComponent {

,
{children} -
+
, ]); } + } diff --git a/app/javascript/flavours/glitch/components/status.js b/app/javascript/flavours/glitch/components/status.js index 4041b4819..dfa72a6c9 100644 --- a/app/javascript/flavours/glitch/components/status.js +++ b/app/javascript/flavours/glitch/components/status.js @@ -54,7 +54,7 @@ export const defaultMediaVisibility = (status, settings) => { } return (displayMedia !== 'hide_all' && !status.get('sensitive') || displayMedia === 'show_all'); -} +}; export default @injectIntl class Status extends ImmutablePureComponent { @@ -297,7 +297,9 @@ class Status extends ImmutablePureComponent { if (this.node && this.props.getScrollPosition) { const position = this.props.getScrollPosition(); if (position !== null && this.node.offsetTop < position.top) { - requestAnimationFrame(() => { this.props.updateScrollBottom(position.height - position.top); }); + requestAnimationFrame(() => { + this.props.updateScrollBottom(position.height - position.top); + }); } } } @@ -356,7 +358,7 @@ class Status extends ImmutablePureComponent { status.getIn(['reblog', 'id'], status.get('id')) }`; } - let state = {...router.history.location.state}; + let state = { ...router.history.location.state }; state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1; router.history.push(destination, state); } @@ -429,14 +431,14 @@ class Status extends ImmutablePureComponent { } handleHotkeyOpen = () => { - let state = {...this.context.router.history.location.state}; + let state = { ...this.context.router.history.location.state }; state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1; const status = this.props.status; this.context.router.history.push(`/@${status.getIn(['account', 'acct'])}/${status.get('id')}`, state); } handleHotkeyOpenProfile = () => { - let state = {...this.context.router.history.location.state}; + let state = { ...this.context.router.history.location.state }; state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1; this.context.router.history.push(`/@${this.props.status.getIn(['account', 'acct'])}`, state); } diff --git a/app/javascript/flavours/glitch/components/status_action_bar.js b/app/javascript/flavours/glitch/components/status_action_bar.js index 977c98ccb..6b5e51fc2 100644 --- a/app/javascript/flavours/glitch/components/status_action_bar.js +++ b/app/javascript/flavours/glitch/components/status_action_bar.js @@ -161,7 +161,7 @@ class StatusActionBar extends ImmutablePureComponent { } handleOpen = () => { - let state = {...this.context.router.history.location.state}; + let state = { ...this.context.router.history.location.state }; if (state.mastodonModalKey) { this.context.router.history.replace(`/@${this.props.status.getIn(['account', 'acct'])}/${this.props.status.get('id')}`, { mastodonBackSteps: (state.mastodonBackSteps || 0) + 1 }); } else { diff --git a/app/javascript/flavours/glitch/components/status_content.js b/app/javascript/flavours/glitch/components/status_content.js index c59f42220..31a1b92b4 100644 --- a/app/javascript/flavours/glitch/components/status_content.js +++ b/app/javascript/flavours/glitch/components/status_content.js @@ -12,7 +12,7 @@ const textMatchesTarget = (text, origin, host) => { return (text === origin || text === host || text.startsWith(origin + '/') || text.startsWith(host + '/') || 'www.' + text === host || ('www.' + text).startsWith(host + '/')); -} +}; const isLinkMisleading = (link) => { let linkTextParts = []; diff --git a/app/javascript/flavours/glitch/components/status_icons.js b/app/javascript/flavours/glitch/components/status_icons.js index 71ffb2e56..840581363 100644 --- a/app/javascript/flavours/glitch/components/status_icons.js +++ b/app/javascript/flavours/glitch/components/status_icons.js @@ -66,16 +66,16 @@ class StatusIcons extends React.PureComponent { const { intl } = this.props; switch (mediaIcon) { - case 'link': - return intl.formatMessage(messages.previewCard); - case 'picture-o': - return intl.formatMessage(messages.pictures); - case 'tasks': - return intl.formatMessage(messages.poll); - case 'video-camera': - return intl.formatMessage(messages.video); - case 'music': - return intl.formatMessage(messages.audio); + case 'link': + return intl.formatMessage(messages.previewCard); + case 'picture-o': + return intl.formatMessage(messages.pictures); + case 'tasks': + return intl.formatMessage(messages.poll); + case 'video-camera': + return intl.formatMessage(messages.video); + case 'music': + return intl.formatMessage(messages.audio); } } diff --git a/app/javascript/flavours/glitch/components/status_visibility_icon.js b/app/javascript/flavours/glitch/components/status_visibility_icon.js index 07d56c7a8..76cb5378a 100644 --- a/app/javascript/flavours/glitch/components/status_visibility_icon.js +++ b/app/javascript/flavours/glitch/components/status_visibility_icon.js @@ -10,6 +10,7 @@ const messages = defineMessages({ unlisted: { id: 'privacy.unlisted.short', defaultMessage: 'Unlisted' }, private: { id: 'privacy.private.short', defaultMessage: 'Followers-only' }, direct: { id: 'privacy.direct.short', defaultMessage: 'Mentioned people only' }, + local: { id: 'privacy.local.short', defaultMessage: 'Local users only' }, }); export default @injectIntl @@ -29,6 +30,7 @@ class VisibilityIcon extends ImmutablePureComponent { unlisted: 'unlock', private: 'lock', direct: 'envelope', + local: 'lock', }[visibility]; const label = intl.formatMessage(messages[visibility]); diff --git a/app/javascript/flavours/glitch/containers/mastodon.js b/app/javascript/flavours/glitch/containers/mastodon.js index 6c92376d8..6e305d6fa 100644 --- a/app/javascript/flavours/glitch/containers/mastodon.js +++ b/app/javascript/flavours/glitch/containers/mastodon.js @@ -35,7 +35,7 @@ const createIdentityContext = state => ({ accountId: state.meta.me, disabledAccountId: state.meta.disabled_account_id, accessToken: state.meta.access_token, - permissions: state.role ? state.role.permissions : 0, + permissions: [], }); export default class Mastodon extends React.PureComponent { diff --git a/app/javascript/flavours/glitch/features/account/components/action_bar.js b/app/javascript/flavours/glitch/features/account/components/action_bar.js index ce0584124..fd3ad9ec6 100644 --- a/app/javascript/flavours/glitch/features/account/components/action_bar.js +++ b/app/javascript/flavours/glitch/features/account/components/action_bar.js @@ -32,7 +32,7 @@ class ActionBar extends React.PureComponent {
diff --git a/app/javascript/flavours/glitch/features/account/components/header.js b/app/javascript/flavours/glitch/features/account/components/header.js index 9a5f2fd62..ae95593a8 100644 --- a/app/javascript/flavours/glitch/features/account/components/header.js +++ b/app/javascript/flavours/glitch/features/account/components/header.js @@ -174,8 +174,7 @@ class Header extends ImmutablePureComponent { if (me !== account.get('id') && account.getIn(['relationship', 'followed_by'])) { info.push(); - } - else if (me !== account.get('id') && account.getIn(['relationship', 'blocking'])) { + } else if (me !== account.get('id') && account.getIn(['relationship', 'blocking'])) { info.push(); } @@ -359,7 +358,7 @@ class Header extends ImmutablePureComponent { {fields.map((pair, i) => (
- +
{pair.get('verified_at') && }
diff --git a/app/javascript/flavours/glitch/features/account_timeline/components/moved_note.js b/app/javascript/flavours/glitch/features/account_timeline/components/moved_note.js index 308407e94..19da795d4 100644 --- a/app/javascript/flavours/glitch/features/account_timeline/components/moved_note.js +++ b/app/javascript/flavours/glitch/features/account_timeline/components/moved_note.js @@ -21,7 +21,7 @@ export default class MovedNote extends ImmutablePureComponent { handleAccountClick = e => { if (e.button === 0) { e.preventDefault(); - let state = {...this.context.router.history.location.state}; + let state = { ...this.context.router.history.location.state }; state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1; this.context.router.history.push(`/@${this.props.to.get('acct')}`, state); } diff --git a/app/javascript/flavours/glitch/features/account_timeline/containers/header_container.js b/app/javascript/flavours/glitch/features/account_timeline/containers/header_container.js index 25bcd0119..3ec47cf2f 100644 --- a/app/javascript/flavours/glitch/features/account_timeline/containers/header_container.js +++ b/app/javascript/flavours/glitch/features/account_timeline/containers/header_container.js @@ -12,7 +12,7 @@ import { } from 'flavours/glitch/actions/accounts'; import { mentionCompose, - directCompose + directCompose, } from 'flavours/glitch/actions/compose'; import { initMuteModal } from 'flavours/glitch/actions/mutes'; import { initBlockModal } from 'flavours/glitch/actions/blocks'; diff --git a/app/javascript/flavours/glitch/features/audio/index.js b/app/javascript/flavours/glitch/features/audio/index.js index 014a0a213..239f3a2ed 100644 --- a/app/javascript/flavours/glitch/features/audio/index.js +++ b/app/javascript/flavours/glitch/features/audio/index.js @@ -126,7 +126,7 @@ class Audio extends React.PureComponent { this.visualizer.setCanvas(c); } - + componentDidMount () { window.addEventListener('scroll', this.handleScroll); window.addEventListener('resize', this.handleResize, { passive: true }); diff --git a/app/javascript/flavours/glitch/features/community_timeline/containers/column_settings_container.js b/app/javascript/flavours/glitch/features/community_timeline/containers/column_settings_container.js index b892f08ad..eac1c4bba 100644 --- a/app/javascript/flavours/glitch/features/community_timeline/containers/column_settings_container.js +++ b/app/javascript/flavours/glitch/features/community_timeline/containers/column_settings_container.js @@ -12,7 +12,7 @@ const mapStateToProps = (state, { columnId }) => { settings: (uuid && index >= 0) ? columns.get(index).get('params') : state.getIn(['settings', 'community']), }; }; - + const mapDispatchToProps = (dispatch, { columnId }) => { return { onChange (key, checked) { diff --git a/app/javascript/flavours/glitch/features/compose/components/compose_form.js b/app/javascript/flavours/glitch/features/compose/components/compose_form.js index abdd247a0..91b47a343 100644 --- a/app/javascript/flavours/glitch/features/compose/components/compose_form.js +++ b/app/javascript/flavours/glitch/features/compose/components/compose_form.js @@ -22,9 +22,9 @@ import { length } from 'stringz'; const messages = defineMessages({ placeholder: { id: 'compose_form.placeholder', defaultMessage: 'What is on your mind?' }, missingDescriptionMessage: { id: 'confirmations.missing_media_description.message', - defaultMessage: 'At least one media attachment is lacking a description. Consider describing all media attachments for the visually impaired before sending your toot.' }, + defaultMessage: 'At least one media attachment is lacking a description. Consider describing all media attachments for the visually impaired before sending your toot.' }, missingDescriptionConfirm: { id: 'confirmations.missing_media_description.confirm', - defaultMessage: 'Send anyway' }, + defaultMessage: 'Send anyway' }, spoiler_placeholder: { id: 'compose_form.spoiler_placeholder', defaultMessage: 'Write your warning here' }, }); @@ -88,7 +88,7 @@ class ComposeForm extends ImmutablePureComponent { return [ this.props.spoiler? this.props.spoilerText: '', countableText(this.props.text), - this.props.advancedOptions && this.props.advancedOptions.get('do_not_federate') ? ' 👁️' : '' + this.props.advancedOptions && this.props.advancedOptions.get('do_not_federate') ? ' 👁️' : '', ].join(''); } @@ -217,60 +217,60 @@ class ComposeForm extends ImmutablePureComponent { // the first; this provides a convenient shortcut to drop // everyone else from the conversation. _updateFocusAndSelection = (prevProps) => { - const { - textarea, - spoilerText, - } = this; - const { - focusDate, - caretPosition, - isSubmitting, - preselectDate, - text, - preselectOnReply, - singleColumn, - } = this.props; - let selectionEnd, selectionStart; + const { + textarea, + spoilerText, + } = this; + const { + focusDate, + caretPosition, + isSubmitting, + preselectDate, + text, + preselectOnReply, + singleColumn, + } = this.props; + let selectionEnd, selectionStart; - // Caret/selection handling. - if (focusDate !== prevProps.focusDate) { - switch (true) { - case preselectDate !== prevProps.preselectDate && this.props.isInReply && preselectOnReply: - selectionStart = text.search(/\s/) + 1; - selectionEnd = text.length; - break; - case !isNaN(caretPosition) && caretPosition !== null: - selectionStart = selectionEnd = caretPosition; - break; - default: - selectionStart = selectionEnd = text.length; - } - if (textarea) { - // Because of the wicg-inert polyfill, the activeElement may not be - // immediately selectable, we have to wait for observers to run, as - // described in https://github.com/WICG/inert#performance-and-gotchas - Promise.resolve().then(() => { - textarea.setSelectionRange(selectionStart, selectionEnd); - textarea.focus(); - if (!singleColumn) textarea.scrollIntoView(); - }).catch(console.error); - } + // Caret/selection handling. + if (focusDate !== prevProps.focusDate) { + switch (true) { + case preselectDate !== prevProps.preselectDate && this.props.isInReply && preselectOnReply: + selectionStart = text.search(/\s/) + 1; + selectionEnd = text.length; + break; + case !isNaN(caretPosition) && caretPosition !== null: + selectionStart = selectionEnd = caretPosition; + break; + default: + selectionStart = selectionEnd = text.length; + } + if (textarea) { + // Because of the wicg-inert polyfill, the activeElement may not be + // immediately selectable, we have to wait for observers to run, as + // described in https://github.com/WICG/inert#performance-and-gotchas + Promise.resolve().then(() => { + textarea.setSelectionRange(selectionStart, selectionEnd); + textarea.focus(); + if (!singleColumn) textarea.scrollIntoView(); + }).catch(console.error); + } - // Refocuses the textarea after submitting. - } else if (textarea && prevProps.isSubmitting && !isSubmitting) { - textarea.focus(); - } else if (this.props.spoiler !== prevProps.spoiler) { - if (this.props.spoiler) { - if (spoilerText) { - spoilerText.focus(); - } - } else { - if (textarea) { - textarea.focus(); - } - } - } - } + // Refocuses the textarea after submitting. + } else if (textarea && prevProps.isSubmitting && !isSubmitting) { + textarea.focus(); + } else if (this.props.spoiler !== prevProps.spoiler) { + if (this.props.spoiler) { + if (spoilerText) { + spoilerText.focus(); + } + } else { + if (textarea) { + textarea.focus(); + } + } + } + } render () { @@ -302,13 +302,12 @@ class ComposeForm extends ImmutablePureComponent { isEditing, } = this.props; - const countText = this.getFulltextForCharacterCounting(); + const countText = this.getFulltextForCharacterCounting(); return (
- - +
- -
- ); - } + + + ); + } } diff --git a/app/javascript/flavours/glitch/features/compose/components/dropdown.js b/app/javascript/flavours/glitch/features/compose/components/dropdown.js index 3de198c45..6553a7383 100644 --- a/app/javascript/flavours/glitch/features/compose/components/dropdown.js +++ b/app/javascript/flavours/glitch/features/compose/components/dropdown.js @@ -153,7 +153,7 @@ export default class ComposerOptionsDropdown extends React.PureComponent { ...rest, active: value && name === value, name, - }) + }), ), }; } diff --git a/app/javascript/flavours/glitch/features/compose/components/header.js b/app/javascript/flavours/glitch/features/compose/components/header.js index 7ecb573ab..497cb8035 100644 --- a/app/javascript/flavours/glitch/features/compose/components/header.js +++ b/app/javascript/flavours/glitch/features/compose/components/header.js @@ -47,6 +47,7 @@ const messages = defineMessages({ export default @injectIntl class Header extends ImmutablePureComponent { + static propTypes = { columns: ImmutablePropTypes.list, unreadNotifications: PropTypes.number, @@ -71,8 +72,8 @@ class Header extends ImmutablePureComponent { // Only renders the component if the column isn't being shown. const renderForColumn = conditionalRender.bind(null, columnId => !columns || !columns.some( - column => column.get('id') === columnId - ) + column => column.get('id') === columnId, + ), ); // The result. @@ -125,10 +126,11 @@ class Header extends ImmutablePureComponent { ); }; + } diff --git a/app/javascript/flavours/glitch/features/compose/components/navigation_bar.js b/app/javascript/flavours/glitch/features/compose/components/navigation_bar.js index 1a68f1e12..5a77568b5 100644 --- a/app/javascript/flavours/glitch/features/compose/components/navigation_bar.js +++ b/app/javascript/flavours/glitch/features/compose/components/navigation_bar.js @@ -42,5 +42,4 @@ export default class NavigationBar extends ImmutablePureComponent { ); } - } diff --git a/app/javascript/flavours/glitch/features/compose/components/publisher.js b/app/javascript/flavours/glitch/features/compose/components/publisher.js index 9d53b7ee3..c46932572 100644 --- a/app/javascript/flavours/glitch/features/compose/components/publisher.js +++ b/app/javascript/flavours/glitch/features/compose/components/publisher.js @@ -95,4 +95,5 @@ class Publisher extends ImmutablePureComponent { ); }; + } diff --git a/app/javascript/flavours/glitch/features/compose/components/search_results.js b/app/javascript/flavours/glitch/features/compose/components/search_results.js index c2178702c..5972e13ca 100644 --- a/app/javascript/flavours/glitch/features/compose/components/search_results.js +++ b/app/javascript/flavours/glitch/features/compose/components/search_results.js @@ -103,7 +103,7 @@ class SearchResults extends ImmutablePureComponent {
- {results.get('statuses').map(statusId => )} + {results.get('statuses').map(statusId => )} {results.get('statuses').size >= 5 && }
@@ -137,4 +137,5 @@ class SearchResults extends ImmutablePureComponent { ); }; + } diff --git a/app/javascript/flavours/glitch/features/compose/components/textarea_icons.js b/app/javascript/flavours/glitch/features/compose/components/textarea_icons.js index 25c2443b1..d8ee5c81b 100644 --- a/app/javascript/flavours/glitch/features/compose/components/textarea_icons.js +++ b/app/javascript/flavours/glitch/features/compose/components/textarea_icons.js @@ -51,9 +51,10 @@ class TextareaIcons extends ImmutablePureComponent { id={icon} /> - ) : null + ) : null, ) : null} ); } + } diff --git a/app/javascript/flavours/glitch/features/compose/components/upload_form.js b/app/javascript/flavours/glitch/features/compose/components/upload_form.js index 7ebbac963..f2e7fe7a2 100644 --- a/app/javascript/flavours/glitch/features/compose/components/upload_form.js +++ b/app/javascript/flavours/glitch/features/compose/components/upload_form.js @@ -6,6 +6,7 @@ import UploadContainer from '../containers/upload_container'; import SensitiveButtonContainer from '../containers/sensitive_button_container'; export default class UploadForm extends ImmutablePureComponent { + static propTypes = { mediaIds: ImmutablePropTypes.list.isRequired, }; diff --git a/app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js b/app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js index d12c98c01..2e04d04f7 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js @@ -22,11 +22,11 @@ import { privacyPreference } from 'flavours/glitch/utils/privacy_preference'; const messages = defineMessages({ missingDescriptionMessage: { id: 'confirmations.missing_media_description.message', - defaultMessage: 'At least one media attachment is lacking a description. Consider describing all media attachments for the visually impaired before sending your toot.' }, + defaultMessage: 'At least one media attachment is lacking a description. Consider describing all media attachments for the visually impaired before sending your toot.' }, missingDescriptionConfirm: { id: 'confirmations.missing_media_description.confirm', - defaultMessage: 'Send anyway' }, + defaultMessage: 'Send anyway' }, missingDescriptionEdit: { id: 'confirmations.missing_media_description.edit', - defaultMessage: 'Edit media' }, + defaultMessage: 'Edit media' }, }); // State mapping. @@ -38,12 +38,12 @@ function mapStateToProps (state) { const sideArmRestrictedPrivacy = replyPrivacy ? privacyPreference(replyPrivacy, sideArmBasePrivacy) : null; let sideArmPrivacy = null; switch (state.getIn(['local_settings', 'side_arm_reply_mode'])) { - case 'copy': - sideArmPrivacy = replyPrivacy; - break; - case 'restrict': - sideArmPrivacy = sideArmRestrictedPrivacy; - break; + case 'copy': + sideArmPrivacy = replyPrivacy; + break; + case 'restrict': + sideArmPrivacy = sideArmRestrictedPrivacy; + break; } sideArmPrivacy = sideArmPrivacy || sideArmBasePrivacy; return { diff --git a/app/javascript/flavours/glitch/features/compose/containers/warning_container.js b/app/javascript/flavours/glitch/features/compose/containers/warning_container.js index b2ed40b82..9402601f8 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/warning_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/warning_container.js @@ -8,7 +8,7 @@ import { profileLink, termsLink } from 'flavours/glitch/utils/backend_links'; const buildHashtagRE = () => { try { - const HASHTAG_SEPARATORS = "_\\u00b7\\u200c"; + const HASHTAG_SEPARATORS = '_\\u00b7\\u200c'; const ALPHA = '\\p{L}\\p{M}'; const WORD = '\\p{L}\\p{M}\\p{N}\\p{Pc}'; return new RegExp( @@ -22,7 +22,7 @@ const buildHashtagRE = () => { '[' + WORD + '_]*' + '[' + ALPHA + ']' + '[' + WORD + '_]*' + - '))', 'iu' + '))', 'iu', ); } catch { return /(?:^|[^\/\)\w])#(\w*[a-zA-Z·]\w*)/i; diff --git a/app/javascript/flavours/glitch/features/compose/index.js b/app/javascript/flavours/glitch/features/compose/index.js index 8ca378672..68eb05e2c 100644 --- a/app/javascript/flavours/glitch/features/compose/index.js +++ b/app/javascript/flavours/glitch/features/compose/index.js @@ -43,6 +43,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ export default @connect(mapStateToProps, mapDispatchToProps) @injectIntl class Compose extends React.PureComponent { + static propTypes = { multiColumn: PropTypes.bool, showSearch: PropTypes.bool, diff --git a/app/javascript/flavours/glitch/features/direct_timeline/components/conversation.js b/app/javascript/flavours/glitch/features/direct_timeline/components/conversation.js index 00d9fdcd0..9d73b3d88 100644 --- a/app/javascript/flavours/glitch/features/direct_timeline/components/conversation.js +++ b/app/javascript/flavours/glitch/features/direct_timeline/components/conversation.js @@ -60,7 +60,7 @@ class Conversation extends ImmutablePureComponent { } destination = `/statuses/${lastStatus.get('id')}`; } - let state = {...router.history.location.state}; + let state = { ...router.history.location.state }; state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1; router.history.push(destination, state); e.preventDefault(); diff --git a/app/javascript/flavours/glitch/features/getting_started/index.js b/app/javascript/flavours/glitch/features/getting_started/index.js index f9d79013b..3124158f0 100644 --- a/app/javascript/flavours/glitch/features/getting_started/index.js +++ b/app/javascript/flavours/glitch/features/getting_started/index.js @@ -79,9 +79,9 @@ const badgeDisplay = (number, limit) => { const NAVIGATION_PANEL_BREAKPOINT = 600 + (285 * 2) + (10 * 2); - export default @connect(makeMapStateToProps, mapDispatchToProps) +export default @connect(makeMapStateToProps, mapDispatchToProps) @injectIntl - class GettingStarted extends ImmutablePureComponent { +class GettingStarted extends ImmutablePureComponent { static contextTypes = { router: PropTypes.object.isRequired, diff --git a/app/javascript/flavours/glitch/features/local_settings/page/index.js b/app/javascript/flavours/glitch/features/local_settings/page/index.js index d01eec811..db65c3f3a 100644 --- a/app/javascript/flavours/glitch/features/local_settings/page/index.js +++ b/app/javascript/flavours/glitch/features/local_settings/page/index.js @@ -60,7 +60,7 @@ class LocalSettingsPage extends React.PureComponent { onChange={onChange} > - + - + - + - + diff --git a/app/javascript/flavours/glitch/features/local_settings/page/item/index.js b/app/javascript/flavours/glitch/features/local_settings/page/item/index.js index 6b24e4143..72d3fd061 100644 --- a/app/javascript/flavours/glitch/features/local_settings/page/item/index.js +++ b/app/javascript/flavours/glitch/features/local_settings/page/item/index.js @@ -54,13 +54,14 @@ export default class LocalSettingsPageItem extends React.PureComponent { let optionId = `${id}--${opt.value}`; return (