diff options
| author | lambda <pleromagit@rogerbraun.net> | 2019-01-30 17:46:18 +0000 |
|---|---|---|
| committer | lambda <pleromagit@rogerbraun.net> | 2019-01-30 17:46:18 +0000 |
| commit | 7b0e3dc471ea731ec199de548e1f6849953a6447 (patch) | |
| tree | aeff2355215397c23b18b9fe3549b5b3e7c92ca0 /src/components/status/status.js | |
| parent | 886aa35eb6e6a5b5578a6fb8b67a4593073960a3 (diff) | |
| parent | 15603981f8309d979465c40175f9b3cd4f6617b4 (diff) | |
Merge branch 'feat/make-mentions-use-internal-routing' into 'develop'
Fix #289 Make more user links use internal routing
Closes #289
See merge request pleroma/pleroma-fe!500
Diffstat (limited to 'src/components/status/status.js')
| -rw-r--r-- | src/components/status/status.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/components/status/status.js b/src/components/status/status.js index 558125df..e268ddaa 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -9,6 +9,7 @@ import LinkPreview from '../link-preview/link-preview.vue' import { filter, find } from 'lodash' import { highlightClass, highlightStyle } from '../../services/user_highlighter/user_highlighter.js' import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' +import { mentionMatchesUrl } from 'src/services/mention_matcher/mention_matcher.js' const Status = { name: 'Status', @@ -237,11 +238,23 @@ const Status = { return 'icon-globe' } }, - linkClicked ({target}) { + linkClicked (event) { + let { target } = event if (target.tagName === 'SPAN') { target = target.parentNode } if (target.tagName === 'A') { + if (target.className.match(/mention/)) { + const href = target.getAttribute('href') + const attn = this.status.attentions.find(attn => mentionMatchesUrl(attn, href)) + if (attn) { + event.stopPropagation() + event.preventDefault() + const link = this.generateUserProfileLink(attn.id, attn.screen_name) + this.$router.push(link) + return + } + } window.open(target.href, '_blank') } }, |
