diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2018-02-09 18:12:20 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2018-02-09 18:12:20 +0800 |
commit | 09a3b8fb655ac673a5d706548d13c26cdb53aa9f (patch) | |
tree | 1de0f5552cf1235587cc36f59c1ddc92c1a50752 /app/models/group.rb | |
parent | 1264e2b6e8ce53f578255e9296875947845431bf (diff) | |
parent | 7534f7a892d6e8c50475720e387b8689c94582da (diff) | |
download | gitlab-ce-09a3b8fb655ac673a5d706548d13c26cdb53aa9f.tar.gz |
Merge remote-tracking branch 'upstream/master' into qa-clone-with-deploy-key
* upstream/master: (466 commits)
Set initial password for instance in LDAP QA test
Backport EE changes to some hashed storage documentation to CE
Remove allow_n_plus_1 from Git::Repository#branches_filter
Bumps Gitlab Shell version to 6.0.3
Make resetting column information overridable in EE
Added 'clear' button to ci lint editor
Issues and merge requests in subgroups docs
Update docs labels CE
Refactored merge_requests/show path in dispatcher.js
wording
don't check against a hardcoded user name
10.5 Update the dependencies license list
10.5 Update the .gitignore, .gitlab-ci.yml, and Dockerfile templates
Create update guide for 10.5
Update 10.5 source install guide
Add docs for MR link in commit page
Add groups to OpenID Connect claims
Replaced $.get with axois.get
Memoize MergeRequest#rebase_in_progress? to prevent N+1 queries in Gitaly
Update style_guide_scss.md
...
Diffstat (limited to 'app/models/group.rb')
-rw-r--r-- | app/models/group.rb | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/app/models/group.rb b/app/models/group.rb index fddace03387..75bf013ecd2 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -29,18 +29,17 @@ class Group < Namespace has_many :variables, class_name: 'Ci::GroupVariable' has_many :custom_attributes, class_name: 'GroupCustomAttribute' - validate :avatar_type, if: ->(user) { user.avatar.present? && user.avatar_changed? } + has_many :uploads, as: :model, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent + + accepts_nested_attributes_for :variables, allow_destroy: true + validate :visibility_level_allowed_by_projects validate :visibility_level_allowed_by_sub_groups validate :visibility_level_allowed_by_parent - - validates :avatar, file_size: { maximum: 200.kilobytes.to_i } + validates :variables, variable_duplicates: true validates :two_factor_grace_period, presence: true, numericality: { greater_than_or_equal_to: 0 } - mount_uploader :avatar, AvatarUploader - has_many :uploads, as: :model, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent - after_create :post_create_hook after_destroy :post_destroy_hook after_save :update_two_factor_requirement @@ -116,12 +115,6 @@ class Group < Namespace visibility_level_allowed_by_sub_groups?(level) end - def avatar_url(**args) - # We use avatar_path instead of overriding avatar_url because of carrierwave. - # See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/11001/diffs#note_28659864 - avatar_path(args) - end - def lfs_enabled? return false unless Gitlab.config.lfs.enabled return Gitlab.config.lfs.enabled if self[:lfs_enabled].nil? @@ -284,12 +277,6 @@ class Group < Namespace list_of_ids.reverse.map { |group| variables[group.id] }.compact.flatten end - def full_path_was - return path_was unless has_parent? - - "#{parent.full_path}/#{path_was}" - end - def group_member(user) if group_members.loaded? group_members.find { |gm| gm.user_id == user.id } |