Fix users scope for issue reports
This commit is contained in:
parent
d5d72aecdf
commit
d27efdcbb9
@ -8,7 +8,8 @@ Changelog
|
||||
- Mermaid 8.3.1 support
|
||||
- Select2 4.0.10 support
|
||||
- Chart.js Plugin datalabels 0.7.0 support
|
||||
- members macro uses visible scope of users with support of hidden roles
|
||||
- Fix user visibility for members macro
|
||||
- Fix user visibility for issue reports
|
||||
|
||||
2.0.21
|
||||
++++++
|
||||
|
5
app/overrides/reports/simple.rb
Normal file
5
app/overrides/reports/simple.rb
Normal file
@ -0,0 +1,5 @@
|
||||
Deface::Override.new virtual_path: 'reports/_simple',
|
||||
name: 'report-simple-user-scope',
|
||||
insert_before: 'erb[silent]:contains("rows.empty?")',
|
||||
original: '0c85cc752700d7f2bf08b3b9b30f59d8eddc443b',
|
||||
partial: 'reports/additionals_simple'
|
4
app/views/reports/_additionals_simple.html.slim
Normal file
4
app/views/reports/_additionals_simple.html.slim
Normal file
@ -0,0 +1,4 @@
|
||||
- if field_name == 'assigned_to_id'
|
||||
- rows = Setting.issue_group_assignment? ? @project.visible_principals : @project.visible_users
|
||||
- elsif field_name == 'author_id'
|
||||
- rows = @project.visible_users
|
@ -19,6 +19,7 @@ module Additionals
|
||||
Project
|
||||
Wiki
|
||||
WikiController
|
||||
ReportsController
|
||||
Principal
|
||||
QueryFilter
|
||||
Role
|
||||
|
@ -3,6 +3,7 @@ module Additionals
|
||||
module ProjectPatch
|
||||
def self.included(base)
|
||||
base.send(:prepend, InstancOverwriteMethods)
|
||||
base.send(:include, InstanceMethods)
|
||||
end
|
||||
|
||||
module InstancOverwriteMethods
|
||||
@ -18,6 +19,18 @@ module Additionals
|
||||
roles_with_users
|
||||
end
|
||||
end
|
||||
|
||||
module InstanceMethods
|
||||
def visible_principals
|
||||
query = ::Query.new(project: self, name: '_')
|
||||
query&.principals
|
||||
end
|
||||
|
||||
def visible_users
|
||||
query = ::Query.new(project: self, name: '_')
|
||||
query&.users
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
22
lib/additionals/patches/reports_controller_patch.rb
Normal file
22
lib/additionals/patches/reports_controller_patch.rb
Normal file
@ -0,0 +1,22 @@
|
||||
module Additionals
|
||||
module Patches
|
||||
module ReportsControllerPatch
|
||||
def self.included(base)
|
||||
base.send(:prepend, InstancOverwriteMethods)
|
||||
end
|
||||
|
||||
module InstancOverwriteMethods
|
||||
def issue_report_details
|
||||
super
|
||||
return if @rows.nil?
|
||||
|
||||
if Setting.issue_group_assignment? && params[:detail] == 'assigned_to'
|
||||
@rows = @project.visible_principals
|
||||
elsif %w[assigned_to author].include? params[:detail]
|
||||
@rows = @project.visible_users
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -5,7 +5,7 @@ module Additionals
|
||||
# Patch wiki to include sidebar
|
||||
module WikiPatch
|
||||
def self.included(base)
|
||||
base.send(:include, InstanceMethodsForAdditionalsWiki)
|
||||
base.send(:include, InstanceMethods)
|
||||
base.class_eval do
|
||||
alias_method :sidebar_without_additionals, :sidebar
|
||||
alias_method :sidebar, :sidebar_with_additionals
|
||||
@ -13,8 +13,7 @@ module Additionals
|
||||
end
|
||||
end
|
||||
|
||||
# Instance methodes for Wiki
|
||||
module InstanceMethodsForAdditionalsWiki
|
||||
module InstanceMethods
|
||||
def sidebar_with_additionals
|
||||
@sidebar ||= find_page('Sidebar', with_redirect: false)
|
||||
if @sidebar&.content
|
||||
|
@ -42,8 +42,7 @@ module Additionals
|
||||
project ||= Project.visible.find_by(name: project_id)
|
||||
return if project.nil?
|
||||
|
||||
query = ::Query.new(project: project, name: '_')
|
||||
principals = query&.principals
|
||||
principals = project.visible_users
|
||||
return if principals.nil?
|
||||
|
||||
users = []
|
||||
|
Loading…
Reference in New Issue
Block a user