diff --git a/after_init.rb b/after_init.rb index fb79f6a1..29dd305d 100644 --- a/after_init.rb +++ b/after_init.rb @@ -91,6 +91,16 @@ def dmsf_init :reorder_steps, :update, :update_step, :delete_step, :edit] } pmap.permission :display_system_folders, read: true + # Watchers + pmap.permission :view_dmsf_file_watchers, {}, read: true + pmap.permission :add_dmsf_file_watchers, { watchers: [:new, :create, :append, :autocomplete_for_user]} + pmap.permission :delete_dmsf_file_watchers, { watchers: :destroy} + pmap.permission :view_dmsf_folder_watchers, {}, read: true + pmap.permission :add_dmsf_folder_watchers, { watchers: [:new, :create, :append, :autocomplete_for_user]} + pmap.permission :delete_dmsf_folder_watchers, { watchers: :destroy} + pmap.permission :view_project_watchers, {}, read: true + pmap.permission :add_project_watchers, { watchers: [:new, :create, :append, :autocomplete_for_user]} + pmap.permission :delete_project_watchers, { watchers: :destroy} end end end diff --git a/app/controllers/dmsf_context_menus_controller.rb b/app/controllers/dmsf_context_menus_controller.rb index e97c7e7c..aad0e539 100644 --- a/app/controllers/dmsf_context_menus_controller.rb +++ b/app/controllers/dmsf_context_menus_controller.rb @@ -22,10 +22,12 @@ class DmsfContextMenusController < ApplicationController helper :context_menus + helper :watchers before_action :find_folder before_action :find_dmsf_file before_action :find_dmsf_folder + before_action :find_dmsf_project def dmsf if @dmsf_file @@ -48,6 +50,12 @@ class DmsfContextMenusController < ApplicationController @project = @dmsf_link.project @allowed = User.current.allowed_to? :file_manipulation, @project @email_allowed = false + elsif @dmsf_project # project + @locked = false + @unlockable = false + @project = @dmsf_project + @allowed = User.current.allowed_to? :view_project_watchers, @project + @email_allowed = false else # multiple selection @project = get_project @locked = false @@ -56,7 +64,12 @@ class DmsfContextMenusController < ApplicationController User.current.allowed_to?(:folder_manipulation, @project) @email_allowed = User.current.allowed_to?(:email_documents, @project) end - @back_url = dmsf_folder_path(id: @project, folder_id: @folder) + if params['back_url'].present? + @back_url = params['back_url'] + else + @back_url = dmsf_folder_path(id: @project, folder_id: @folder) + end + @notifications = Setting.notified_events.include?('dmsf_legacy_notifications') render layout: false rescue ActiveRecord::RecordNotFound render_404 @@ -138,4 +151,12 @@ class DmsfContextMenusController < ApplicationController end end + def find_dmsf_project + if (params[:ids].present? && (params[:ids].size == 1)) && (!@dmsf_project) + if params[:ids][0] =~ /project-(\d+)/ + @dmsf_project = Project.find_by(id: $1) + end + end + end + end \ No newline at end of file diff --git a/app/controllers/dmsf_controller.rb b/app/controllers/dmsf_controller.rb index eaee48c8..53a3bf3d 100644 --- a/app/controllers/dmsf_controller.rb +++ b/app/controllers/dmsf_controller.rb @@ -45,6 +45,7 @@ class DmsfController < ApplicationController helper :dmsf_queries include DmsfQueriesHelper helper :context_menus + helper :watchers def permissions if !DmsfFolder.permissions?(@folder, false) @@ -79,6 +80,7 @@ class DmsfController < ApplicationController @folder_manipulation_allowed = User.current.allowed_to?(:folder_manipulation, @project) @file_manipulation_allowed = User.current.allowed_to?(:file_manipulation, @project) @trash_enabled = @folder_manipulation_allowed && @file_manipulation_allowed + @notifications = Setting.notified_events.include?('dmsf_legacy_notifications') @query.dmsf_folder_id = @folder ? @folder.id : nil @query.deleted = false @query.sub_projects |= Setting.plugin_redmine_dmsf['dmsf_projects_as_subfolders'].present? @@ -236,6 +238,11 @@ class DmsfController < ApplicationController @pathfolder = copy_folder(@folder) @force_file_unlock_allowed = User.current.allowed_to?(:force_file_unlock, @project) @redirect_to_folder_id = params[:redirect_to_folder_id] + @notifications = Setting.notified_events.include?('dmsf_legacy_notifications') + end + + def edit_root + @notifications = Setting.notified_events.include?('dmsf_legacy_notifications') end def create diff --git a/app/controllers/dmsf_files_controller.rb b/app/controllers/dmsf_files_controller.rb index f186ca57..85a57131 100644 --- a/app/controllers/dmsf_files_controller.rb +++ b/app/controllers/dmsf_files_controller.rb @@ -36,6 +36,8 @@ class DmsfFilesController < ApplicationController helper :dmsf_workflows helper :dmsf helper :queries + helper :watchers + helper :context_menus include QueriesHelper @@ -83,6 +85,7 @@ class DmsfFilesController < ApplicationController @file_manipulation_allowed = User.current.allowed_to?(:file_manipulation, @project) @revision_count = @file.dmsf_file_revisions.visible.all.size @revision_pages = Paginator.new @revision_count, params['per_page'] ? params['per_page'].to_i : 25, params['page'] + @notifications = Setting.notified_events.include?('dmsf_legacy_notifications') respond_to do |format| format.html { diff --git a/app/controllers/dmsf_workflows_controller.rb b/app/controllers/dmsf_workflows_controller.rb index 50839db2..673c3912 100644 --- a/app/controllers/dmsf_workflows_controller.rb +++ b/app/controllers/dmsf_workflows_controller.rb @@ -74,99 +74,110 @@ class DmsfWorkflowsController < ApplicationController end if revision.workflow == DmsfWorkflow::STATE_APPROVED # Just approved - recipients = DmsfMailer.get_notify_users(@project, [revision.dmsf_file], true) - DmsfMailer.deliver_workflow_notification( - recipients, - @dmsf_workflow, - revision, - :text_email_subject_approved, - :text_email_finished_approved, - :text_email_to_see_history) - if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] - unless recipients.blank? - to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') - to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') - flash[:warning] = l(:warning_email_notifications, to: to) + if Setting.notified_events.include?('dmsf_workflow_action') + recipients = DmsfMailer.get_notify_users(@project, revision.dmsf_file, true) + DmsfMailer.deliver_workflow_notification( + recipients, + @dmsf_workflow, + revision, + :text_email_subject_approved, + :text_email_finished_approved, + :text_email_to_see_history) + if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] + unless recipients.blank? + to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') + to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') + flash[:warning] = l(:warning_email_notifications, to: to) + end end end else # Just rejected - recipients = @dmsf_workflow.participiants - recipients.push revision.dmsf_workflow_assigned_by_user - recipients.uniq! - recipients = recipients & DmsfMailer.get_notify_users(@project, [revision.dmsf_file], true) - DmsfMailer.deliver_workflow_notification( - recipients, - @dmsf_workflow, - revision, - :text_email_subject_rejected, - :text_email_finished_rejected, - :text_email_to_see_history, - action.note) - if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] - unless recipients.blank? - to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') - to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') - flash[:warning] = l(:warning_email_notifications, to: to) + if Setting.notified_events.include?('dmsf_workflow_action') + recipients = @dmsf_workflow.participiants + recipients.push revision.dmsf_workflow_assigned_by_user + recipients.uniq! + recipients = recipients & DmsfMailer.get_notify_users(@project, revision.dmsf_file, true) + DmsfMailer.deliver_workflow_notification( + recipients, + @dmsf_workflow, + revision, + :text_email_subject_rejected, + :text_email_finished_rejected, + :text_email_to_see_history, + action.note) + if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] + unless recipients.blank? + to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') + to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') + flash[:warning] = l(:warning_email_notifications, to: to) + end end end end else if action.action == DmsfWorkflowStepAction::ACTION_DELEGATE # Delegation - delegate = User.active.find_by(id: params[:step_action].to_i / 10) - if DmsfMailer.get_notify_users(@project, [revision.dmsf_file], true).include?(delegate) - DmsfMailer.deliver_workflow_notification( - [delegate], - @dmsf_workflow, - revision, - :text_email_subject_delegated, - :text_email_finished_delegated, - :text_email_to_proceed, - action.note, - action.dmsf_workflow_step_assignment.dmsf_workflow_step) - if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] - flash[:warning] = l(:warning_email_notifications, to: delegate.name) + if Setting.notified_events.include?('dmsf_workflow_action') + delegate = User.active.find_by(id: params[:step_action].to_i / 10) + if DmsfMailer.get_notify_users(@project, revision.dmsf_file, true).include?(delegate) + DmsfMailer.deliver_workflow_notification( + [delegate], + @dmsf_workflow, + revision, + :text_email_subject_delegated, + :text_email_finished_delegated, + :text_email_to_proceed, + action.note, + action.dmsf_workflow_step_assignment.dmsf_workflow_step) + if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] + flash[:warning] = l(:warning_email_notifications, to: delegate.name) + end end end else # Next step assignments = @dmsf_workflow.next_assignments revision.id unless assignments.empty? - if assignments.first.dmsf_workflow_step.step != action.dmsf_workflow_step_assignment.dmsf_workflow_step.step - # Next step - assignments.each do |assignment| - if assignment.user && DmsfMailer.get_notify_users(@project, [revision.dmsf_file], true).include?(assignment.user) + if Setting.notified_events.include?('dmsf_workflow_action') + if assignments.first.dmsf_workflow_step.step != action.dmsf_workflow_step_assignment.dmsf_workflow_step.step + # Next step + assignments.each do |assignment| + if assignment.user && DmsfMailer.get_notify_users(@project, revision.dmsf_file, + true).include?(assignment.user) + DmsfMailer.deliver_workflow_notification( + [assignment.user], + @dmsf_workflow, + revision, + :text_email_subject_requires_approval, + :text_email_finished_step, + :text_email_to_proceed, + nil, + assignment.dmsf_workflow_step) + end + end + to = revision.dmsf_workflow_assigned_by_user + if to && DmsfMailer.get_notify_users(@project, revision.dmsf_file, + true).include?(to) DmsfMailer.deliver_workflow_notification( - [assignment.user], + [to], @dmsf_workflow, revision, - :text_email_subject_requires_approval, - :text_email_finished_step, - :text_email_to_proceed, - nil, - assignment.dmsf_workflow_step) + :text_email_subject_updated, + :text_email_finished_step_short, + :text_email_to_see_status) end - end - to = revision.dmsf_workflow_assigned_by_user - if to && DmsfMailer.get_notify_users(@project, [revision.dmsf_file], true).include?(to) - DmsfMailer.deliver_workflow_notification( - [to], - @dmsf_workflow, - revision, - :text_email_subject_updated, - :text_email_finished_step_short, - :text_email_to_see_status) - end - if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] - recipients = assignments.collect{ |a| a.user } - recipients << to if to - recipients.uniq! - recipients = recipients & DmsfMailer.get_notify_users(@project, [revision.dmsf_file], true) - unless recipients.empty? - to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') - to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') - flash[:warning] = l(:warning_email_notifications, to: to) + if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] + recipients = assignments.collect{ |a| a.user } + recipients << to if to + recipients.uniq! + recipients = recipients & DmsfMailer.get_notify_users(@project, revision.dmsf_file, + true) + unless recipients.empty? + to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') + to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') + flash[:warning] = l(:warning_email_notifications, to: to) + end end end end @@ -411,7 +422,9 @@ class DmsfWorkflowsController < ApplicationController if revision revision.set_workflow(@dmsf_workflow.id, params[:action]) if revision.save - @dmsf_workflow.notify_users(@project, revision, self) + if Setting.notified_events.include?('dmsf_workflow_action') + @dmsf_workflow.notify_users(@project, revision, self) + end flash[:notice] = l(:notice_workflow_started) else flash[:error] = l(:notice_cannot_start_workflow) diff --git a/app/helpers/dmsf_upload_helper.rb b/app/helpers/dmsf_upload_helper.rb index a244e974..74401e75 100644 --- a/app/helpers/dmsf_upload_helper.rb +++ b/app/helpers/dmsf_upload_helper.rb @@ -147,19 +147,17 @@ module DmsfUploadHelper end end # Notifications - if (folder && folder.notification?) || (!folder && project.dmsf_notification?) - begin - recipients = DmsfMailer.deliver_files_updated(project, files) - if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] - unless recipients.empty? - to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') - to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') - controller.flash[:warning] = l(:warning_email_notifications, to: to) if controller - end + begin + recipients = DmsfMailer.deliver_files_updated(project, files) + if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] + unless recipients.empty? + to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') + to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') + controller.flash[:warning] = l(:warning_email_notifications, to: to) if controller end - rescue => e - Rails.logger.error "Could not send email notifications: #{e.message}" end + rescue => e + Rails.logger.error "Could not send email notifications: #{e.message}" end end if failed_uploads.present? && controller diff --git a/app/models/dmsf_file.rb b/app/models/dmsf_file.rb index 3a65a14d..a7c69ec6 100644 --- a/app/models/dmsf_file.rb +++ b/app/models/dmsf_file.rb @@ -73,7 +73,7 @@ class DmsfFile < ActiveRecord::Base url: Proc.new { |o| { controller: 'dmsf_files', action: 'view', id: o } }, datetime: Proc.new { |o| o.updated_at }, author: Proc.new { |o| o.last_revision.user } - + acts_as_watchable acts_as_searchable columns: ["#{table_name}.name", "#{DmsfFileRevision.table_name}.title", "#{DmsfFileRevision.table_name}.description", "#{DmsfFileRevision.table_name}.comment"], project_key: 'project_id', date_column: "#{table_name}.updated_at" @@ -88,6 +88,9 @@ class DmsfFile < ActiveRecord::Base def initialize(*args) @project = nil + if new_record? + self.watcher_user_ids = [] + end super end @@ -212,10 +215,16 @@ class DmsfFile < ActiveRecord::Base end def notify? - return true if notification - return true if dmsf_folder && dmsf_folder.notify? - return true if !dmsf_folder && project.dmsf_notification - false + notification || dmsf_folder&.notify? || (!dmsf_folder && project.dmsf_notification) + end + + def get_all_watchers(watchers) + watchers.concat notified_watchers + if dmsf_folder + watchers.concat dmsf_folder.notified_watchers + else + watchers.concat project.notified_watchers + end end def notify_deactivate diff --git a/app/models/dmsf_folder.rb b/app/models/dmsf_folder.rb index 49efd769..3622a85e 100644 --- a/app/models/dmsf_folder.rb +++ b/app/models/dmsf_folder.rb @@ -78,13 +78,12 @@ class DmsfFolder < ActiveRecord::Base scope :notsystem, -> { where(system: false) } acts_as_customizable - acts_as_searchable columns: ["#{table_name}.title", "#{table_name}.description"], project_key: 'project_id', date_column: 'updated_at', permission: :view_dmsf_files, scope: Proc.new { DmsfFolder.visible } - + acts_as_watchable acts_as_event title: Proc.new { |o| o.title }, description: Proc.new { |o| o.description }, url: Proc.new { |o| { controller: 'dmsf', action: 'show', id: o.project, folder_id: o } }, @@ -122,6 +121,13 @@ class DmsfFolder < ActiveRecord::Base DmsfFolder.permissions?(folder.dmsf_folder, allow_system) end + def initialize(*args) + if new_record? + self.watcher_user_ids = [] + end + super + end + def default_values if Setting.plugin_redmine_dmsf['dmsf_default_notifications'].present? && !system self.notification = true @@ -197,10 +203,16 @@ class DmsfFolder < ActiveRecord::Base end def notify? - return true if notification - return true if dmsf_folder&.notify? - return true if !dmsf_folder && project.dmsf_notification - false + notification || dmsf_folder&.notify? || (!dmsf_folder && project.dmsf_notification) + end + + def get_all_watchers(watchers) + watchers << notified_watchers + if dmsf_folder + watchers << dmsf_folder.notified_watchers + else + watchers << project.notified_watchers + end end def notify_deactivate @@ -577,8 +589,8 @@ class DmsfFolder < ActiveRecord::Base if title =~ /^\./ classes << 'dmsf-system' else + classes << 'hascontextmenu' if (type != 'project') - classes << 'hascontextmenu' classes << 'dmsf-draggable' end if %(project folder).include?(type) diff --git a/app/models/dmsf_mailer.rb b/app/models/dmsf_mailer.rb index bff6eee4..f9273204 100644 --- a/app/models/dmsf_mailer.rb +++ b/app/models/dmsf_mailer.rb @@ -26,8 +26,7 @@ class DmsfMailer < Mailer layout 'mailer' def self.deliver_files_updated(project, files) - users = get_notify_users(project, files) - files = files.select { |file| file.notify? } + users = get_notify_users(project, files.first) users.each do |user| files_updated(user, project, files).deliver_later end @@ -48,8 +47,7 @@ class DmsfMailer < Mailer end def self.deliver_files_deleted(project, files) - users = get_notify_users(project, files) - files = files.select { |file| file.notify? } + users = get_notify_users(project, files.first) users.each do |user| files_deleted(user, project, files).deliver_later end @@ -137,60 +135,46 @@ class DmsfMailer < Mailer end end - def self.get_notify_users(project, files = [], force_notification = false) + # force_notification = true => approval workflow's notifications + def self.get_notify_users(project, file, force_notification = false) return [] unless project.active? - if !force_notification && files.present? - notify_files = files.select { |file| file.notify? } - return [] if notify_files.empty? - end - notify_members = project.members.active.select do |notify_member| - notify_user = notify_member.user - if notify_user == User.current && notify_user.pref.no_self_notified - false - else - if notify_member.dmsf_mail_notification.nil? - case notify_user.mail_notification - when 'all' - true - when 'selected' - notify_member.mail_notification? - when 'only_my_events' - author = false - files.each do |file| - if file.involved?(notify_user) || file.assigned?(notify_user) - author = true - break - end - end - author - when 'only_owner' - owner = false - files.each do |file| - if file.owner?(notify_user) - owner = true - break - end - end - owner - when 'only_assigned' - assignee = false - files.each do |file| - if file.assigned?(notify_user) - assignee = true - break - end - end - assignee - else - false - end + # Notifications + if (force_notification && Setting.notified_events.include?('dmsf_workflow_plural')) || + (Setting.notified_events.include?('dmsf_legacy_notifications') && file&.notify?) + notify_members = project.members.active.select do |notify_member| + notify_user = notify_member.user + if notify_user == User.current && notify_user.pref.no_self_notified + false else - notify_member.dmsf_mail_notification + if notify_member.dmsf_mail_notification.nil? + case notify_user.mail_notification + when 'all' + true + when 'selected' + notify_member.mail_notification? + when 'only_my_events' + file.involved?(notify_user) || file.assigned?(notify_user) + when 'only_owner' + file.owner? notify_user + when 'only_assigned' + file.assigned? notify_user + else + false + end + else + notify_member.dmsf_mail_notification + end end end + users = notify_members.collect { |m| m.user } + else + users = [] end - - notify_members.collect { |m| m.user }.uniq + # Watchers + watchers = [] + file.get_all_watchers(watchers) + users.concat watchers + users.uniq end end diff --git a/app/models/dmsf_workflow.rb b/app/models/dmsf_workflow.rb index aa1d64cc..9ffff5b2 100644 --- a/app/models/dmsf_workflow.rb +++ b/app/models/dmsf_workflow.rb @@ -211,7 +211,7 @@ class DmsfWorkflow < ActiveRecord::Base assignments = next_assignments(revision.id) recipients = assignments.collect{ |a| a.user } recipients.uniq! - recipients = recipients & DmsfMailer.get_notify_users(project, [revision.dmsf_file], true) + recipients = recipients & DmsfMailer.get_notify_users(project, revision.dmsf_file, true) DmsfMailer.deliver_workflow_notification( recipients, self, diff --git a/app/views/dmsf/_main.html.erb b/app/views/dmsf/_main.html.erb index 35f07259..33b78283 100644 --- a/app/views/dmsf/_main.html.erb +++ b/app/views/dmsf/_main.html.erb @@ -42,7 +42,8 @@ project: @project, locked_for_user: @locked_for_user, file_manipulation_allowed: @file_manipulation_allowed, - trash_enabled: @trash_enabled } %> + trash_enabled: @trash_enabled, + notifications: @notifications } %> <% else %> <%= actions_dropdown do %> <%= render partial: 'dmsf_context_menus/main', locals: { @@ -52,7 +53,8 @@ project: @project, locked_for_user: @locked_for_user, file_manipulation_allowed: @file_manipulation_allowed, - trash_enabled: @trash_enabled } %> + trash_enabled: @trash_enabled, + notifications: @notifications} %> <% end %> <% end %> @@ -91,6 +93,24 @@ <% content_for :sidebar do %> <%= render partial: 'dmsf/sidebar' %> + + <% project_or_folder = @folder? @folder : @project %> + <% if project_or_folder&.watchers.present? %> +
|
- <% unless (system || (node.type == 'project')) %>
+ <% unless system %>
<% if defined?(EasyExtensions) %>
<%= link_to '', '#', title: l(:button_actions), class: 'icon-only icon-actions js-contextmenu icon-more-horiz' %>
<% else %>
diff --git a/app/views/dmsf/edit.html.erb b/app/views/dmsf/edit.html.erb
index 34796a47..2ae10ebd 100644
--- a/app/views/dmsf/edit.html.erb
+++ b/app/views/dmsf/edit.html.erb
@@ -46,6 +46,7 @@
edit: true,
unlockable: @folder.unlockable? && (!@folder.locked_for_user? || User.current.allowed_to?(:force_file_unlock, @project)),
email_allowed: User.current.allowed_to?(:email_documents, @project),
+ notifications: @notifications,
back_url: edit_dmsf_url(id: @project, folder_id: @folder)
} %>
<% else %>
@@ -60,6 +61,7 @@
edit: true,
unlockable: @folder.unlockable? && (!@folder.locked_for_user? || User.current.allowed_to?(:force_file_unlock, @project)),
email_allowed: User.current.allowed_to?(:email_documents, @project),
+ notifications: @notifications,
back_url: edit_dmsf_url(id: @project, folder_id: @folder)
} %>
<% end %>
diff --git a/app/views/dmsf/edit_root.html.erb b/app/views/dmsf/edit_root.html.erb
index 9ef5f72f..c6cd495c 100644
--- a/app/views/dmsf/edit_root.html.erb
+++ b/app/views/dmsf/edit_root.html.erb
@@ -25,7 +25,7 @@
<% html_title(l(:dmsf)) %>
- <% if User.current.allowed_to?(:folder_manipulation, @project) %>
+ <% if @notifications && User.current.allowed_to?(:folder_manipulation, @project) %>
<% if @project.dmsf_notification %>
<%= link_to l(:label_notifications_off),
notify_deactivate_dmsf_path(id: @project, back_url: edit_root_dmsf_path(id: @project)),
diff --git a/app/views/dmsf_context_menus/_file.html.erb b/app/views/dmsf_context_menus/_file.html.erb
index 9cc02f58..46e55a86 100644
--- a/app/views/dmsf_context_menus/_file.html.erb
+++ b/app/views/dmsf_context_menus/_file.html.erb
@@ -46,15 +46,17 @@
class: 'icon icon-lock', disabled: !allowed %>
<% end %>
-
+ <%= render partial: 'watchers/watchers', locals: { watched: @file } %>
+
+ <% end %>
+<% end %>
+
<%= late_javascript_tag do %>
$('a.delete-revision').click(function(event) {
if(!window.confirm('<%= l(:text_are_you_sure) %>')) {
diff --git a/app/views/dmsf_state/_user_pref.html.erb b/app/views/dmsf_state/_user_pref.html.erb
index 51ad1133..41f41a1a 100644
--- a/app/views/dmsf_state/_user_pref.html.erb
+++ b/app/views/dmsf_state/_user_pref.html.erb
@@ -23,13 +23,15 @@
<% if member %>
|