fix(emoji-icon): fix emoji icon position and saving on edit
Fixes #5045
This commit is contained in:
parent
8f996992b2
commit
a20686324e
|
@ -47,7 +47,12 @@ StatusModal {
|
||||||
header.title = qsTrId("edit---1").arg(popup.channelName);
|
header.title = qsTrId("edit---1").arg(popup.channelName);
|
||||||
contentItem.channelName.input.text = popup.channelName
|
contentItem.channelName.input.text = popup.channelName
|
||||||
contentItem.channelDescription.input.text = popup.channelDescription
|
contentItem.channelDescription.input.text = popup.channelDescription
|
||||||
|
if (popup.channelEmoji) {
|
||||||
contentItem.channelName.input.icon.emoji = popup.channelEmoji
|
contentItem.channelName.input.icon.emoji = popup.channelEmoji
|
||||||
|
} else {
|
||||||
|
// Assign a random emoji to channels who down't have one (from old versions)
|
||||||
|
contentItem.channelName.input.icon.emoji = StatusQUtils.Emoji.getRandomEmoji()
|
||||||
|
}
|
||||||
scrollView.channelColorDialog.color = popup.channelColor
|
scrollView.channelColorDialog.color = popup.channelColor
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -274,17 +279,24 @@ StatusModal {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let error = "";
|
let error = "";
|
||||||
|
let emoji = popup.contentItem.channelName.input.icon.emoji
|
||||||
|
// Extract the UTF emoji from the `img` tag so that we only store the emoi and not the full image
|
||||||
|
const found = RegExp(emojiRegexStr, 'g').exec(emoji);
|
||||||
|
if (found) {
|
||||||
|
emoji = found[1]
|
||||||
|
}
|
||||||
|
|
||||||
if (!isEdit) {
|
if (!isEdit) {
|
||||||
//popup.contentItem.communityColor.color.toString().toUpperCase()
|
//popup.contentItem.communityColor.color.toString().toUpperCase()
|
||||||
popup.createCommunityChannel(Utils.filterXSS(popup.contentItem.channelName.input.text),
|
popup.createCommunityChannel(Utils.filterXSS(popup.contentItem.channelName.input.text),
|
||||||
Utils.filterXSS(popup.contentItem.channelDescription.input.text),
|
Utils.filterXSS(popup.contentItem.channelDescription.input.text),
|
||||||
popup.contentItem.channelName.input.icon.emoji,
|
emoji,
|
||||||
popup.contentItem.channelColorDialog.color.toString().toUpperCase(),
|
popup.contentItem.channelColorDialog.color.toString().toUpperCase(),
|
||||||
popup.categoryId)
|
popup.categoryId)
|
||||||
} else {
|
} else {
|
||||||
popup.editCommunityChannel(Utils.filterXSS(popup.contentItem.channelName.input.text),
|
popup.editCommunityChannel(Utils.filterXSS(popup.contentItem.channelName.input.text),
|
||||||
Utils.filterXSS(popup.contentItem.channelDescription.input.text),
|
Utils.filterXSS(popup.contentItem.channelDescription.input.text),
|
||||||
popup.contentItem.channelName.input.icon.emoji,
|
emoji,
|
||||||
popup.contentItem.channelColorDialog.color.toString().toUpperCase(),
|
popup.contentItem.channelColorDialog.color.toString().toUpperCase(),
|
||||||
popup.categoryId)
|
popup.categoryId)
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ StatusPopupMenu {
|
||||||
StatusMenuItem {
|
StatusMenuItem {
|
||||||
text: qsTr("Edit name and image")
|
text: qsTr("Edit name and image")
|
||||||
icon.name: "edit"
|
icon.name: "edit"
|
||||||
enabled: (root.isCommunityChat ||root.chatType === Constants.chatType.privateGroupChat)
|
enabled: root.chatType === Constants.chatType.privateGroupChat
|
||||||
&& root.amIChatAdmin
|
&& root.amIChatAdmin
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
Global.openPopup(editChannelPopup, {
|
Global.openPopup(editChannelPopup, {
|
||||||
|
|
Loading…
Reference in New Issue