Add license expiry messages (#3153)
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
e4cb9141a4
Коммит
0dfac9875e
@@ -750,5 +750,7 @@ export default {
|
||||
MHPNS: 'https://push.mattermost.com',
|
||||
MTPNS: 'http://push-test.mattermost.com',
|
||||
BOT_NAME: 'BOT',
|
||||
POST_COLLAPSE_TIMEOUT: 1000 * 60 * 5 // five minutes
|
||||
POST_COLLAPSE_TIMEOUT: 1000 * 60 * 5, // five minutes
|
||||
LICENSE_EXPIRY_NOTIFICATION: 1000 * 60 * 60 * 24 * 15, // 15 days
|
||||
LICENSE_GRACE_PERIOD: 1000 * 60 * 60 * 24 * 15 // 15 days
|
||||
};
|
||||
|
||||
45
webapp/utils/license_utils.jsx
Обычный файл
45
webapp/utils/license_utils.jsx
Обычный файл
@@ -0,0 +1,45 @@
|
||||
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
import Constants from 'utils/constants.jsx';
|
||||
|
||||
import React from 'react';
|
||||
import {FormattedDate} from 'react-intl';
|
||||
|
||||
export function isLicenseExpiring() {
|
||||
if (window.mm_license.IsLicensed !== 'true') {
|
||||
return false;
|
||||
}
|
||||
|
||||
const timeDiff = parseInt(global.window.mm_license.ExpiresAt, 10) - Date.now();
|
||||
return timeDiff <= Constants.LICENSE_EXPIRY_NOTIFICATION;
|
||||
}
|
||||
|
||||
export function isLicenseExpired() {
|
||||
if (window.mm_license.IsLicensed !== 'true') {
|
||||
return false;
|
||||
}
|
||||
|
||||
const timeDiff = parseInt(global.window.mm_license.ExpiresAt, 10) - Date.now();
|
||||
return timeDiff < 0;
|
||||
}
|
||||
|
||||
export function isLicensePastGracePeriod() {
|
||||
if (window.mm_license.IsLicensed !== 'true') {
|
||||
return false;
|
||||
}
|
||||
|
||||
const timeDiff = Date.now() - parseInt(global.window.mm_license.ExpiresAt, 10);
|
||||
return timeDiff > Constants.LICENSE_GRACE_PERIOD;
|
||||
}
|
||||
|
||||
export function displayExpiryDate() {
|
||||
return (
|
||||
<FormattedDate
|
||||
value={new Date(parseInt(global.window.mm_license.ExpiresAt, 10))}
|
||||
day='2-digit'
|
||||
month='long'
|
||||
year='numeric'
|
||||
/>
|
||||
);
|
||||
}
|
||||
Ссылка в новой задаче
Block a user