fix(Communities): make creating channels work again
There was a breaking change introduced 8d32c1d933
which caused reference errors in various modals.
This commit fixes the modal to create and edit community channels
by ensuring we're accessing `contentItem` and also only setting
channel data when editing a channel.
Closes #3390
This commit is contained in:
parent
5a448abfd5
commit
942965f13b
|
@ -26,23 +26,23 @@ StatusModal {
|
||||||
header.title: qsTrId("create-channel-title")
|
header.title: qsTrId("create-channel-title")
|
||||||
|
|
||||||
onOpened: {
|
onOpened: {
|
||||||
contentComponent.channelId = channel.id
|
contentItem.channelName.input.text = ""
|
||||||
contentComponent.channelCategoryId = channel.categoryId
|
contentItem.channelName.input.forceActiveFocus(Qt.MouseFocusReason)
|
||||||
contentComponent.channelName.input.text = ""
|
|
||||||
if (isEdit) {
|
if (isEdit) {
|
||||||
//% "Edit #%1"
|
//% "Edit #%1"
|
||||||
header.title = qsTrId("edit---1").arg(channel.name);
|
header.title = qsTrId("edit---1").arg(channel.name);
|
||||||
contentComponent.channelName.input.text = channel.name
|
contentItem.channelId = channel.id
|
||||||
|
contentItem.channelCategoryId = channel.categoryId
|
||||||
|
contentItem.channelName.input.text = channel.name
|
||||||
|
contentItem.channelDescription.input.text = channel.description
|
||||||
}
|
}
|
||||||
contentComponent.channelName.input.forceActiveFocus(Qt.MouseFocusReason)
|
|
||||||
contentComponent.channelDescription.input.text = channel.description
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onClosed: destroy()
|
onClosed: destroy()
|
||||||
|
|
||||||
function isFormValid() {
|
function isFormValid() {
|
||||||
return contentComponent.channelName.valid &&
|
return contentItem.channelName.valid &&
|
||||||
contentComponent.channelDescription.valid
|
contentItem.channelDescription.valid
|
||||||
}
|
}
|
||||||
|
|
||||||
contentItem: ScrollView {
|
contentItem: ScrollView {
|
||||||
|
@ -154,6 +154,11 @@ StatusModal {
|
||||||
/* text: qsTrId("limit-channel-members-to-sending-one-message-per-chose-time-interval") */
|
/* text: qsTrId("limit-channel-members-to-sending-one-message-per-chose-time-interval") */
|
||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
|
Item {
|
||||||
|
width: parent.width
|
||||||
|
height: 8
|
||||||
|
}
|
||||||
|
|
||||||
StatusListItem {
|
StatusListItem {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
//% "Pinned messages"
|
//% "Pinned messages"
|
||||||
|
@ -171,8 +176,9 @@ StatusModal {
|
||||||
sensor.onClicked: openPopup(pinnedMessagesPopupComponent)
|
sensor.onClicked: openPopup(pinnedMessagesPopupComponent)
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusModalDivider {
|
Item {
|
||||||
topPadding: 8
|
width: parent.width
|
||||||
|
height: 8
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,18 +199,18 @@ StatusModal {
|
||||||
let error = "";
|
let error = "";
|
||||||
if (!isEdit) {
|
if (!isEdit) {
|
||||||
error = chatsModel.createCommunityChannel(communityId,
|
error = chatsModel.createCommunityChannel(communityId,
|
||||||
Utils.filterXSS(popup.contentComponent.channelName.input.text),
|
Utils.filterXSS(popup.contentItem.channelName.input.text),
|
||||||
Utils.filterXSS(popup.contentComponent.channelDescription.input.text),
|
Utils.filterXSS(popup.contentItem.channelDescription.input.text),
|
||||||
categoryId)
|
categoryId)
|
||||||
// TODO: pass the private value when private channels
|
// TODO: pass the private value when private channels
|
||||||
// are implemented
|
// are implemented
|
||||||
//privateSwitch.checked)
|
//privateSwitch.checked)
|
||||||
} else {
|
} else {
|
||||||
error = chatsModel.editCommunityChannel(communityId,
|
error = chatsModel.editCommunityChannel(communityId,
|
||||||
popup.contentComponent.channelId,
|
popup.contentItem.channelId,
|
||||||
Utils.filterXSS(popup.contentComponent.channelName.input.text),
|
Utils.filterXSS(popup.contentItem.channelName.input.text),
|
||||||
Utils.filterXSS(popup.contentComponent.channelDescription.input.text),
|
Utils.filterXSS(popup.contentItem.channelDescription.input.text),
|
||||||
popup.contentComponent.channelCategoryId)
|
popup.contentItem.channelCategoryId)
|
||||||
// TODO: pass the private value when private channels
|
// TODO: pass the private value when private channels
|
||||||
// are implemented
|
// are implemented
|
||||||
//privateSwitch.checked)
|
//privateSwitch.checked)
|
||||||
|
|
Loading…
Reference in New Issue