Skip to content
Snippets Groups Projects

Fix default settings when they are boolean.

Merged gitlab-qa-bot requested to merge github/fork/jouve/fix_default_settings into master

Created by: jouve

error is that enabled ||= true always evaluates to true. Change all initialization of bool settings to use the same syntax: setting = true if setting.nil?

Same as #2652 but for master.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Created by: riyad

    Ouch ... I feel really stupid. :disappointed: I had to read it a few times until I got it ... I feel sorry for the person who proposed this fix a few days ago and it got turned down ... if you are reading this: Sorry. :sweat_smile:

    For the ones who still don't get it: ;) We have boolean options which we need to set to a default value if they are not set. So if the option is nil we assume it is not set and set a default value. If it is false we assume it was set deliberately, so we leave it. Can anyone see it now? ... I'll tell you: We use the ||= operator which will assign the value on the right if the left-hand expression evaluates to false. In our case we would set the default value regardless whether the option was nil or false thus overwriting a user setting. :scream: (btw that's the reason we were getting those "I disabled Gravatar, but it isn't really disabled" issues :sweat_smile:)

    So now we explicitly check and only overwrite boolean options if they are nil. Thanks again @jouve. :thumbsup:

    By Administrator on 2013-01-18T03:23:46 (imported from GitLab project)

    By Administrator on 2013-01-18T03:23:46 (imported from GitLab)

  • Created by: riyad

    @jouve I see it was you in #2537 who proposed this fix earlier ... sorry :sweat_smile:

    By Administrator on 2013-01-18T03:26:48 (imported from GitLab project)

    By Administrator on 2013-01-18T03:26:48 (imported from GitLab)

  • Created by: kaustavdm

    :thumbsup: :smile:

    By Administrator on 2013-01-18T06:32:57 (imported from GitLab project)

    By Administrator on 2013-01-18T06:32:57 (imported from GitLab)

Please register or sign in to reply
Loading