diff options
author | Stan Hu <stanhu@gmail.com> | 2018-08-01 10:35:06 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-08-01 10:35:06 -0700 |
commit | 636bcebcba5d9215e550f4ca7ba7c75404e06ba9 (patch) | |
tree | d7575711346c404148486d37c91a4faae41f2ae1 | |
parent | d26074c7e900381c1ad6ffd2cb75f5015bcec40e (diff) | |
download | gitlab-ce-636bcebcba5d9215e550f4ca7ba7c75404e06ba9.tar.gz |
Fix handling of non-existent groups
-rw-r--r-- | app/helpers/namespaces_helper.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/helpers/namespaces_helper.rb b/app/helpers/namespaces_helper.rb index 2862fb63d9f..3f528c42cb6 100644 --- a/app/helpers/namespaces_helper.rb +++ b/app/helpers/namespaces_helper.rb @@ -19,15 +19,15 @@ module NamespacesHelper # group if one exists by that name to prevent duplicates. unless extra_group.persisted? existing_group = Group.find_by(name: extra_group.name) - extra_group = existing_group if existing_group + extra_group = existing_group if existing_group&.persisted? end if Ability.allowed?(current_user, :read_group, extra_group) selected = extra_group.id if selected == :extra_group groups |= [extra_group] - else - selected = :current_user end + + selected ||= :current_user end options = [] |