mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Merge pull request #1925 from Human-Connection/better-truncate-comments
Improved comment truncation
This commit is contained in:
commit
56b7aa6d0a
@ -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
|
||||
|
||||
@ -1 +1,3 @@
|
||||
export const COMMENT_MIN_LENGTH = 1
|
||||
export const COMMENT_MAX_UNTRUNCATED_LENGTH = 300
|
||||
export const COMMENT_TRUNCATE_TO_LENGTH = 180
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user