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
8c9ceb55
Commit
8c9ceb55
authored
Jan 11, 2022
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch '337250-decrease-sub-expiration-banner-duration' into 'master'"
This reverts merge request !77608
parent
00c39d32
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1 addition
and
294 deletions
+1
-294
doc/user/admin_area/license.md
doc/user/admin_area/license.md
+1
-1
ee/app/models/license.rb
ee/app/models/license.rb
+0
-19
ee/spec/features/subscriptions/expiring_subscription_message_spec.rb
...tures/subscriptions/expiring_subscription_message_spec.rb
+0
-144
ee/spec/models/license_spec.rb
ee/spec/models/license_spec.rb
+0
-130
No files found.
doc/user/admin_area/license.md
View file @
8c9ceb55
...
@@ -102,7 +102,7 @@ a license, upload the license in the **Admin Area** in the web user interface.
...
@@ -102,7 +102,7 @@ a license, upload the license in the **Admin Area** in the web user interface.
## What happens when your license expires
## What happens when your license expires
Fifteen days
before the license expires, a message with the upcoming expiration
One month
before the license expires, a message with the upcoming expiration
date displays to GitLab administrators.
date displays to GitLab administrators.
When your license expires, GitLab locks features, like Git pushes
When your license expires, GitLab locks features, like Git pushes
...
...
ee/app/models/license.rb
View file @
8c9ceb55
...
@@ -11,9 +11,6 @@ class License < ApplicationRecord
...
@@ -11,9 +11,6 @@ class License < ApplicationRecord
LICENSE_FILE_TYPE
=
'license_file'
LICENSE_FILE_TYPE
=
'license_file'
ALLOWED_PERCENTAGE_OF_USERS_OVERAGE
=
(
10
/
100.0
)
ALLOWED_PERCENTAGE_OF_USERS_OVERAGE
=
(
10
/
100.0
)
NOTIFICATION_DAYS_BEFORE_TRIAL_EXPIRY
=
1
.
week
ADMIN_NOTIFICATION_DAYS_BEFORE_EXPIRY
=
15
.
days
EE_ALL_PLANS
=
[
STARTER_PLAN
,
PREMIUM_PLAN
,
ULTIMATE_PLAN
].
freeze
EE_ALL_PLANS
=
[
STARTER_PLAN
,
PREMIUM_PLAN
,
ULTIMATE_PLAN
].
freeze
EES_FEATURES_WITH_USAGE_PING
=
%i[
EES_FEATURES_WITH_USAGE_PING
=
%i[
...
@@ -626,22 +623,6 @@ class License < ApplicationRecord
...
@@ -626,22 +623,6 @@ class License < ApplicationRecord
super
||
created_at
super
||
created_at
end
end
# Overrides method from Gitlab::License which will be removed in a future version
def
notify_admins?
return
true
if
expired?
notification_days
=
trial?
?
NOTIFICATION_DAYS_BEFORE_TRIAL_EXPIRY
:
ADMIN_NOTIFICATION_DAYS_BEFORE_EXPIRY
Date
.
today
>=
(
expires_at
-
notification_days
)
end
# Overrides method from Gitlab::License which will be removed in a future version
def
notify_users?
notification_start_date
=
trial?
?
expires_at
-
NOTIFICATION_DAYS_BEFORE_TRIAL_EXPIRY
:
block_changes_at
Date
.
today
>=
notification_start_date
end
private
private
def
restricted_attr
(
name
,
default
=
nil
)
def
restricted_attr
(
name
,
default
=
nil
)
...
...
ee/spec/features/subscriptions/expiring_subscription_message_spec.rb
deleted
100644 → 0
View file @
00c39d32
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'Expiring Subscription Message'
,
:js
,
:freeze_time
do
context
'for self-managed subscriptions'
do
context
'when signed in user is an admin'
do
let_it_be
(
:admin
)
{
create
(
:admin
)
}
before
do
create_current_license
(
plan:
License
::
ULTIMATE_PLAN
,
expires_at:
expires_at
)
sign_in
(
admin
)
gitlab_enable_admin_mode_sign_in
(
admin
)
end
context
'with an expired license'
do
let
(
:expires_at
)
{
Date
.
current
-
1
.
day
}
it
'notifies the admin of the expired subscription'
do
expect
(
page
).
to
have_content
(
'Your subscription expired!'
)
end
end
context
'with a license expiring in 15 days'
do
let
(
:expires_at
)
{
Date
.
current
+
15
.
days
}
it
'notifies the admin of a soon expiring subscription'
do
expect
(
page
).
to
have_content
(
'Your subscription will expire in 15 days'
)
end
end
context
'with a license expiring in more than 15 days'
do
let
(
:expires_at
)
{
Date
.
current
+
16
.
days
}
it
'does not notify the admin of an expiring subscription'
do
expect
(
page
).
not_to
have_content
(
'Your subscription will expire'
)
end
end
end
context
'when signed in user is not an admin'
do
let_it_be
(
:user
)
{
create
(
:user
)
}
before
do
create_current_license
(
plan:
License
::
ULTIMATE_PLAN
,
expires_at:
expires_at
,
block_changes_at:
block_changes_at
)
sign_in
(
user
)
visit
root_path
end
context
'with an expired license in the grace period'
do
let
(
:expires_at
)
{
Date
.
current
-
1
.
day
}
let
(
:block_changes_at
)
{
Date
.
current
+
13
.
days
}
it
'notifies the admin of the expired subscription'
do
expect
(
page
).
not_to
have_content
(
'Your subscription expired!'
)
end
end
context
'with an expired license beyond the grace period'
do
let
(
:expires_at
)
{
Date
.
current
-
15
.
days
}
let
(
:block_changes_at
)
{
Date
.
current
-
1
.
day
}
it
'notifies the admin of the expired subscription'
do
expect
(
page
).
to
have_content
(
'Your subscription expired!'
)
end
end
end
end
context
'for namespace subscriptions'
,
:saas
do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
before
do
enable_namespace_license_check!
create
(
:gitlab_subscription
,
namespace:
group
,
end_date:
end_date
,
auto_renew:
false
)
allow_next_instance_of
(
GitlabSubscriptions
::
CheckFutureRenewalService
,
namespace:
group
)
do
|
service
|
allow
(
service
).
to
receive
(
:execute
).
and_return
(
false
)
end
end
context
'when signed in user is a group owner'
do
before
do
group
.
add_owner
(
user
)
sign_in
(
user
)
visit
group_path
(
group
)
end
context
'with an expired license'
do
let
(
:end_date
)
{
Date
.
current
-
1
.
day
}
it
'notifies the group owner of the expired subscription'
do
expect
(
page
).
to
have_content
(
'Your subscription expired!'
)
end
end
context
'with a license expiring in less than 30 days'
do
let
(
:end_date
)
{
Date
.
current
+
29
.
days
}
it
'notifies the group owner of a soon expiring subscription'
do
expect
(
page
).
to
have_content
(
'Your subscription will expire in 29 days'
)
end
end
context
'with a license expiring in 30 or more days'
do
let
(
:end_date
)
{
Date
.
current
+
30
.
days
}
it
'does not notify the group owner of an expiring subscription'
do
expect
(
page
).
not_to
have_content
(
'Your subscription will expire'
)
end
end
end
context
'when signed in user is not a group owner'
do
before
do
group
.
add_developer
(
user
)
sign_in
(
user
)
visit
group_path
(
group
)
end
context
'with an expired license'
do
let
(
:end_date
)
{
Date
.
current
-
1
.
day
}
it
'does not notify the user of the expired subscription'
do
expect
(
page
).
not_to
have_content
(
'Your subscription expired!'
)
end
end
context
'with a license expiring in less than 30 days'
do
let
(
:end_date
)
{
Date
.
current
+
29
.
days
}
it
'does not notify the user of a soon expiring subscription'
do
expect
(
page
).
not_to
have_content
(
'Your subscription will expire'
)
end
end
end
end
end
ee/spec/models/license_spec.rb
View file @
8c9ceb55
...
@@ -1623,134 +1623,4 @@ RSpec.describe License do
...
@@ -1623,134 +1623,4 @@ RSpec.describe License do
it
{
is_expected
.
to
eq
(
license
.
created_at
)
}
it
{
is_expected
.
to
eq
(
license
.
created_at
)
}
end
end
end
end
describe
'#notify_admins?'
,
:freeze_time
do
subject
(
:notify_admins?
)
{
license
.
notify_admins?
}
context
'when license has expired'
do
before
do
gl_license
.
expires_at
=
Date
.
yesterday
end
it
{
is_expected
.
to
eq
(
true
)
}
end
context
'when license has not expired'
do
context
'when license is a trial'
do
before
do
gl_license
.
restrictions
=
{
trial:
true
}
end
context
'when license expiration is more than a week from today'
do
before
do
gl_license
.
expires_at
=
Date
.
today
+
8
.
days
end
it
{
is_expected
.
to
eq
(
false
)
}
end
context
'when license expiration is a week from today'
do
before
do
gl_license
.
expires_at
=
Date
.
today
+
7
.
days
end
it
{
is_expected
.
to
eq
(
true
)
}
end
context
'when license expiration is less than a week from today'
do
before
do
gl_license
.
expires_at
=
Date
.
today
+
6
.
days
end
it
{
is_expected
.
to
eq
(
true
)
}
end
end
context
'when license is not a trial'
do
context
'when license expiration is more than 15 days from today'
do
before
do
gl_license
.
expires_at
=
Date
.
today
+
16
.
days
end
it
{
is_expected
.
to
eq
(
false
)
}
end
context
'when license expiration is 15 days from today'
do
before
do
gl_license
.
expires_at
=
Date
.
today
+
15
.
days
end
it
{
is_expected
.
to
eq
(
true
)
}
end
context
'when license expiration is less than 15 days from today'
do
before
do
gl_license
.
expires_at
=
Date
.
today
+
14
.
days
end
it
{
is_expected
.
to
eq
(
true
)
}
end
end
end
end
describe
'#notify_users?'
,
:freeze_time
do
subject
(
:notify_users?
)
{
license
.
notify_users?
}
context
'when license is a trial'
do
before
do
gl_license
.
restrictions
=
{
trial:
true
}
end
context
'when license expiration is more than a week from today'
do
before
do
gl_license
.
expires_at
=
Date
.
today
+
8
.
days
end
it
{
is_expected
.
to
eq
(
false
)
}
end
context
'when license expiration is a week from today'
do
before
do
gl_license
.
expires_at
=
Date
.
today
+
7
.
days
end
it
{
is_expected
.
to
eq
(
true
)
}
end
context
'when license expiration is less than a week from today'
do
before
do
gl_license
.
expires_at
=
Date
.
today
+
6
.
days
end
it
{
is_expected
.
to
eq
(
true
)
}
end
end
context
'when license is not a trial'
do
context
'when license block changes date is before today'
do
before
do
gl_license
.
block_changes_at
=
Date
.
today
-
1
.
day
end
it
{
is_expected
.
to
eq
(
true
)
}
end
context
'when license block changes date is today'
do
before
do
gl_license
.
block_changes_at
=
Date
.
today
end
it
{
is_expected
.
to
eq
(
true
)
}
end
context
'when license block changes date is after today'
do
before
do
gl_license
.
block_changes_at
=
Date
.
today
+
1
.
day
end
it
{
is_expected
.
to
eq
(
false
)
}
end
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