fix(settings): read social sync initial state as boolean#5566
Open
MiMoHo wants to merge 1 commit into
Open
Conversation
Since babe45a the PageController provides allowSocialSync and enableSocialSync as booleans, but ContactsSettings.vue still compared them with the strings 'yes'/'no'. Both comparisons therefore always evaluated to true: the 'Update avatars from social media' switch always appeared enabled regardless of the stored setting. Also put the unused allowSocialSync state back to work by hiding the switch when the administrator has disabled social sync, matching the behaviour before the settings dialog refactorings. AdminSettings.vue is intentionally left unchanged: its initial state comes from lib/Settings/AdminSettings.php, which still provides the raw string app values, so the string comparison is correct there. Resolves nextcloud#5561 Assisted-by: Claude:claude-fable-5 Signed-off-by: MiMoHo <37556964+MiMoHo@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Since babe45a the
PageControllerprovidesallowSocialSyncandenableSocialSyncas booleans (SocialApiService::syncAllowedByAdmin()/backgroundSyncEnabled()returnbool), butContactsSettings.vuestill compared the initial state with the strings'yes'/'no':A boolean is never
=== 'no', so both flags were alwaystrue: the Update avatars from social media switch always appeared enabled, regardless of the stored setting.Changes
allowSocialSync:true,enableSocialSync:false).allowSocialSyncwas loaded intodata()but no longer used anywhere since the settings dialog refactorings (it used to guard the switch, see 973c288 / 7310a2a). Put it back to work: the switch is now hidden when the administrator has disabled social sync, instead of showing users a toggle that has no effect (backgroundSyncEnabled()isfalsewheneversyncAllowedByAdmin()is).Note on
AdminSettings.vueThe issue also suggests changing
AdminSettings.vue, but that would break it: its initial state comes fromlib/Settings/AdminSettings.php, which provides the raw string app values ('yes'/'no') fromApplication::AVAIL_SETTINGS, so the=== 'yes'comparison is correct there. Left unchanged on purpose.Checklist
npm run lintclean for the touched file (0 errors), production build succeedsPageController→ booleans,Settings/AdminSettings.php→ strings)Resolve #5561
🤖 Generated with Claude Code