Index: app/models/issue.rb =================================================================== --- app/models/issue.rb (revision 15058) +++ app/models/issue.rb (working copy) @@ -130,6 +130,12 @@ when 'own' user_ids = [user.id] + user.groups.map(&:id).compact "(#{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 @@ -150,6 +156,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 15058) +++ 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] ] TIME_ENTRIES_VISIBILITY_OPTIONS = [ Index: config/locales/en.yml =================================================================== --- config/locales/en.yml (revision 15058) +++ config/locales/en.yml (working copy) @@ -430,6 +430,7 @@ setting_search_results_per_page: Search results per page setting_attachment_extensions_allowed: Allowed extensions setting_attachment_extensions_denied: Disallowed extensions + setting_enable_watcher_issue_visibility: Enable watcher issue visibility permission_add_project: Create project permission_add_subprojects: Create subprojects @@ -976,6 +977,8 @@ label_api: API label_field_format_enumeration: Key/value list label_default_values_for_new_users: Default values for new users + 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