Skip to content
Snippets Groups Projects
Commit 9ff8bf4c authored by lain's avatar lain
Browse files

Make mention strings work.

parent 7e2c52b1
No related branches found
No related tags found
No related merge requests found
import statusPoster from '../../services/status_poster/status_poster.service.js'
import { reject, map, uniqBy } from 'lodash';
const buildMentionsString = ({user, attentions}, currentUser) => {
let allAttentions = [...attentions]
allAttentions.unshift(user)
allAttentions = uniqBy(allAttentions, 'id')
allAttentions = reject(allAttentions, {id: currentUser.id})
let mentions = map(allAttentions, (attention) => {
return `@${attention.screen_name}`
})
return mentions.join(' ') + ' '
}
const PostStatusForm = {
props: [
'replyTo'
'replyTo',
'repliedUser',
'attentions'
],
data () {
let statusText = ''
if (this.replyTo) {
const currentUser = this.$store.state.users.currentUser
statusText = buildMentionsString({ user: this.repliedUser, attentions: this.attentions }, currentUser)
}
return {
newStatus: { }
newStatus: {
status: statusText
}
}
},
methods: {
......
......@@ -45,7 +45,7 @@
<favorite-button :status=status></favorite-button>
</div>
<post-status-form v-if="replying" :reply-to="status.id"></post-status-form>
<post-status-form v-if="replying" :reply-to="status.id" :attentions="status.attentions" :repliedUser="status.user"></post-status-form>
</div>
</div>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment