Project

General

Profile

Defect #34029 » 0001-Include-GroupNonMember-and-GroupAnonymous-roles-3402.patch

Marius BĂLTEANU, 2022-03-20 22:13

View differences:

app/models/user.rb
610 610
      Role.joins(members: :project).
611 611
        where(["#{Project.table_name}.status <> ?", Project::STATUS_ARCHIVED]).
612 612
          where(Member.arel_table[:user_id].eq(id)).distinct
613

  
614
    if @roles.blank?
615
      group_class = anonymous? ? GroupAnonymous : GroupNonMember
616
      @roles = Role.joins(members: :project).
617
        where(["#{Project.table_name}.status <> ? AND #{Project.table_name}.is_public = ?", Project::STATUS_ARCHIVED, true]).
618
        where(Member.arel_table[:user_id].eq(group_class.first.id)).distinct
619
    end
620

  
621
    @roles
613 622
  end
614 623

  
615 624
  # Returns the user's bult-in role
(3-3/3)