fix(Communities): preserve channel position after editing

Turns out we've been accidentally resetting the channel's `position`
property to `0` by not sending it over to status-lib's underlying
`editCommunityChat` API.

This fixes it by using a newer version of status-lib which supports
the `position` paramter in `editCommunityChat` and then sending that
value along from the edit channel popup.

Fixes #3672
This commit is contained in:
Pascal Precht 2021-10-08 12:27:08 +02:00 committed by Pascal Precht
parent abf2a46dc9
commit b8ecc3e0bf
3 changed files with 11 additions and 9 deletions

View File

@ -420,9 +420,9 @@ QtObject:
error "Error creating channel", msg=e.msg, name, description
result = StatusGoError(error: e.msg).toJson
proc editCommunityChannel*(self: ChatsView, communityId: string, channelId: string, name: string, description: string, categoryId: string): string {.slot.} =
proc editCommunityChannel*(self: ChatsView, communityId: string, channelId: string, name: string, description: string, categoryId: string, position: int): string {.slot.} =
try:
let chat = self.status.chat.editCommunityChannel(communityId, channelId, name, description, categoryId)
let chat = self.status.chat.editCommunityChannel(communityId, channelId, name, description, categoryId, position)
chat.categoryId = categoryId
self.communities.joinedCommunityList.replaceChannelInCommunity(communityId, chat)

View File

@ -1,8 +1,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.3
import QtQuick.Dialogs 1.3
import utils 1.0
import utils 0.1
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
@ -17,6 +16,7 @@ StatusModal {
property QtObject channel
property bool isEdit: false
property string categoryId: ""
property var position: null
readonly property int maxChannelNameLength: 30
readonly property int maxChannelDescLength: 140
@ -36,6 +36,7 @@ StatusModal {
contentItem.channelCategoryId = channel.categoryId
contentItem.channelName.input.text = channel.name
contentItem.channelDescription.input.text = channel.description
position = channel.position
}
}
@ -82,7 +83,7 @@ StatusModal {
}
validators: [StatusMinLengthValidator {
minLength: 1
errorMessage: Utils.getErrorMessage(nameInput.errors, qsTr("channel name"))
errorMessage: Utils.getErrorMessage(errors, qsTr("channel name"))
}]
}
@ -101,7 +102,7 @@ StatusModal {
input.implicitHeight: 88
validators: [StatusMinLengthValidator {
minLength: 1
errorMessage: Utils.getErrorMessage(descriptionTextArea.errors, qsTr("channel description"))
errorMessage: Utils.getErrorMessage(errors, qsTr("channel description"))
}]
}
@ -215,7 +216,8 @@ StatusModal {
popup.contentItem.channelId,
Utils.filterXSS(popup.contentItem.channelName.input.text),
Utils.filterXSS(popup.contentItem.channelDescription.input.text),
popup.contentItem.channelCategoryId)
popup.contentItem.channelCategoryId,
popup.position)
// TODO: pass the private value when private channels
// are implemented
//privateSwitch.checked)

2
vendor/status-lib vendored

@ -1 +1 @@
Subproject commit c0502a7bd426a6f647190d43cdbf03cef71b9c7b
Subproject commit 72a32ee72549e44d14d28a430a75a09078efc7e3