From c51766498511654c41a77523b4b4ae53a1a05b04 Mon Sep 17 00:00:00 2001 From: Marius Balteanu Date: Tue, 23 Jan 2024 01:05:38 +0000 Subject: Reverts r22438 (#35189). git-svn-id: https://svn.redmine.org/redmine/trunk@22616 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/projects_controller.rb | 5 +---- app/models/user.rb | 17 ++--------------- 2 files changed, 3 insertions(+), 19 deletions(-) (limited to 'app') diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 1faeee46c..15e9120f8 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -263,14 +263,11 @@ class ProjectsController < ApplicationController end def bookmark - user = User.current - jump_box = Redmine::ProjectJumpBox.new user + jump_box = Redmine::ProjectJumpBox.new User.current if request.delete? jump_box.delete_project_bookmark @project - user.update_notified_bookmarked_project_ids(@project) elsif request.post? jump_box.bookmark_project @project - user.update_notified_bookmarked_project_ids(@project) end respond_to do |format| format.js diff --git a/app/models/user.rb b/app/models/user.rb index cd923e46b..0f78a8937 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -75,7 +75,6 @@ class User < Principal MAIL_NOTIFICATION_OPTIONS = [ ['all', :label_user_mail_option_all], ['selected', :label_user_mail_option_selected], - ['bookmarked', :label_user_mail_option_bookmarked], ['only_my_events', :label_user_mail_option_only_my_events], ['only_assigned', :label_user_mail_option_only_assigned], ['only_owner', :label_user_mail_option_only_owner], @@ -493,25 +492,13 @@ class User < Principal # Updates per project notifications (after_save callback) def update_notified_project_ids if @notified_projects_ids_changed - ids = [] - if mail_notification == 'selected' - ids = Array.wrap(notified_projects_ids).reject(&:blank?) - elsif mail_notification == 'bookmarked' - ids = Array.wrap(bookmarked_project_ids).reject(&:blank?) - end + ids = (mail_notification == 'selected' ? Array.wrap(notified_projects_ids).reject(&:blank?) : []) members.update_all(:mail_notification => false) members.where(:project_id => ids).update_all(:mail_notification => true) if ids.any? end end private :update_notified_project_ids - def update_notified_bookmarked_project_ids(project_id) - if mail_notification == 'bookmarked' - @notified_projects_ids_changed = true - self.update_notified_project_ids - end - end - def valid_notification_options self.class.valid_notification_options(self) end @@ -835,7 +822,7 @@ class User < Principal case object when Issue case mail_notification - when 'selected', 'only_my_events', 'bookmarked' + when 'selected', 'only_my_events' # user receives notifications for created/assigned issues on unselected projects object.author == self || is_or_belongs_to?(object.assigned_to) || is_or_belongs_to?(object.previous_assignee) when 'only_assigned' -- cgit v1.2.3