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
|
padding: 0
|
||||||
|
|
||||||
// Note: User::avatarUrl does not set user_id, and thus cannot be used directly here. Hence the makeMediaUrl.
|
// 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
|
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: {
|
onClicked: {
|
||||||
if (fileDialog) {
|
if (fileDialog) {
|
||||||
return;
|
return;
|
||||||
@@ -137,7 +141,7 @@ FormCard.FormCardPage {
|
|||||||
text: i18n("Save")
|
text: i18n("Save")
|
||||||
icon.name: "document-save-symbolic"
|
icon.name: "document-save-symbolic"
|
||||||
onClicked: {
|
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");
|
(root.Window.window as Kirigami.ApplicationWindow).showPassiveNotification("The Avatar could not be set");
|
||||||
}
|
}
|
||||||
if (root.connection.localUser.displayName !== name.text) {
|
if (root.connection.localUser.displayName !== name.text) {
|
||||||
|
|||||||
Reference in New Issue
Block a user