upstream_changes #11

Merged
medvedych merged 5 commits from upstream_changes into master 2023-11-20 00:54:47 +03:00
7 changed files with 16 additions and 14 deletions
Showing only changes of commit b032b32db1 - Show all commits

View file

@ -40,7 +40,7 @@ Loader {
property string chatId property string chatId
property string userName property string userName
property bool userNameIsValid: userName !== "" && inlineBotInformation && userName.toLowerCase() === inlineBotInformation.username.toLowerCase() property bool userNameIsValid: userName !== "" && inlineBotInformation && userName.toLowerCase() === inlineBotInformation.usernames.editable_username.toLowerCase()
property string query property string query
property int currentOffset: 0 property int currentOffset: 0
property string responseExtra: chatId+"|"+userName+"|"+query+"|"+currentOffset property string responseExtra: chatId+"|"+userName+"|"+query+"|"+currentOffset

View file

@ -31,12 +31,12 @@ Loader {
property var botUserInformation: tdLibWrapper.getUserInformation(message.via_bot_user_id) property var botUserInformation: tdLibWrapper.getUserInformation(message.via_bot_user_id)
color: Theme.secondaryColor color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeExtraSmall font.pixelSize: Theme.fontSizeExtraSmall
text: qsTr("via %1", "message posted via bot user").arg("<a style=\"text-decoration: none; font-weight: bold; color:"+Theme.primaryColor+"\" href=\"userId://" + message.via_bot_user_id + "\">@" + Emoji.emojify(botUserInformation.username, font.pixelSize)+"</a>") text: qsTr("via %1", "message posted via bot user").arg("<a style=\"text-decoration: none; font-weight: bold; color:"+Theme.primaryColor+"\" href=\"userId://" + message.via_bot_user_id + "\">@" + Emoji.emojify(botUserInformation.usernames.editable_username, font.pixelSize)+"</a>")
textFormat: Text.RichText textFormat: Text.RichText
truncationMode: TruncationMode.Fade truncationMode: TruncationMode.Fade
onLinkActivated: { onLinkActivated: {
if(link === "userId://" + message.via_bot_user_id && botUserInformation.type.is_inline) { if(link === "userId://" + message.via_bot_user_id && botUserInformation.type.is_inline) {
newMessageTextField.text = "@"+botUserInformation.username+" " newMessageTextField.text = "@"+botUserInformation.usernames.editable_username+" "
newMessageTextField.cursorPosition = newMessageTextField.text.length newMessageTextField.cursorPosition = newMessageTextField.text.length
lostFocusTimer.start(); lostFocusTimer.start();
} }

View file

@ -60,12 +60,12 @@ Column {
}, },
inlineKeyboardButtonTypeSwitchInline: function() { inlineKeyboardButtonTypeSwitchInline: function() {
if(modelData.type.in_current_chat) { if(modelData.type.in_current_chat) {
chatPage.setMessageText("@" + userInformation.username + " "+(modelData.type.query || "")) chatPage.setMessageText("@" + userInformation.usernames.editable_username + " "+(modelData.type.query || ""))
} else { } else {
pageStack.push(Qt.resolvedUrl("../pages/ChatSelectionPage.qml"), { pageStack.push(Qt.resolvedUrl("../pages/ChatSelectionPage.qml"), {
myUserId: chatPage.myUserId, myUserId: chatPage.myUserId,
payload: { neededPermissions: ["can_send_other_messages"], text:"@" + userInformation.username + " "+(modelData.type.query || "")}, payload: { neededPermissions: ["can_send_other_messages"], text:"@" + userInformation.usernames.editable_username + " "+(modelData.type.query || "")},
state: "fillTextArea" state: "fillTextArea"
}) })
} }

View file

@ -300,8 +300,8 @@ SilicaFlickable {
} }
leftMargin: imageContainer.getEased((imageContainer.minDimension + Theme.paddingMedium), 0, imageContainer.tweenFactor) + Theme.horizontalPageMargin leftMargin: imageContainer.getEased((imageContainer.minDimension + Theme.paddingMedium), 0, imageContainer.tweenFactor) + Theme.horizontalPageMargin
title: chatInformationPage.chatInformation.title !== "" ? Emoji.emojify(chatInformationPage.chatInformation.title, Theme.fontSizeLarge) : qsTr("Unknown") title: chatInformationPage.chatInformation.title !== "" ? Emoji.emojify(chatInformationPage.chatInformation.title, Theme.fontSizeLarge) : qsTr("Unknown")
description: ((chatInformationPage.isPrivateChat || chatInformationPage.isSecretChat) && chatInformationPage.privateChatUserInformation.username) description: ((chatInformationPage.isPrivateChat || chatInformationPage.isSecretChat) && chatInformationPage.privateChatUserInformation.usernames.editable_username)
? ("@"+chatInformationPage.privateChatUserInformation.username) : "" ? ("@"+chatInformationPage.privateChatUserInformation.usernames.editable_username) : ""
} }
SilicaFlickable { SilicaFlickable {

View file

@ -27,7 +27,7 @@ MessageContentBase {
property var stickerData: messageListItem ? messageListItem.myMessage.content.sticker : overlayFlickable.overlayMessage.content.sticker; property var stickerData: messageListItem ? messageListItem.myMessage.content.sticker : overlayFlickable.overlayMessage.content.sticker;
readonly property bool asEmoji: appSettings.showStickersAsEmojis readonly property bool asEmoji: appSettings.showStickersAsEmojis
readonly property bool animated: stickerData.type["@type"] === "stickerTypeAnimated" && appSettings.animateStickers readonly property bool animated: stickerData.format["@type"] === "stickerFormatTgs" && appSettings.animateStickers
readonly property bool stickerVisible: staticStickerLoader.item ? staticStickerLoader.item.visible : readonly property bool stickerVisible: staticStickerLoader.item ? staticStickerLoader.item.visible :
animatedStickerLoader.item ? animatedStickerLoader.item.visible : false animatedStickerLoader.item ? animatedStickerLoader.item.visible : false
readonly property bool isOwnSticker : messageListItem ? messageListItem.isOwnMessage : overlayFlickable.isOwnMessage readonly property bool isOwnSticker : messageListItem ? messageListItem.isOwnMessage : overlayFlickable.isOwnMessage

View file

@ -56,10 +56,10 @@ QVariant KnownUsersModel::data(const QModelIndex &index, int role) const
case KnownUserRole::RoleDisplay: return requestedUser; case KnownUserRole::RoleDisplay: return requestedUser;
case KnownUserRole::RoleUserId: return requestedUser.value("id"); case KnownUserRole::RoleUserId: return requestedUser.value("id");
case KnownUserRole::RoleTitle: return QString(requestedUser.value("first_name").toString() + " " + requestedUser.value("last_name").toString()).trimmed(); case KnownUserRole::RoleTitle: return QString(requestedUser.value("first_name").toString() + " " + requestedUser.value("last_name").toString()).trimmed();
case KnownUserRole::RoleUsername: return requestedUser.value("username"); case KnownUserRole::RoleUsername: return requestedUser.value("usernames").toMap().value("editable_username").toString();
case KnownUserRole::RoleUserHandle: return QString("@" + (requestedUser.value("username").toString().isEmpty() ? requestedUser.value("id").toString() : requestedUser.value("username").toString())); case KnownUserRole::RoleUserHandle: return QString("@" + (requestedUser.value("usernames").toMap().value("editable_username").toString().isEmpty() ? requestedUser.value("id").toString() : requestedUser.value("usernames").toMap().value("editable_username").toString()));
case KnownUserRole::RolePhotoSmall: return requestedUser.value("profile_photo").toMap().value("small"); case KnownUserRole::RolePhotoSmall: return requestedUser.value("profile_photo").toMap().value("small");
case KnownUserRole::RoleFilter: return QString(requestedUser.value("first_name").toString() + " " + requestedUser.value("last_name").toString() + " " + requestedUser.value("username").toString()).trimmed(); case KnownUserRole::RoleFilter: return QString(requestedUser.value("first_name").toString() + " " + requestedUser.value("last_name").toString() + " " + requestedUser.value("usernames").toMap().value("editable_username").toString()).trimmed();
} }
} }
return QVariant(); return QVariant();

View file

@ -48,6 +48,8 @@ namespace {
const QString LAST_NAME("last_name"); const QString LAST_NAME("last_name");
const QString FIRST_NAME("first_name"); const QString FIRST_NAME("first_name");
const QString USERNAME("username"); const QString USERNAME("username");
const QString USERNAMES("usernames");
const QString EDITABLE_USERNAME("editable_username");
const QString THREAD_ID("thread_id"); const QString THREAD_ID("thread_id");
const QString VALUE("value"); const QString VALUE("value");
const QString CHAT_LIST_TYPE("chat_list_type"); const QString CHAT_LIST_TYPE("chat_list_type");
@ -1829,9 +1831,9 @@ void TDLibWrapper::handleUserUpdated(const QVariantMap &userInformation)
this->userInformation = userInformation; this->userInformation = userInformation;
emit ownUserUpdated(userInformation); emit ownUserUpdated(userInformation);
} }
LOG("User information updated:" << userInformation.value(USERNAME).toString() << userInformation.value(FIRST_NAME).toString() << userInformation.value(LAST_NAME).toString()); LOG("User information updated:" << userInformation.value(USERNAMES).toMap().value(EDITABLE_USERNAME).toString() << userInformation.value(FIRST_NAME).toString() << userInformation.value(LAST_NAME).toString());
this->allUsers.insert(updatedUserId, userInformation); this->allUsers.insert(updatedUserId, userInformation);
this->allUserNames.insert(userInformation.value(USERNAME).toString(), userInformation); this->allUserNames.insert(userInformation.value(USERNAMES).toMap().value(EDITABLE_USERNAME).toString(), userInformation);
emit userUpdated(updatedUserId, userInformation); emit userUpdated(updatedUserId, userInformation);
} }
@ -1845,7 +1847,7 @@ void TDLibWrapper::handleUserStatusUpdated(const QString &userId, const QVariant
QVariantMap updatedUserInformation = this->allUsers.value(userId).toMap(); QVariantMap updatedUserInformation = this->allUsers.value(userId).toMap();
updatedUserInformation.insert(STATUS, userStatusInformation); updatedUserInformation.insert(STATUS, userStatusInformation);
this->allUsers.insert(userId, updatedUserInformation); this->allUsers.insert(userId, updatedUserInformation);
this->allUserNames.insert(userInformation.value(USERNAME).toString(), userInformation); this->allUserNames.insert(userInformation.value(USERNAMES).toMap().value(EDITABLE_USERNAME).toString(), userInformation);
emit userUpdated(userId, updatedUserInformation); emit userUpdated(userId, updatedUserInformation);
} }