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
764bead2
Commit
764bead2
authored
Apr 15, 2021
by
Stan Hu
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '325541_use_licensee_methods' into 'master'
Use licensee methods See merge request gitlab-org/gitlab!59364
parents
c2f72d60
74e6b606
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
6 deletions
+24
-6
ee/app/models/license.rb
ee/app/models/license.rb
+1
-1
ee/app/services/historical_user_data/csv_service.rb
ee/app/services/historical_user_data/csv_service.rb
+2
-2
ee/app/views/admin/licenses/_summary.html.haml
ee/app/views/admin/licenses/_summary.html.haml
+2
-2
ee/app/workers/active_user_count_threshold_worker.rb
ee/app/workers/active_user_count_threshold_worker.rb
+1
-1
ee/spec/models/license_spec.rb
ee/spec/models/license_spec.rb
+18
-0
No files found.
ee/app/models/license.rb
View file @
764bead2
...
...
@@ -361,7 +361,7 @@ class License < ApplicationRecord
end
def
data_filename
company_name
=
self
.
licensee
[
"Company"
]
||
self
.
licensee
.
each_value
.
first
company_name
=
self
.
licensee
_company
||
self
.
licensee
.
each_value
.
first
clean_company_name
=
company_name
.
gsub
(
/[^A-Za-z0-9]/
,
""
)
"
#{
clean_company_name
}
.gitlab-license"
end
...
...
ee/app/services/historical_user_data/csv_service.rb
View file @
764bead2
...
...
@@ -34,10 +34,10 @@ module HistoricalUserData
def
header_csv
CSV
.
generate
do
|
csv
|
csv
<<
[
'License Key'
,
license
.
data
]
csv
<<
[
'Email'
,
license
.
licensee
[
'Email'
]
]
csv
<<
[
'Email'
,
license
.
licensee
_email
]
csv
<<
[
'License Start Date'
,
license
.
starts_at
&
.
to_s
(
:csv
)]
csv
<<
[
'License End Date'
,
license
.
expires_at
&
.
to_s
(
:csv
)]
csv
<<
[
'Company'
,
license
.
licensee
[
'Company'
]
]
csv
<<
[
'Company'
,
license
.
licensee
_company
]
csv
<<
[
'Generated At'
,
Time
.
current
.
to_s
(
:csv
)]
csv
<<
[
''
]
end
...
...
ee/app/views/admin/licenses/_summary.html.haml
View file @
764bead2
...
...
@@ -11,7 +11,7 @@
=
render
'admin/licenses/license_status'
%span
.gl-ml-5
=
_
(
'Licensed to:'
)
%strong
=
@license
.
licensee
[
'Name'
]
=
"(
#{
@license
.
licensee
[
'Email'
]
}
)"
%strong
=
@license
.
licensee
_name
=
"(
#{
@license
.
licensee
_email
}
)"
%div
=
link_to
'View details'
,
admin_license_path
,
class:
"gl-button btn btn-default"
ee/app/workers/active_user_count_threshold_worker.rb
View file @
764bead2
...
...
@@ -21,7 +21,7 @@ class ActiveUserCountThresholdWorker # rubocop:disable Scalability/IdempotentWor
.
to_set
# rubocop:enable CodeReuse/ActiveRecord
recipients
<<
license
.
licensee
[
"Email"
]
if
license
.
licensee
[
"Email"
]
recipients
<<
license
.
licensee
_email
if
license
.
licensee_email
LicenseMailer
.
approaching_active_user_count_limit
(
recipients
.
to_a
)
end
...
...
ee/spec/models/license_spec.rb
View file @
764bead2
...
...
@@ -755,6 +755,24 @@ RSpec.describe License do
end
end
describe
"#data_filename"
do
subject
{
license
.
data_filename
}
context
'when licensee includes company information'
do
let
(
:gl_license
)
do
build
(
:gitlab_license
,
licensee:
{
'Company'
=>
' Example & Partner Inc. 2 '
,
'Name'
=>
'User Example'
})
end
it
{
is_expected
.
to
eq
(
'ExamplePartnerInc2.gitlab-license'
)
}
end
context
'when licensee does not include company information'
do
let
(
:gl_license
)
{
build
(
:gitlab_license
,
licensee:
{
'Name'
=>
'User Example'
})
}
it
{
is_expected
.
to
eq
(
'UserExample.gitlab-license'
)
}
end
end
describe
"#md5"
do
it
"returns the same MD5 for licenses with carriage returns and those without"
do
other_license
=
build
(
:license
,
data:
license
.
data
.
gsub
(
"
\n
"
,
"
\r\n
"
))
...
...
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