Skip to content

Commit

Permalink
fix: add max description length as a capability
Browse files Browse the repository at this point in the history
Signed-off-by: Dorra Jaouad <[email protected]>
  • Loading branch information
DorraJaouad committed Jan 16, 2025
1 parent f1343ee commit f9694ad
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/components/ConversationSettings/BasicInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
:loading="isDescriptionLoading"
:edit-button-aria-label="t('spreed', 'Edit conversation description')"
:placeholder="t('spreed', 'Enter a description for this conversation')"
:max-length="CONVERSATION.MAX_DESCRIPTION_LENGTH"
:max-length="maxDescriptionLength"
multiline
use-markdown
@submit-text="handleUpdateDescription"
Expand All @@ -53,9 +53,10 @@ import ConversationAvatarEditor from './ConversationAvatarEditor.vue'
import EditableTextField from '../UIShared/EditableTextField.vue'

import { CONVERSATION } from '../../constants.js'
import { hasTalkFeature } from '../../services/CapabilitiesManager.ts'
import { hasTalkFeature, getTalkConfig } from '../../services/CapabilitiesManager.ts'

const supportsAvatar = hasTalkFeature('local', 'avatar')
const maxDescriptionLength = getTalkConfig('local', 'conversations', 'description-length') || 500

export default {
name: 'BasicInfo',
Expand All @@ -82,6 +83,7 @@ export default {
return {
supportsAvatar,
CONVERSATION,
maxDescriptionLength
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ import LoadingComponent from '../LoadingComponent.vue'
import { useId } from '../../composables/useId.ts'
import { useIsInCall } from '../../composables/useIsInCall.js'
import { CONVERSATION } from '../../constants.js'
import { getTalkConfig } from '../../services/CapabilitiesManager.ts'
import { addParticipant } from '../../services/participantsService.js'
import { copyConversationLinkToClipboard } from '../../utils/handleUrl.ts'

Expand All @@ -135,7 +136,7 @@ const NEW_CONVERSATION = {
type: CONVERSATION.TYPE.GROUP,
isDummyConversation: true,
}

const maxDescriptionLength = getTalkConfig('local', 'conversations', 'description-length') || 500
export default {
name: 'NewConversationDialog',

Expand Down Expand Up @@ -205,7 +206,7 @@ export default {
disabled() {
return this.conversationName === '' || (this.newConversation.hasPassword && (this.password === '' || !this.isPasswordValid))
|| this.conversationName.length > CONVERSATION.MAX_NAME_LENGTH
|| this.newConversation.description.length > CONVERSATION.MAX_DESCRIPTION_LENGTH
|| this.newConversation.description.length > maxDescriptionLength
},

isFilled() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import generatePassword from '../../utils/generatePassword.ts'

const supportsAvatar = hasTalkFeature('local', 'avatar')
const forcePasswordProtection = getTalkConfig('local', 'conversations', 'force-passwords')
const maxDescriptionLength = getTalkConfig('local', 'conversations', 'description-length') || 500
export default {

name: 'NewConversationSetupPage',
Expand Down Expand Up @@ -143,10 +144,10 @@ export default {
},

descriptionErrorLabel() {
if (this.conversationDescription.length <= CONVERSATION.MAX_DESCRIPTION_LENGTH) {
if (this.conversationDescription.length <= maxDescriptionLength) {
return
}
return t('spreed', 'Maximum length exceeded ({maxlength} characters)', { maxlength: CONVERSATION.MAX_DESCRIPTION_LENGTH })
return t('spreed', 'Maximum length exceeded ({maxlength} characters)', { maxlength: maxDescriptionLength })
},

isPublic: {
Expand Down
1 change: 0 additions & 1 deletion src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export const CONVERSATION = {
},

MAX_NAME_LENGTH: 255,
MAX_DESCRIPTION_LENGTH: 500,
}

export const ATTENDEE = {
Expand Down

0 comments on commit f9694ad

Please sign in to comment.