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
c518549f
Commit
c518549f
authored
Feb 25, 2020
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove license check warning message on boot
We already show this message on the web so this is not needed
parent
33ad59e2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
53 deletions
+25
-53
config/initializers/0_license.rb
config/initializers/0_license.rb
+5
-15
ee/app/helpers/license_helper.rb
ee/app/helpers/license_helper.rb
+11
-16
ee/spec/helpers/license_helper_spec.rb
ee/spec/helpers/license_helper_spec.rb
+9
-22
No files found.
config/initializers/0_license.rb
View file @
c518549f
# frozen_string_literal: true
Gitlab
.
ee
do
begin
public_key_file
=
File
.
read
(
Rails
.
root
.
join
(
".license_encryption_key.pub"
))
public_key
=
OpenSSL
::
PKey
::
RSA
.
new
(
public_key_file
)
Gitlab
::
License
.
encryption_key
=
public_key
rescue
rescue
warn
"WARNING: No valid license encryption key provided."
end
# Needed to run migration
if
ActiveRecord
::
Base
.
connected?
&&
ActiveRecord
::
Base
.
connection
.
table_exists?
(
'licenses'
)
message
=
LicenseHelper
.
license_message
(
signed_in:
true
,
is_admin:
true
,
in_html:
false
)
if
::
License
.
block_changes?
&&
message
.
present?
warn
"WARNING:
#{
message
}
"
end
end
end
ee/app/helpers/license_helper.rb
View file @
c518549f
...
...
@@ -18,7 +18,7 @@ module LicenseHelper
License
.
current
&
.
maximum_user_count
||
0
end
def
license_message
(
signed_in:
signed_in?
,
is_admin:
current_user
&
.
admin?
,
in_html:
true
)
def
license_message
(
signed_in:
signed_in?
,
is_admin:
current_user
&
.
admin?
)
return
unless
current_license
return
unless
signed_in
return
unless
(
is_admin
&&
current_license
.
notify_admins?
)
||
current_license
.
notify_users?
...
...
@@ -35,9 +35,7 @@ module LicenseHelper
message
<<
block_changes_message
message
<<
if
is_admin
message
<<
if
is_admin
'Upload a new license in the admin area'
else
'Ask an admin to upload a new license'
...
...
@@ -48,7 +46,7 @@ module LicenseHelper
message
<<
'service.'
end
message
<<
renewal_instructions_message
(
in_html:
in_html
)
unless
is_trial
message
<<
renewal_instructions_message
unless
is_trial
message
.
join
(
' '
).
html_safe
end
...
...
@@ -144,15 +142,12 @@ module LicenseHelper
User
.
active
.
count
end
def
renewal_instructions_message
(
in_html:
true
)
def
renewal_instructions_message
renewal_faq_url
=
'https://about.gitlab.com/pricing/licensing-faq/#self-managed-gitlab'
renewal_faq_link_start
=
in_html
?
"<a href='
#{
renewal_faq_url
}
' target='_blank'>"
.
html_safe
:
''
link_end
=
in_html
?
'</a>'
.
html_safe
:
''
message
=
_
(
'For renewal instructions %{link_start}view our Licensing FAQ.%{link_end}'
)
%
{
link_start:
renewal_faq_link_start
,
link_end:
link_end
}
message
+=
' '
+
renewal_faq_url
unless
in_html
renewal_faq_link_start
=
"<a href='
#{
renewal_faq_url
}
' target='_blank'>"
.
html_safe
link_end
=
'</a>'
.
html_safe
message
_
(
'For renewal instructions %{link_start}view our Licensing FAQ.%{link_end}'
)
%
{
link_start:
renewal_faq_link_start
,
link_end:
link_end
}
end
end
ee/spec/helpers/license_helper_spec.rb
View file @
c518549f
...
...
@@ -10,7 +10,10 @@ describe LicenseHelper do
describe
'#license_message'
do
context
'license installed'
do
subject
{
license_message
(
signed_in:
true
,
is_admin:
false
)
}
let
(
:license
)
{
double
(
'License'
)
}
let
(
:faq_link_regex
)
{
/For renewal instructions <a href.*>view our Licensing FAQ\.<\/a>/
}
before
do
allow
(
License
).
to
receive
(
:current
).
and_return
(
license
)
...
...
@@ -19,11 +22,6 @@ describe LicenseHelper do
allow
(
license
).
to
receive
(
:remaining_days
).
and_return
(
4
)
end
context
'in HTML'
do
let
(
:faq_link_regex
)
{
/For renewal instructions <a href.*>view our Licensing FAQ\.<\/a>/
}
subject
{
license_message
(
signed_in:
true
,
is_admin:
false
)
}
it
'does NOT have a license faq link if license is a trial'
do
allow
(
license
).
to
receive
(
:trial?
).
and_return
(
true
)
...
...
@@ -37,17 +35,6 @@ describe LicenseHelper do
end
end
context
'not in HTML'
do
subject
{
license_message
(
signed_in:
true
,
is_admin:
false
,
in_html:
false
)
}
it
'has license faq link if license is not a trial'
do
allow
(
license
).
to
receive
(
:trial?
).
and_return
(
false
)
expect
(
subject
).
to
match
(
/For renewal instructions view our Licensing FAQ. https:.*/
)
end
end
end
context
'no license installed'
do
before
do
allow
(
License
).
to
receive
(
:current
).
and_return
(
nil
)
...
...
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