Skip to content

GitLab

  • Menu
    • Projects Groups Snippets
      Help
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Merge requests
  • !2653

Merged
Created 12 years ago by Administrator@rootOwner

Fix default settings when they are boolean.

  • Overview 3
  • Commits 1
  • Changes 1

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.

Loading
Loading

  • Administrator
    Administrator @root · 12 years ago
    Owner

    Created by: riyad

    Ouch ... I feel really stupid. 😞 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. 😅

    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. 😱 (btw that's the reason we were getting those "I disabled Gravatar, but it isn't really disabled" issues 😅)

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

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

  • Administrator
    Administrator @root · 12 years ago
    Owner

    Created by: riyad

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

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

  • Administrator
    Administrator @root · 12 years ago
    Owner

    Created by: kaustavdm

    👍 😄

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

  • You're only seeing other activity in the feed. To add a comment, switch to one of the following options.
Please register or sign in to reply
0 Assignees
Assign to
0 Reviewers
Request review from
Milestone
No milestone
None
None
Time tracking
0
Labels
None
Assign labels
  • No matching results
  • Manage project labels
Lock merge request
Unlocked
participants
Reference:
Source branch: github/fork/jouve/fix_default_settings

    0 pending comments

Menu

Projects Groups Snippets
Help