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
4e306ccf
Commit
4e306ccf
authored
Feb 18, 2021
by
Mark Chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update expiry setting when license is created
Fix API license endpoint not updating expiry setting bug.
parent
00d64e00
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
10 deletions
+13
-10
changelogs/unreleased/301032-license-creation-via-api.yml
changelogs/unreleased/301032-license-creation-via-api.yml
+5
-0
ee/app/controllers/admin/licenses_controller.rb
ee/app/controllers/admin/licenses_controller.rb
+0
-2
ee/app/models/license.rb
ee/app/models/license.rb
+1
-0
ee/spec/models/license_spec.rb
ee/spec/models/license_spec.rb
+7
-8
No files found.
changelogs/unreleased/301032-license-creation-via-api.yml
0 → 100644
View file @
4e306ccf
---
title
:
Hide repeated trial offers on self-hosted instances
merge_request
:
54550
author
:
type
:
fixed
ee/app/controllers/admin/licenses_controller.rb
View file @
4e306ccf
...
...
@@ -39,8 +39,6 @@ class Admin::LicensesController < Admin::ApplicationController
respond_with
(
@license
,
location:
admin_license_path
)
do
if
@license
.
save
@license
.
update_trial_setting
notice
=
if
@license
.
started?
_
(
'The license was successfully uploaded and is now active. You can see the details below.'
)
else
...
...
ee/app/models/license.rb
View file @
4e306ccf
...
...
@@ -240,6 +240,7 @@ class License < ApplicationRecord
before_validation
:reset_license
,
if: :data_changed?
after_create
:reset_current
after_create
:update_trial_setting
after_destroy
:reset_current
after_commit
:reset_future_dated
,
on:
[
:create
,
:destroy
]
after_commit
:reset_previous
,
on:
[
:create
,
:destroy
]
...
...
ee/spec/models/license_spec.rb
View file @
4e306ccf
...
...
@@ -1229,9 +1229,9 @@ RSpec.describe License do
gl_license
.
expires_at
=
Date
.
tomorrow
end
it
'
returns nil
'
do
updated
=
license
.
update_trial_setting
expect
(
updated
).
to
be_nil
it
'
does nothing
'
do
license
.
save
expect
(
ApplicationSetting
.
current
.
license_trial_ends_on
).
to
be_nil
end
end
...
...
@@ -1248,10 +1248,9 @@ RSpec.describe License do
expect
(
described_class
.
eligible_for_trial?
).
to
be_truthy
end
it
'updates the trial setting'
do
updated
=
license
.
update_trial_setting
it
'updates the trial setting
during create
'
do
license
.
save
expect
(
updated
).
to
be_truthy
expect
(
described_class
.
eligible_for_trial?
).
to
be_falsey
expect
(
ApplicationSetting
.
current
.
license_trial_ends_on
).
to
eq
(
tomorrow
)
end
...
...
@@ -1267,8 +1266,8 @@ RSpec.describe License do
end
it
'does not update existing trial setting'
do
updated
=
license
.
update_trial_setting
expect
(
updated
).
to
be_falsey
license
.
save
expect
(
ApplicationSetting
.
current
.
license_trial_ends_on
).
to
eq
(
yesterday
)
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