From 1caa5ff39e95f01eb74ee71b76eaa6c0fd7309fd Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 24 May 2023 11:04:43 +0200 Subject: [PATCH] Change share action from being in action bar to being in dropdown in web UI (#25105) Co-authored-by: Claire --- .../mastodon/components/status_action_bar.jsx | 11 ++++------- .../features/account/components/header.jsx | 1 - .../features/status/components/action_bar.jsx | 14 ++++++-------- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/app/javascript/mastodon/components/status_action_bar.jsx b/app/javascript/mastodon/components/status_action_bar.jsx index 83c5ef0e4a..936a66080e 100644 --- a/app/javascript/mastodon/components/status_action_bar.jsx +++ b/app/javascript/mastodon/components/status_action_bar.jsx @@ -114,7 +114,6 @@ class StatusActionBar extends ImmutablePureComponent { handleShareClick = () => { navigator.share({ - text: this.props.status.get('search_index'), url: this.props.status.get('url'), }).catch((e) => { if (e.name !== 'AbortError') console.error(e); @@ -256,6 +255,10 @@ class StatusActionBar extends ImmutablePureComponent { menu.push({ text: intl.formatMessage(messages.copy), action: this.handleCopy }); + if (publicStatus && 'share' in navigator) { + menu.push({ text: intl.formatMessage(messages.share), action: this.handleShareClick }); + } + if (publicStatus) { menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed }); } @@ -352,10 +355,6 @@ class StatusActionBar extends ImmutablePureComponent { reblogTitle = intl.formatMessage(messages.cannot_reblog); } - const shareButton = ('share' in navigator) && publicStatus && ( - - ); - const filterButton = this.props.onFilter && ( ); @@ -367,8 +366,6 @@ class StatusActionBar extends ImmutablePureComponent { - {shareButton} - {filterButton}
diff --git a/app/javascript/mastodon/features/account/components/header.jsx b/app/javascript/mastodon/features/account/components/header.jsx index 6ebb29ab20..e9e5934f46 100644 --- a/app/javascript/mastodon/features/account/components/header.jsx +++ b/app/javascript/mastodon/features/account/components/header.jsx @@ -165,7 +165,6 @@ class Header extends ImmutablePureComponent { const { account } = this.props; navigator.share({ - text: `${titleFromAccount(account)}\n${account.get('note_plain')}`, url: account.get('url'), }).catch((e) => { if (e.name !== 'AbortError') console.error(e); diff --git a/app/javascript/mastodon/features/status/components/action_bar.jsx b/app/javascript/mastodon/features/status/components/action_bar.jsx index bc5aed4429..bd565c72c6 100644 --- a/app/javascript/mastodon/features/status/components/action_bar.jsx +++ b/app/javascript/mastodon/features/status/components/action_bar.jsx @@ -169,7 +169,6 @@ class ActionBar extends PureComponent { handleShare = () => { navigator.share({ - text: this.props.status.get('search_index'), url: this.props.status.get('url'), }); }; @@ -202,6 +201,11 @@ class ActionBar extends PureComponent { } menu.push({ text: intl.formatMessage(messages.copy), action: this.handleCopy }); + + if ('share' in navigator) { + menu.push({ text: intl.formatMessage(messages.share), action: this.handleShare }); + } + menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed }); menu.push(null); } @@ -260,10 +264,6 @@ class ActionBar extends PureComponent { } } - const shareButton = ('share' in navigator) && publicStatus && ( -
- ); - let replyIcon; if (status.get('in_reply_to_id', null) === null) { replyIcon = 'reply'; @@ -287,12 +287,10 @@ class ActionBar extends PureComponent { return (
-
+
- {shareButton} -