fix(Communities): make creating communities work again

This was broken due to a breaking change in StatusQ dependency.

Fixes #3389
This commit is contained in:
Pascal Precht 2021-09-07 15:28:38 +02:00 committed by RichΛrd
parent 942965f13b
commit 51c4d8c64e
1 changed files with 26 additions and 26 deletions

View File

@ -26,22 +26,22 @@ StatusModal {
onOpened: { onOpened: {
if (isEdit) { if (isEdit) {
contentComponent.communityName.input.text = community.name; contentItem.communityName.input.text = community.name;
contentComponent.communityDescription.input.text = community.description; contentItem.communityDescription.input.text = community.description;
contentComponent.communityColor.color = community.communityColor; contentItem.communityColor.color = community.communityColor;
contentComponent.communityColor.colorSelected = true contentItem.communityColor.colorSelected = true
if (community.largeImage) { if (community.largeImage) {
contentComponent.communityImage.selectedImage = community.largeImage contentItem.communityImage.selectedImage = community.largeImage
} }
membershipRequirementSettingPopup.checkedMembership = community.access membershipRequirementSettingPopup.checkedMembership = community.access
} }
contentComponent.communityName.input.forceActiveFocus(Qt.MouseFocusReason) contentItem.communityName.input.forceActiveFocus(Qt.MouseFocusReason)
} }
onClosed: destroy() onClosed: destroy()
function isFormValid() { function isFormValid() {
return contentComponent.communityName.valid && contentComponent.communityDescription.valid && return contentItem.communityName.valid && contentItem.communityDescription.valid &&
Utils.validateAndReturnError(contentComponent.communityColor.color.toString().toUpperCase(), Utils.validateAndReturnError(contentItem.communityColor.color.toString().toUpperCase(),
communityColorValidator) === "" communityColorValidator) === ""
} }
@ -394,7 +394,7 @@ StatusModal {
qsTrId("create") qsTrId("create")
onClicked: { onClicked: {
if (!isFormValid()) { if (!isFormValid()) {
popup.contentComponent.scrollBackUp() popup.contentItem.scrollBackUp()
return return
} }
@ -402,31 +402,31 @@ StatusModal {
if(isEdit) { if(isEdit) {
error = chatsModel.communities.editCommunity( error = chatsModel.communities.editCommunity(
community.id, community.id,
Utils.filterXSS(popup.contentComponent.communityName.input.text), Utils.filterXSS(popup.contentItem.communityName.input.text),
Utils.filterXSS(popup.contentComponent.communityDescription.input.text), Utils.filterXSS(popup.contentItem.communityDescription.input.text),
membershipRequirementSettingPopup.checkedMembership, membershipRequirementSettingPopup.checkedMembership,
false, false,
popup.contentComponent.communityColor.color.toString().toUpperCase(), popup.contentItem.communityColor.color.toString().toUpperCase(),
// to retain the existing image, pass "" for the image path // to retain the existing image, pass "" for the image path
popup.contentComponent.communityImage.selectedImage === community.largeImage ? "" : popup.contentItem.communityImage.selectedImage === community.largeImage ? "" :
popup.contentComponent.communityImage.selectedImage, popup.contentItem.communityImage.selectedImage,
popup.contentComponent.imageCropperModal.aX, popup.contentItem.imageCropperModal.aX,
popup.contentComponent.imageCropperModal.aY, popup.contentItem.imageCropperModal.aY,
popup.contentComponent.imageCropperModal.bX, popup.contentItem.imageCropperModal.bX,
popup.contentComponent.imageCropperModal.bY popup.contentItem.imageCropperModal.bY
) )
} else { } else {
error = chatsModel.communities.createCommunity( error = chatsModel.communities.createCommunity(
Utils.filterXSS(popup.contentComponent.communityName.input.text), Utils.filterXSS(popup.contentItem.communityName.input.text),
Utils.filterXSS(popup.contentComponent.communityDescription.input.text), Utils.filterXSS(popup.contentItem.communityDescription.input.text),
membershipRequirementSettingPopup.checkedMembership, membershipRequirementSettingPopup.checkedMembership,
false, // ensOnlySwitch.switchChecked, // TODO: false, // ensOnlySwitch.switchChecked, // TODO:
popup.contentComponent.communityColor.color.toString().toUpperCase(), popup.contentItem.communityColor.color.toString().toUpperCase(),
popup.contentComponent.communityImage.selectedImage, popup.contentItem.communityImage.selectedImage,
popup.contentComponent.imageCropperModal.aX, popup.contentItem.imageCropperModal.aX,
popup.contentComponent.imageCropperModal.aY, popup.contentItem.imageCropperModal.aY,
popup.contentComponent.imageCropperModal.bX, popup.contentItem.imageCropperModal.bX,
popup.contentComponent.imageCropperModal.bY popup.contentItem.imageCropperModal.bY
) )
} }