aboutsummaryrefslogtreecommitdiff
path: root/src/components/status
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/status')
-rw-r--r--src/components/status/status.js15
-rw-r--r--src/components/status/status.vue4
2 files changed, 16 insertions, 3 deletions
diff --git a/src/components/status/status.js b/src/components/status/status.js
index f85b7847..f7b0357b 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')
}
},
diff --git a/src/components/status/status.vue b/src/components/status/status.vue
index d88428c7..45100a46 100644
--- a/src/components/status/status.vue
+++ b/src/components/status/status.vue
@@ -24,9 +24,9 @@
<div :class="[userClass, { highlighted: userStyle, 'is-retweet': retweet }]" :style="[ userStyle ]" class="media status">
<div v-if="!noHeading" class="media-left">
- <a :href="status.user.statusnet_profile_url" @click.stop.prevent.capture="toggleUserExpanded">
+ <router-link :to="userProfileLink" @click.stop.prevent.capture.native="toggleUserExpanded">
<StillImage class='avatar' :class="{'avatar-compact': compact, 'better-shadow': betterShadow}" :src="status.user.profile_image_url_original"/>
- </a>
+ </router-link>
</div>
<div class="status-body">
<div class="usercard media-body" v-if="userExpanded">