[PATCH] Make sure that toggling account options affects the correct account
authorJoshua Goins <josh@redstrate.com>
Mon, 7 Jul 2025 01:53:13 +0000 (21:53 -0400)
committerAurélien COUDERC <coucouf@debian.org>
Thu, 24 Jul 2025 16:34:20 +0000 (18:34 +0200)
(cherry picked from commit 8c8a0519a82fea6aaaf49f6022b4b497e66d07ae)

Gbp-Pq: Name upstream_4643870b_Make-sure-that-toggling-account-options-affects-the-correct-account.patch

src/content/ui/Settings/AccountPage.qml

index 213f6d820bad0a4869f041b421587f2e56cf94c5..501c360edff80c148e3511fb0c77385451fc4ad2 100644 (file)
@@ -14,7 +14,7 @@ import ".."
 Kirigami.Page {
     id: root
 
-    property var account
+    property AbstractAccount account
 
     readonly property ProfileEditorBackend backend : ProfileEditorBackend {
         account: root.account
@@ -166,8 +166,8 @@ Kirigami.Page {
 
                     FormCard.FormSwitchDelegate {
                         text: i18nc("@label Account preferences", "Mark uploaded media as sensitive by default")
-                        checked: AccountManager.selectedAccount.preferences.defaultSensitive
-                        onToggled: AccountManager.selectedAccount.preferences.defaultSensitive = checked
+                        checked: root.account.preferences.defaultSensitive
+                        onToggled: root.account.preferences.defaultSensitive = checked
                     }
 
                     FormCard.FormDelegateSeparator {
@@ -175,8 +175,8 @@ Kirigami.Page {
 
                     FormCard.FormSwitchDelegate {
                         text: i18nc("@label Account preferences", "Include public posts in search results")
-                        checked: AccountManager.selectedAccount.preferences.indexable
-                        onToggled: AccountManager.selectedAccount.preferences.indexable = checked
+                        checked: root.account.preferences.indexable
+                        onToggled: root.account.preferences.indexable = checked
                     }
 
                     FormCard.FormDelegateSeparator {
@@ -184,7 +184,7 @@ Kirigami.Page {
 
                     FormCard.FormButtonDelegate {
                         text: i18nc("@label Account preferences", "Default post language")
-                        description: Qt.locale(AccountManager.selectedAccount.preferences.defaultLanguage).nativeLanguageName
+                        description: Qt.locale(root.account.preferences.defaultLanguage).nativeLanguageName
 
                         onClicked: languageSelect.createObject().open()
 
@@ -194,10 +194,10 @@ Kirigami.Page {
                             LanguageSelector {
                                 parent: root.QQC2.Overlay.overlay
                                 onAboutToShow: {
-                                    const sourceIndex = listView.model.sourceModel.indexOfValue(AccountManager.selectedAccount.preferences.defaultLanguage);
+                                    const sourceIndex = listView.model.sourceModel.indexOfValue(root.account.preferences.defaultLanguage);
                                     listView.currentIndex = listView.model.mapFromSource(sourceIndex).row;
                                 }
-                                onCodeSelected: code => AccountManager.selectedAccount.preferences.defaultLanguage = code
+                                onCodeSelected: code => root.account.preferences.defaultLanguage = code
                                 onClosed: destroyed()
                             }
                         }
@@ -215,8 +215,8 @@ Kirigami.Page {
                             i18nc("@item:inlistbox Default post visibility rule", "Unlisted"),
                             i18nc("@item:inlistbox Default post visibility rule", "Private")
                         ]
-                        Component.onCompleted: currentIndex = AccountManager.selectedAccount.preferences.defaultVisibility
-                        onCurrentValueChanged: AccountManager.selectedAccount.preferences.defaultVisibility = currentIndex
+                        Component.onCompleted: currentIndex = root.account.preferences.defaultVisibility
+                        onCurrentValueChanged: root.account.preferences.defaultVisibility = currentIndex
                     }
 
                     FormCard.FormDelegateSeparator {
@@ -227,7 +227,7 @@ Kirigami.Page {
                         id: websiteDelegate
                         text: i18nc("@abel Account preferences", "Open Server in Browser")
                         description: i18n("Some settings can only be configured on your server's website.")
-                        onClicked: Qt.openUrlExternally(AccountManager.selectedAccount.instanceUri)
+                        onClicked: Qt.openUrlExternally(root.account.instanceUri)
                     }
                 }
             }