Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add max description length as a capability #14145

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Antreesy marked this conversation as resolved.
Show resolved Hide resolved

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
Loading