Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1ea69589
Commit
1ea69589
authored
Sep 13, 2018
by
Luke Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update user_has_namespace_with_gold? to check for any plan instead of just gold plan
parent
f8e74da7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
ee/app/helpers/ee/users_helper.rb
ee/app/helpers/ee/users_helper.rb
+31
-0
No files found.
ee/app/helpers/ee/users_helper.rb
0 → 100644
View file @
1ea69589
# frozen_string_literal: true
module
EE
module
UsersHelper
def
users_sentence
(
users
,
link_class:
nil
)
users
.
map
{
|
user
|
link_to
(
user
.
name
,
user
,
class:
link_class
)
}.
to_sentence
.
html_safe
end
def
user_namespace_union
(
user
=
current_user
,
select
=
:id
)
::
Gitlab
::
SQL
::
Union
.
new
([
::
Namespace
.
select
(
select
).
where
(
type:
nil
,
owner:
user
),
user
.
owned_groups
.
select
(
select
).
where
(
parent_id:
nil
)
]).
to_sql
end
def
user_has_namespace_with_trial?
(
user
=
current_user
)
::
Namespace
.
from
(
"(
#{
user_namespace_union
(
user
,
:trial_ends_on
)
}
)
#{
::
Namespace
.
table_name
}
"
)
.
where
(
'trial_ends_on > ?'
,
Time
.
now
.
utc
)
.
any?
end
def
user_has_namespace_with_gold?
(
user
=
current_user
)
::
Namespace
.
includes
(
:plan
)
.
where
(
"namespaces.id IN (
#{
user_namespace_union
(
user
)
}
)"
)
# rubocop:disable GitlabSecurity/SqlInjection
.
where
.
not
(
plans:
{
id:
nil
})
.
any?
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment