From bf3272d113be1dc656d2bce0e9b6be492e282c96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Thu, 6 Jan 2022 20:55:06 +0100 Subject: [PATCH] Replace link to /reblogs, require authentication MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- app/soapbox/components/status_action_bar.js | 16 ++++++++++++++- .../components/status_interaction_bar.js | 20 +++++++++++++------ .../ui/components/unauthorized_modal.js | 4 ++-- app/styles/components/detailed-status.scss | 1 + 4 files changed, 32 insertions(+), 9 deletions(-) diff --git a/app/soapbox/components/status_action_bar.js b/app/soapbox/components/status_action_bar.js index d552a82b8..a79f940b8 100644 --- a/app/soapbox/components/status_action_bar.js +++ b/app/soapbox/components/status_action_bar.js @@ -70,6 +70,7 @@ class StatusActionBar extends ImmutablePureComponent { static propTypes = { status: ImmutablePropTypes.map.isRequired, onOpenUnauthorizedModal: PropTypes.func.isRequired, + onOpenReblogsModal: PropTypes.func.isRequired, onReply: PropTypes.func, onFavourite: PropTypes.func, onBookmark: PropTypes.func, @@ -294,6 +295,13 @@ class StatusActionBar extends ImmutablePureComponent { this.props.onToggleStatusSensitivity(this.props.status); } + handleOpenReblogsModal = () => { + const { me, status, onOpenUnauthorizedModal, onOpenReblogsModal } = this.props; + + if (!me) onOpenUnauthorizedModal(); + else onOpenReblogsModal(status.getIn(['account', 'acct']), status.get('id')); + } + _makeMenu = (publicStatus) => { const { status, intl, withDismiss, withGroupAdmin, me, features, isStaff, isAdmin } = this.props; const mutingConversation = status.get('muted'); @@ -544,7 +552,7 @@ class StatusActionBar extends ImmutablePureComponent {
- {reblogCount !== 0 && {reblogCount}} + {reblogCount !== 0 && {reblogCount}}
({ ap_id: status.get('url'), })); }, + onOpenReblogsModal(username, statusId) { + dispatch(openModal('REBLOGS', { + username, + statusId, + })); + }, }); export default injectIntl( diff --git a/app/soapbox/features/status/components/status_interaction_bar.js b/app/soapbox/features/status/components/status_interaction_bar.js index 16648a532..2080b71a6 100644 --- a/app/soapbox/features/status/components/status_interaction_bar.js +++ b/app/soapbox/features/status/components/status_interaction_bar.js @@ -13,15 +13,20 @@ import { getSoapboxConfig } from 'soapbox/actions/soapbox'; import { openModal } from 'soapbox/actions/modal'; const mapStateToProps = state => { + const me = state.get('me'); const instance = state.get('instance'); return { + me, allowedEmoji: getSoapboxConfig(state).get('allowedEmoji'), features: getFeatures(instance), }; }; const mapDispatchToProps = (dispatch) => ({ + onOpenUnauthorizedModal() { + dispatch(openModal('UNAUTHORIZED')); + }, onOpenReblogsModal(username, statusId) { dispatch(openModal('REBLOGS', { username, @@ -66,9 +71,10 @@ class StatusInteractionBar extends ImmutablePureComponent { } handleOpenReblogsModal = () => { - const { status, onOpenReblogsModal } = this.props; + const { me, status, onOpenUnauthorizedModal, onOpenReblogsModal } = this.props; - onOpenReblogsModal(status.getIn(['account', 'acct']), status.get('id')); + if (!me) onOpenUnauthorizedModal(); + else onOpenReblogsModal(status.getIn(['account', 'acct']), status.get('id')); } getReposts = () => { @@ -94,9 +100,10 @@ class StatusInteractionBar extends ImmutablePureComponent { } handleOpenFavouritesModal = () => { - const { status, onOpenFavouritesModal } = this.props; + const { me, status, onOpenUnauthorizedModal, onOpenFavouritesModal } = this.props; - onOpenFavouritesModal(status.getIn(['account', 'acct']), status.get('id')); + if (!me) onOpenUnauthorizedModal(); + else onOpenFavouritesModal(status.getIn(['account', 'acct']), status.get('id')); } getFavourites = () => { @@ -136,9 +143,10 @@ class StatusInteractionBar extends ImmutablePureComponent { } handleOpenReactionsModal = (reaction) => () => { - const { status, onOpenReactionsModal } = this.props; + const { me, status, onOpenUnauthorizedModal, onOpenReactionsModal } = this.props; - onOpenReactionsModal(status.getIn(['account', 'acct']), status.get('id'), reaction.get('name')); + if (!me) onOpenUnauthorizedModal(); + else onOpenReactionsModal(status.getIn(['account', 'acct']), status.get('id'), reaction.get('name')); } getEmojiReacts = () => { diff --git a/app/soapbox/features/ui/components/unauthorized_modal.js b/app/soapbox/features/ui/components/unauthorized_modal.js index 0e1429d8d..6a9a5e5df 100644 --- a/app/soapbox/features/ui/components/unauthorized_modal.js +++ b/app/soapbox/features/ui/components/unauthorized_modal.js @@ -146,9 +146,9 @@ class UnauthorizedModal extends ImmutablePureComponent { } render() { - const { intl, features, siteTitle } = this.props; + const { intl, features, siteTitle, action } = this.props; - if (features.remoteInteractionsAPI && features.federating) return this.renderRemoteInteractions(); + if (action && features.remoteInteractionsAPI && features.federating) return this.renderRemoteInteractions(); return (
diff --git a/app/styles/components/detailed-status.scss b/app/styles/components/detailed-status.scss index c6fcaa747..2defdcd3e 100644 --- a/app/styles/components/detailed-status.scss +++ b/app/styles/components/detailed-status.scss @@ -88,6 +88,7 @@ color: var(--primary-text-color--faint); text-decoration: none; font-size: 13px; + cursor: pointer; } .detailed-status__button {