Skip to content
Snippets Groups Projects

Notify admins 15 days prior to license expiration

Merged Tyler Amos requested to merge 337250-decrease-sub-expiration-banner-duration into master
All threads resolved!

What does this MR do and why?

Related to #337250 (closed)

As stated in #337250 (closed), the subscription expiration banner was being shown to SM Admins up to a month before the license expiration. However, SM customers aren't able to renew their subscriptions until 15 days prior to expiration (or later). This led to some understandable confusion from customers where the warning didn't align with the call to action.

The agreed solution was to align the admin notification timing with the renewal ability (15 days prior). It was found that the admin and user notification windows is actually set by 2 attributes in the Gitlab::License object. IOW, the timing was being driven by the license key and not logic in the GitLab codebase. We decided to change this so that GitLab has this notification logic and we will remove the attributes from the Gitlab::License class as it was unnecessary.

In this MR, the notification method, notify_admins?, in Gitlab::License is overridden so that admins are notified only 15 days prior to license expiration. Similarly, the notification method, notify_users?, is overridden for consistency. This will allow us to remove these methods from Gitlab::License at some point in the future.

Screenshots or screen recordings

Example of expiring license admin notification

Screen_Shot_2022-01-05_at_4.41.40_PM

Example of expired license admin notification

Screen_Shot_2022-01-05_at_4.42.52_PM

How to set up and validate locally

I was able to test this by uploading license keys under various conditions. Here's the procedure I followed:

  1. Generate a license key manually using CustomersDot Admin, http://localhost:5000/admin/license/new_license
  2. Upload the license key in the SM instance, http://localhost:3000/admin/license/new
  3. Visit any page to see the notification. You can visit as an admin or a regular user to see various scenarios.

Examples:

  • Upload a license that expires in 2 days; see that the notification banner shows for Admins but not for Users.
  • Upload a license that expires in 16 days; see that no notification banner shows for Admins or Users.
  • Upload a license that expired 2 days ago; see that the expired notification banner shows for Admins but not Users.
  • Upload a license that expired more than 2 weeks ago; see that the expired notification banner shows for both Admins and Users.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Tyler Amos

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Shreyas Agarwal
  • Tyler Amos added 1 commit

    added 1 commit

    • 6fc41ce3 - Notify admins 15 days prior to license expiration

    Compare with previous version

  • Tyler Amos resolved all threads

    resolved all threads

  • Shreyas Agarwal approved this merge request

    approved this merge request

  • Shreyas Agarwal resolved all threads

    resolved all threads

  • @tyleramos The changes LGTM. Approved from my end.

  • Shreyas Agarwal removed review request for @shreyasagarwal

    removed review request for @shreyasagarwal

  • Tyler Amos requested review from @dskim_gitlab and removed review request for @sselhorn

    requested review from @dskim_gitlab and removed review request for @sselhorn

  • Sincheol (David) Kim removed review request for @dskim_gitlab

    removed review request for @dskim_gitlab

  • Tyler Amos added 1 commit

    added 1 commit

    • 9c1ff2d4 - Notify admins 15 days prior to license expiration

    Compare with previous version

  • Tyler Amos requested review from @dskim_gitlab

    requested review from @dskim_gitlab

  • Sincheol (David) Kim removed review request for @dskim_gitlab

    removed review request for @dskim_gitlab

  • Tyler Amos added 1 commit

    added 1 commit

    • b07a83f7 - Notify admins 15 days prior to license expiration

    Compare with previous version

  • Tyler Amos requested review from @dskim_gitlab

    requested review from @dskim_gitlab

  • Sincheol (David) Kim approved this merge request

    approved this merge request

  • Sincheol (David) Kim resolved all threads

    resolved all threads

  • mentioned in commit 737ecf8b

  • resolved all threads

  • Rémy Coutable mentioned in commit 8c9ceb55

    mentioned in commit 8c9ceb55

  • Rémy Coutable mentioned in merge request !77966 (merged)

    mentioned in merge request !77966 (merged)

  • Tyler Amos mentioned in merge request !78000 (merged)

    mentioned in merge request !78000 (merged)

  • Author Developer

    I opened !78000 (merged) as my next attempt at getting this fix merged. It includes a fix for the problem found about when a instance's license has no expiration. :pray:

  • added workflowcanary label and removed workflowstaging label

  • added workflowproduction label and removed workflowcanary label

  • Anastasia McDonald mentioned in merge request !80121 (merged)

    mentioned in merge request !80121 (merged)

  • Please register or sign in to reply
    Loading