about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-11-27 20:42:17 +0100
committerGitHub <noreply@github.com>2022-11-27 20:42:17 +0100
commitfe421257e5e9e3225393f544da0437596aa9a61b (patch)
tree311e0a61fa780a222ee46542b80ad07f2f45c2d2 /app
parent098ced7420065149feec732f979402afe2573d60 (diff)
Fix “Share @{name}'s profile” profile menu item (#21490)
Diffstat (limited to 'app')
-rw-r--r--app/javascript/mastodon/features/account/components/header.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/javascript/mastodon/features/account/components/header.js b/app/javascript/mastodon/features/account/components/header.js
index 1825e0de6..5eb89c0ea 100644
--- a/app/javascript/mastodon/features/account/components/header.js
+++ b/app/javascript/mastodon/features/account/components/header.js
@@ -149,6 +149,17 @@ class Header extends ImmutablePureComponent {
     }
   }
 
+  handleShare = () => {
+    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);
+    });
+  }
+
   render () {
     const { account, hidden, intl, domain } = this.props;
     const { signedIn } = this.context.identity;