Fix default settings when they are boolean.
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
Activity
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 isfalse
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 wasnil
orfalse
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)
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
By Administrator on 2013-01-18T03:26:48 (imported from GitLab project)
By Administrator on 2013-01-18T03:26:48 (imported from GitLab)