aboutsummaryrefslogtreecommitdiff
path: root/src/components/status/status.js
diff options
context:
space:
mode:
authorShpuld Shpludson <shp@cock.li>2019-02-11 04:19:17 +0000
committerShpuld Shpludson <shp@cock.li>2019-02-11 04:19:17 +0000
commite1e9e50b981fe6507886cae26603e4fcf9b5af75 (patch)
treea3432858e377093f11236d1c6400b867855c76f0 /src/components/status/status.js
parent4bea3c525f377a45919893ae0a474859b5744820 (diff)
parentbe77707381609e555c565f6ba187318562e57dcf (diff)
Merge branch 'fix/hashtag-opening' into 'develop'
Open hashtag in same tab See merge request pleroma/pleroma-fe!540
Diffstat (limited to 'src/components/status/status.js')
-rw-r--r--src/components/status/status.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/components/status/status.js b/src/components/status/status.js
index 1e2b8794..06e4fe93 100644
--- a/src/components/status/status.js
+++ b/src/components/status/status.js
@@ -10,7 +10,7 @@ import LinkPreview from '../link-preview/link-preview.vue'
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
import fileType from 'src/services/file_type/file_type.service'
import { highlightClass, highlightStyle } from '../../services/user_highlighter/user_highlighter.js'
-import { mentionMatchesUrl } from 'src/services/mention_matcher/mention_matcher.js'
+import { mentionMatchesUrl, extractTagFromUrl } from 'src/services/matcher/matcher.service.js'
import { filter, find, unescape } from 'lodash'
const Status = {
@@ -282,7 +282,7 @@ const Status = {
}
if (target.tagName === 'A') {
if (target.className.match(/mention/)) {
- const href = target.getAttribute('href')
+ const href = target.href
const attn = this.status.attentions.find(attn => mentionMatchesUrl(attn, href))
if (attn) {
event.stopPropagation()
@@ -292,7 +292,14 @@ const Status = {
return
}
}
- window.open(target.href, '_blank')
+ if (target.className.match(/hashtag/)) {
+ // Extract tag name from link url
+ const tag = extractTagFromUrl(target.href)
+ if (tag) {
+ const link = this.generateTagLink(tag)
+ this.$router.push(link)
+ }
+ }
}
},
toggleReplying () {
@@ -348,6 +355,9 @@ const Status = {
generateUserProfileLink (id, name) {
return generateProfileLink(id, name, this.$store.state.instance.restrictedNicknames)
},
+ generateTagLink (tag) {
+ return `/tag/${tag}`
+ },
setMedia () {
const attachments = this.attachmentSize === 'hide' ? this.status.attachments : this.galleryAttachments
return () => this.$store.dispatch('setMedia', attachments)