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
d38b4579
Commit
d38b4579
authored
Jun 08, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove license overusage message
See #393
parent
51769eb2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
48 deletions
+7
-48
CHANGELOG-EE
CHANGELOG-EE
+3
-0
app/helpers/license_helper.rb
app/helpers/license_helper.rb
+4
-12
app/models/license.rb
app/models/license.rb
+0
-16
spec/helpers/license_helper_spec.rb
spec/helpers/license_helper_spec.rb
+0
-20
No files found.
CHANGELOG-EE
View file @
d38b4579
...
...
@@ -5,6 +5,9 @@ v 8.9.0 (unreleased)
- Allow LDAP to mark users as external based on their group membership. !432
- Instrument instance methods of Gitlab::InsecureKeyFingerprint class
v 8.8.4
- Remove license overusage message
v 8.8.3
- Add standard web hook headers to Jenkins CI post. !374
- Gracefully handle malformed DNs in LDAP group sync. !392
...
...
app/helpers/license_helper.rb
View file @
d38b4579
...
...
@@ -37,15 +37,13 @@ module LicenseHelper
return
unless
signed_in
return
unless
(
is_admin
&&
(
license
.
notify_admins?
||
license
.
warn_upgrade_license_message?
)
)
||
license
.
notify_users?
return
unless
(
is_admin
&&
license
.
notify_admins?
)
||
license
.
notify_users?
message
=
[]
unless
license
.
warn_upgrade_license_message?
message
<<
"The GitLab Enterprise Edition license"
message
<<
(
license
.
expired?
?
"expired"
:
"will expire"
)
message
<<
"on
#{
license
.
expires_at
}
."
end
message
<<
"The GitLab Enterprise Edition license"
message
<<
(
license
.
expired?
?
"expired"
:
"will expire"
)
message
<<
"on
#{
license
.
expires_at
}
."
if
license
.
expired?
&&
license
.
will_block_changes?
message
<<
"Pushing code and creation of issues and merge requests"
...
...
@@ -67,12 +65,6 @@ module LicenseHelper
message
<<
"to"
message
<<
(
license
.
block_changes?
?
"restore"
:
"ensure uninterrupted"
)
message
<<
"service."
elsif
license
.
warn_upgrade_license_message?
message
<<
"Your GitLab license currently covers
#{
license
.
user_count
}
"
message
<<
"users, but it looks like your site has grown to"
message
<<
"
#{
current_active_user_count
}
users. Please contact"
message
<<
"sales@gitlab.com to increase the number of licensed users."
message
<<
"Note: This message is only visible to you as an admin."
end
message
.
join
(
" "
)
...
...
app/models/license.rb
View file @
d38b4579
...
...
@@ -92,22 +92,6 @@ class License < ActiveRecord::Base
self
.
restrictions
[
:active_user_count
]
end
def
current_user_count
Rails
.
cache
.
fetch
(
"current_active_user_count"
,
expires_in:
1
.
hour
)
do
User
.
active
.
count
end
end
def
warn_upgrade_license_message?
restricted_user_count
=
user_count
return
unless
restricted_user_count
return
false
unless
Time
.
now
>=
self
.
starts_at
+
3
.
months
restricted_user_count
&&
current_user_count
>
restricted_user_count
end
private
def
reset_current
...
...
spec/helpers/license_helper_spec.rb
View file @
d38b4579
...
...
@@ -19,25 +19,5 @@ describe LicenseHelper do
expect
(
license_message
(
signed_in:
true
,
is_admin:
false
)).
to
eq
(
user_msg
)
end
end
context
'license available'
do
let
(
:license
)
{
create
(
:license
)
}
before
do
allow
(
License
).
to
receive
(
:current
).
and_return
(
license
)
end
it
'warn for overusage'
do
allow
(
license
).
to
receive
(
:starts_at
).
and_return
(
Time
.
now
-
3
.
months
)
allow
(
license
).
to
receive
(
:expired?
).
and_return
(
false
)
allow
(
license
).
to
receive
(
:restricted?
).
and_return
(
true
)
allow
(
license
).
to
receive
(
:notify_admins?
).
and_return
(
true
)
allow
(
license
).
to
receive
(
:restrictions
).
and_return
({
active_user_count:
50
})
allow
(
User
).
to
receive
(
:active
).
and_return
(
Array
.
new
(
100
))
warn_msg
=
'Your GitLab license currently covers 50 users, but it looks like your site has grown to 100 users. Please contact sales@gitlab.com to increase the number of licensed users. Note: This message is only visible to you as an admin.'
expect
(
license_message
(
signed_in:
true
,
is_admin:
true
)).
to
eq
(
warn_msg
)
end
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