expand targeted comment by default

This commit is contained in:
Alina Beck 2019-10-15 15:44:22 +03:00
parent 597ca3029f
commit 134cea4e47

View File

@ -69,9 +69,14 @@ import scrollToAnchor from '~/mixins/scrollToAnchor.js'
export default { export default {
mixins: [scrollToAnchor], mixins: [scrollToAnchor],
data: function() { data() {
const anchor = `commentId-${this.comment.id}`
const isTarget = this.$route.hash === `#${anchor}`
return { return {
isCollapsed: true, anchor,
isTarget,
isCollapsed: !isTarget,
openEditCommentMenu: false, openEditCommentMenu: false,
} }
}, },
@ -96,9 +101,6 @@ export default {
user: 'auth/user', user: 'auth/user',
isModerator: 'auth/isModerator', isModerator: 'auth/isModerator',
}), }),
isTarget() {
return this.$route.hash === `#${this.anchor}`
},
isLongComment() { isLongComment() {
return this.$filters.removeHtml(this.comment.content).length > 180 return this.$filters.removeHtml(this.comment.content).length > 180
}, },
@ -109,9 +111,6 @@ export default {
return this.comment.content return this.comment.content
}, },
anchor() {
return `commentId-${this.comment.id}`
},
displaysComment() { displaysComment() {
return !this.unavailable || this.isModerator return !this.unavailable || this.isModerator
}, },