Stop erroring out when setting avatar if you never set it

The code didn't actually check the avatar URLs were different until now.
This commit is contained in:
Joshua Goins
2025-09-11 11:04:16 +02:00
parent 812e5beee6
commit cfedd4fdb5

View File

@@ -35,9 +35,13 @@ FormCard.FormCardPage {
padding: 0
// Note: User::avatarUrl does not set user_id, and thus cannot be used directly here. Hence the makeMediaUrl.
source: root.connection && (root.connection.localUser.avatarUrl.toString().length > 0 ? root.connection.makeMediaUrl(root.connection.localUser.avatarUrl) : "")
source: findOriginalAvatarUrl()
name: root.connection.localUser.displayName
function findOriginalAvatarUrl(): string {
return root.connection && (root.connection.localUser.avatarUrl.toString().length > 0 ? root.connection.makeMediaUrl(root.connection.localUser.avatarUrl) : "");
}
onClicked: {
if (fileDialog) {
return;
@@ -137,7 +141,7 @@ FormCard.FormCardPage {
text: i18n("Save")
icon.name: "document-save-symbolic"
onClicked: {
if (!root.connection.setAvatar(avatar.source)) {
if (avatar.source != avatar.findOriginalAvatarUrl() && !root.connection.setAvatar(avatar.source)) {
(root.Window.window as Kirigami.ApplicationWindow).showPassiveNotification("The Avatar could not be set");
}
if (root.connection.localUser.displayName !== name.text) {