Index: app/models/issue.rb =================================================================== --- app/models/issue.rb (revision 11981) +++ app/models/issue.rb (working copy) @@ -104,6 +104,12 @@ when 'own' user_ids = [user.id] + user.groups.map(&:id) "(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))" + when "own_watch" + user_ids = [user.id] + user.groups.map(&:id) + "(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}) OR #{table_name}.id IN (SELECT watchable_id FROM watchers WHERE user_id=#{user.id} AND watchable_type = 'Issue'))" + when "own_watch_contributed" + user_ids = [user.id] + user.groups.map(&:id) + "(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}) OR #{table_name}.id IN (SELECT watchable_id FROM watchers WHERE user_id=#{user.id} AND watchable_type = 'Issue') OR #{table_name}.id IN (SELECT journalized_id FROM journals where journalized_type = 'Issue' AND user_id=#{user.id} GROUP BY journalized_id))" else '1=0' end @@ -124,6 +130,10 @@ !self.is_private? || (self.author == user || user.is_or_belongs_to?(assigned_to)) when 'own' self.author == user || user.is_or_belongs_to?(assigned_to) + when 'own_watch' + self.author == user || user.is_or_belongs_to?(assigned_to) || self.watched_by?(user) + when 'own_watch_contributed' + self.author == user || user.is_or_belongs_to?(assigned_to) || self.watched_by?(user) || self.journals.where('journalized_id = ?', self.id).where('user_id = ?', user).count > 0 else false end Index: app/models/role.rb =================================================================== --- app/models/role.rb (revision 11981) +++ app/models/role.rb (working copy) @@ -36,7 +36,9 @@ ISSUES_VISIBILITY_OPTIONS = [ ['all', :label_issues_visibility_all], ['default', :label_issues_visibility_public], - ['own', :label_issues_visibility_own] + ['own', :label_issues_visibility_own], + ['own_watch', :label_issues_visibility_own_watch], + ['own_watch_contributed', :label_issues_visibility_own_watch_contributed] ] scope :sorted, order("#{table_name}.builtin ASC, #{table_name}.position ASC") Index: config/locales/en.yml =================================================================== --- config/locales/en.yml (revision 11981) +++ config/locales/en.yml (working copy) @@ -400,6 +400,7 @@ setting_thumbnails_enabled: Display attachment thumbnails setting_thumbnails_size: Thumbnails size (in pixels) setting_non_working_week_days: Non-working days + setting_enable_watcher_issue_visibility: Enable watcher issue visibility permission_add_project: Create project permission_add_subprojects: Create subprojects @@ -889,6 +890,8 @@ label_cross_project_tree: With project tree label_cross_project_hierarchy: With project hierarchy label_cross_project_system: With all projects + label_issues_visibility_own_watch: Issues created by, assigned to, or watched by the user + label_issues_visibility_own_watch_contributed: Issues created by, assigned to, watched by, or contributed to by the user button_login: Login button_submit: Submit