Skip to content

Commit

Permalink
fixup! feat(NewConversation): implement forcing password protection
Browse files Browse the repository at this point in the history
  • Loading branch information
DorraJaouad committed Dec 6, 2024
1 parent f3ab0a4 commit 36f5ab2
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/store/conversationsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ const actions = {
}
},

async toggleGuests({ commit, getters }, { token, allowGuests, password = '' }) {
async toggleGuests({ commit, getters }, { token, allowGuests, password }) {
if (!getters.conversations[token]) {
return
}
Expand Down Expand Up @@ -999,18 +999,17 @@ const actions = {
*/
async createGroupConversation(context, { conversationName, isPublic, password }) {
try {

let response
if (isPublic) {
if (supportConversationCreationPassword && forcePasswordProtection) {
if (!password) {
throw new Error(t('spreed', 'Password is required'))
throw new Error('password_required')
}
response = await createPublicConversation(conversationName, password)
} else {
response = await createPublicConversation(conversationName)
if (password) {
await setConversationPassword(response.data.ocs.data.token, password)
response = await setConversationPassword(response.data.ocs.data.token, password)
}
}
} else {
Expand All @@ -1021,8 +1020,7 @@ const actions = {
context.dispatch('addConversation', conversation)
return conversation.token
} catch (error) {
console.error('Error creating new group conversation: ', error)
return ''
return Promise.reject(error)
}
},

Expand Down

0 comments on commit 36f5ab2

Please sign in to comment.