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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user