Project

General

Profile

Patch #14318 » allow_watchers_and_contributers_access_to_issues.patch

Brett Patterson, 2013-06-19 22:13

View differences:

app/models/issue.rb (working copy)
104 104
        when 'own'
105 105
          user_ids = [user.id] + user.groups.map(&:id)
106 106
          "(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
107
        when "own_watch"
108
          user_ids = [user.id] + user.groups.map(&:id)
109
          "(#{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'))"
110
        when "own_watch_contributed"
111
          user_ids = [user.id] + user.groups.map(&:id)
112
          "(#{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))"
107 113
        else
108 114
          '1=0'
109 115
        end
......
124 130
          !self.is_private? || (self.author == user || user.is_or_belongs_to?(assigned_to))
125 131
        when 'own'
126 132
          self.author == user || user.is_or_belongs_to?(assigned_to)
133
        when 'own_watch'
134
          self.author == user || user.is_or_belongs_to?(assigned_to) || self.watched_by?(user)
135
        when 'own_watch_contributed'
136
          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
127 137
        else
128 138
          false
129 139
        end
app/models/role.rb (working copy)
36 36
  ISSUES_VISIBILITY_OPTIONS = [
37 37
    ['all', :label_issues_visibility_all],
38 38
    ['default', :label_issues_visibility_public],
39
    ['own', :label_issues_visibility_own]
39
    ['own', :label_issues_visibility_own],
40
    ['own_watch', :label_issues_visibility_own_watch],
41
    ['own_watch_contributed', :label_issues_visibility_own_watch_contributed]
40 42
  ]
41 43

  
42 44
  scope :sorted, order("#{table_name}.builtin ASC, #{table_name}.position ASC")
config/locales/en.yml (working copy)
400 400
  setting_thumbnails_enabled: Display attachment thumbnails
401 401
  setting_thumbnails_size: Thumbnails size (in pixels)
402 402
  setting_non_working_week_days: Non-working days
403
  setting_enable_watcher_issue_visibility: Enable watcher issue visibility
403 404

  
404 405
  permission_add_project: Create project
405 406
  permission_add_subprojects: Create subprojects
......
889 890
  label_cross_project_tree: With project tree
890 891
  label_cross_project_hierarchy: With project hierarchy
891 892
  label_cross_project_system: With all projects
893
  label_issues_visibility_own_watch: Issues created by, assigned to, or watched by the user
894
  label_issues_visibility_own_watch_contributed: Issues created by, assigned to, watched by, or contributed to by the user
892 895

  
893 896
  button_login: Login
894 897
  button_submit: Submit
(1-1/15)