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
Hide 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
...
@@ -39,8 +39,6 @@ class Admin::LicensesController < Admin::ApplicationController
respond_with
(
@license
,
location:
admin_license_path
)
do
respond_with
(
@license
,
location:
admin_license_path
)
do
if
@license
.
save
if
@license
.
save
@license
.
update_trial_setting
notice
=
if
@license
.
started?
notice
=
if
@license
.
started?
_
(
'The license was successfully uploaded and is now active. You can see the details below.'
)
_
(
'The license was successfully uploaded and is now active. You can see the details below.'
)
else
else
...
...
ee/app/models/license.rb
View file @
4e306ccf
...
@@ -240,6 +240,7 @@ class License < ApplicationRecord
...
@@ -240,6 +240,7 @@ class License < ApplicationRecord
before_validation
:reset_license
,
if: :data_changed?
before_validation
:reset_license
,
if: :data_changed?
after_create
:reset_current
after_create
:reset_current
after_create
:update_trial_setting
after_destroy
:reset_current
after_destroy
:reset_current
after_commit
:reset_future_dated
,
on:
[
:create
,
:destroy
]
after_commit
:reset_future_dated
,
on:
[
:create
,
:destroy
]
after_commit
:reset_previous
,
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
...
@@ -1229,9 +1229,9 @@ RSpec.describe License do
gl_license
.
expires_at
=
Date
.
tomorrow
gl_license
.
expires_at
=
Date
.
tomorrow
end
end
it
'
returns nil
'
do
it
'
does nothing
'
do
updated
=
license
.
update_trial_setting
license
.
save
expect
(
updated
).
to
be_nil
expect
(
ApplicationSetting
.
current
.
license_trial_ends_on
).
to
be_nil
expect
(
ApplicationSetting
.
current
.
license_trial_ends_on
).
to
be_nil
end
end
end
end
...
@@ -1248,10 +1248,9 @@ RSpec.describe License do
...
@@ -1248,10 +1248,9 @@ RSpec.describe License do
expect
(
described_class
.
eligible_for_trial?
).
to
be_truthy
expect
(
described_class
.
eligible_for_trial?
).
to
be_truthy
end
end
it
'updates the trial setting'
do
it
'updates the trial setting
during create
'
do
updated
=
license
.
update_trial_setting
license
.
save
expect
(
updated
).
to
be_truthy
expect
(
described_class
.
eligible_for_trial?
).
to
be_falsey
expect
(
described_class
.
eligible_for_trial?
).
to
be_falsey
expect
(
ApplicationSetting
.
current
.
license_trial_ends_on
).
to
eq
(
tomorrow
)
expect
(
ApplicationSetting
.
current
.
license_trial_ends_on
).
to
eq
(
tomorrow
)
end
end
...
@@ -1267,8 +1266,8 @@ RSpec.describe License do
...
@@ -1267,8 +1266,8 @@ RSpec.describe License do
end
end
it
'does not update existing trial setting'
do
it
'does not update existing trial setting'
do
updated
=
license
.
update_trial_setting
license
.
save
expect
(
updated
).
to
be_falsey
expect
(
ApplicationSetting
.
current
.
license_trial_ends_on
).
to
eq
(
yesterday
)
expect
(
ApplicationSetting
.
current
.
license_trial_ends_on
).
to
eq
(
yesterday
)
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