unscoped.patch

Pavel Rosick√Ĺ, 2020-01-28 23:34

Download (1.29 KB)

View differences:

app/models/user.rb (working copy)
634 634
    Project.unscoped do
635 635
      return @project_ids_by_role if @project_ids_by_role
636 636

  
637
      group_class = anonymous? ? GroupAnonymous : GroupNonMember
637
      group_class = anonymous? ? GroupAnonymous.unscoped : GroupNonMember.unscoped
638 638
      group_id = group_class.pluck(:id).first
639 639

  
640 640
      members = Member.joins(:project, :member_roles).
......
970 970

  
971 971
  def validate_anonymous_uniqueness
972 972
    # There should be only one AnonymousUser in the database
973
    errors.add :base, 'An anonymous user already exists.' if AnonymousUser.exists?
973
    errors.add :base, 'An anonymous user already exists.' if AnonymousUser.unscoped.exists?
974 974
  end
975 975

  
976 976
  def available_custom_fields
lib/redmine/acts/positioned.rb (working copy)
66 66
            h[column] = yield(column)
67 67
            h
68 68
          end
69
          self.class.where(condition_hash)
69
          self.class.unscoped.where(condition_hash)
70 70
        end
71 71

  
72 72
        def set_default_position