Project

General

Profile

Patch #42467 ยป 0001-fix-Email-notification-value-in-my-account-when-empt.patch

Nishida Yuya, 2025-03-23 15:02

View differences:

app/models/user.rb
end
end)
def normalized_mail_notification
mail_notification.presence || 'none'
end
def set_mail_notification
self.mail_notification = Setting.default_notification_option if self.mail_notification.blank?
true
app/views/users/_mail_notifications.html.erb
<%= select_tag(
'user[mail_notification]',
options_for_select(
user_mail_notification_options(@user), @user.mail_notification),
user_mail_notification_options(@user), @user.normalized_mail_notification),
:onchange => 'if (this.value == "selected") {$("#notified-projects").show();} else {$("#notified-projects").hide();}'
) %>
</p>
test/functional/my_controller_test.rb
end
end
def test_my_account_should_show_no_events_email_notification_when_empty_mail_notification
user = User.find(2)
user.mail_notification = ''
user.save(validate: false)
get :account
assert_response :success
assert_select 'select[name=?] option[selected]', 'user[mail_notification]', text: 'No events'
end
def test_page_with_calendar
date = '2020-10-21'
subject = 'calendar on my page'
    (1-1/1)