Patch #42445
closedRemove extra condition in User#notify_about?
0%
Description
In User#notify_about?
, the case of mail_notification.blank?
is never. Because User#set_mail_notification
(before_create) sets Setting.default_notification_option
if blank.
So we can remove its condition. This patch removes it.
User#notify_about?
source:tags/6.0.4/app/models/user.rb#L818User#set_mail_notification
source:tags/6.0.4/app/models/user.rb#L161- before_create source:tags/6.0.4/app/models/user.rb#L133
Files
Updated by Go MAEDA 9 days ago
- Target version changed from 6.1.0 to Candidate for next minor release
Although the users.mail_notification
column is set to true
when creating a user object, it is possible to set this column to blank by manually executing an SQL statement. Therefore, I believe it would be better to keep the current code as it is.
What is your opinion on this?
Updated by Nishida Yuya 8 days ago
it is possible to set this column to blank by manually executing an SQL statement.
I see. Thanks comment! I understood that I also need to consider the case when SQL is manually executed, so this patch (0001-refactor-remove-extra-condition.patch) and issue are incorrect.
Instead, I found a bug about manual executing SQL. Its details and patch is in #42467 .