fix(desktop/chatmessages) fixed stickers can't be used as reply

Closes #2404
This commit is contained in:
Alexandra Betouni 2021-08-17 16:28:10 +03:00 committed by Iuri Matias
parent a77cc682bb
commit f82a23e361
5 changed files with 11 additions and 9 deletions

View File

@ -207,7 +207,7 @@ QtObject:
self.recentStickers.addStickerToList(sticker)
self.recentStickersUpdated()
proc send*(self: StickersView, hash: string, pack: int) {.slot.} =
proc send*(self: StickersView, hash: string, replyTo: string, pack: int) {.slot.} =
let sticker = Sticker(hash: hash, packId: pack)
self.addRecentStickerToList(sticker)
self.status.chat.sendSticker(self.activeChannel.id, sticker)
self.status.chat.sendSticker(self.activeChannel.id, replyTo, sticker)

View File

@ -350,8 +350,8 @@ QtObject:
var response = status_chat.deleteMessageAndSend(messageId)
discard self.processMessageUpdateAfterSend(response, false)
proc sendSticker*(self: ChatModel, chatId: string, sticker: Sticker) =
var response = status_chat.sendStickerMessage(chatId, sticker)
proc sendSticker*(self: ChatModel, chatId: string, replyTo: string, sticker: Sticker) =
var response = status_chat.sendStickerMessage(chatId, replyTo, sticker)
self.events.emit("stickerSent", StickerArgs(sticker: sticker, save: true))
var (chats, messages) = self.processChatUpdate(parseJson(response))
self.events.emit("chatUpdate", ChatUpdateArgs(messages: messages, chats: chats, contacts: @[]))
@ -773,4 +773,4 @@ QtObject:
# notify view
self.events.emit("messagesLoaded", MsgsLoadedArgs(chatId: chatId, messages: messages))
self.events.emit("reactionsLoaded", ReactionsLoadedArgs(reactions: reactions))
self.events.emit("pinnedMessagesLoaded", MsgsLoadedArgs(chatId: chatId, messages: pinnedMessages))
self.events.emit("pinnedMessagesLoaded", MsgsLoadedArgs(chatId: chatId, messages: pinnedMessages))

View File

@ -181,13 +181,13 @@ proc sendImageMessages*(chatId: string, images: var seq[string]): string =
)
callPrivateRPC("sendChatMessages".prefix, %* [imagesJson])
proc sendStickerMessage*(chatId: string, sticker: Sticker): string =
proc sendStickerMessage*(chatId: string, replyTo: string, sticker: Sticker): string =
let preferredUsername = getSetting[string](Setting.PreferredUsername, "")
callPrivateRPC("sendChatMessage".prefix, %* [
{
"chatId": chatId,
"text": "Update to latest version to see a nice sticker here!",
"responseTo": nil,
"responseTo": replyTo,
"ensName": preferredUsername,
"sticker": {
"hash": sticker.hash,
@ -572,4 +572,4 @@ proc asyncSearchMessages*(chatId: string, searchTerm: string, caseSensitive: boo
result = callPrivateRPC("allChatMessagesWhichMatchTerm".prefix, %* [chatId, searchTerm, caseSensitive])
except RpcException as e:
success = false
result = e.msg
result = e.msg

View File

@ -442,7 +442,7 @@ Item {
txModalLoader.item.open()
}
onStickerSelected: {
chatsModel.stickers.send(hashId, packId)
chatsModel.stickers.send(hashId, chatInput.isReply ? SelectedMessage.messageId : "", packId)
}
onSendMessage: {
if (chatInput.fileUrls.length > 0){

View File

@ -24,6 +24,7 @@ Rectangle {
property bool paste: false;
property bool isColonPressed: false;
property bool isReply: false
property bool isImage: false
property bool isEdit: false
property bool isContactBlocked: false
@ -681,6 +682,7 @@ Rectangle {
stickerPackList: control.stickerPackList
onStickerSelected: {
control.stickerSelected(hashId, packId)
control.hideExtendedArea();
messageInputField.forceActiveFocus();
}
onClosed: {