Merge pull request #1925 from Human-Connection/better-truncate-comments

Improved comment truncation
This commit is contained in:
Robert Schäfer 2019-10-17 12:21:43 +02:00 committed by GitHub
commit 56b7aa6d0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -60,6 +60,7 @@
<script>
import { mapGetters } from 'vuex'
import { COMMENT_MAX_UNTRUNCATED_LENGTH, COMMENT_TRUNCATE_TO_LENGTH } from '~/constants/comment'
import HcUser from '~/components/User/User'
import ContentMenu from '~/components/ContentMenu'
import ContentViewer from '~/components/Editor/ContentViewer'
@ -98,11 +99,11 @@ export default {
isModerator: 'auth/isModerator',
}),
isLongComment() {
return this.$filters.removeHtml(this.comment.content).length > 180
return this.$filters.removeHtml(this.comment.content).length > COMMENT_MAX_UNTRUNCATED_LENGTH
},
commentContent() {
if (this.isLongComment && this.isCollapsed) {
return this.$filters.truncate(this.comment.content, 180)
return this.$filters.truncate(this.comment.content, COMMENT_TRUNCATE_TO_LENGTH)
}
return this.comment.content

View File

@ -1 +1,3 @@
export const COMMENT_MIN_LENGTH = 1
export const COMMENT_MAX_UNTRUNCATED_LENGTH = 300
export const COMMENT_TRUNCATE_TO_LENGTH = 180