mirror of
https://github.com/wassname/talk.git
synced 2026-08-09 12:30:42 +08:00
5.4.0 Release Bug Fixes (#2789)
* fix: addresses CORL-848 Fixed copy for new commenters feature. * fix: address CORL-847 Revert the line hight changes on select fields for now. * fix: addressed CORL-851 Changed copy on CSS field. * fix: addressed CORL-840 Changed deletion window to 24 hours. Refactored durations to use TIME enum.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import TIME from "./time";
|
||||
|
||||
/**
|
||||
* CLIENT_ID_HEADER references the name of the header used to extract/send the
|
||||
* client ID to enable automatic de-duplication.
|
||||
@@ -36,30 +38,32 @@ export const TOXICITY_ENDPOINT_DEFAULT =
|
||||
"https://commentanalyzer.googleapis.com/v1alpha1";
|
||||
|
||||
/**
|
||||
* DOWNLOAD_LIMIT_TIMEFRAME is the number of seconds that a given download may
|
||||
* be made within.
|
||||
* DOWNLOAD_LIMIT_TIMEFRAME_DURATION is the number of seconds that a given
|
||||
* download may be made within.
|
||||
*/
|
||||
export const DOWNLOAD_LIMIT_TIMEFRAME = 14 * 86400;
|
||||
export const DOWNLOAD_LIMIT_TIMEFRAME_DURATION = 14 * TIME.DAY;
|
||||
|
||||
/**
|
||||
* ALLOWED_USERNAME_CHANGE_FREQUENCY is the length of time in seconds a user must wait after changing their username to change it again.
|
||||
* ALLOWED_USERNAME_CHANGE_TIMEFRAME_DURATION is the length of time in seconds
|
||||
* a user must wait after changing their username to change it again.
|
||||
*/
|
||||
export const ALLOWED_USERNAME_CHANGE_FREQUENCY = 14 * 86400;
|
||||
export const ALLOWED_USERNAME_CHANGE_TIMEFRAME_DURATION = 14 * TIME.DAY;
|
||||
|
||||
/**
|
||||
* SCHEDULED_DELETION_TIMESPAN_DAYS is the length of time in days a user
|
||||
* will have to wait for their account to be deleted after requesting a
|
||||
* deletion.
|
||||
* SCHEDULED_DELETION_TIMEFRAME is the length of time in seconds a user will
|
||||
* have to wait for their account to be deleted after requesting a deletion.
|
||||
*/
|
||||
export const SCHEDULED_DELETION_TIMESPAN_DAYS = 14;
|
||||
export const SCHEDULED_DELETION_WINDOW_DURATION = 1 * TIME.DAY;
|
||||
|
||||
/**
|
||||
* DEFAULT_SESSION_LENTTH is the length of time in seconds a session is valid for unless configured in tenant.
|
||||
* DEFAULT_SESSION_DURATION is the length of time in seconds a session is valid
|
||||
* for unless configured in tenant.
|
||||
*/
|
||||
export const DEFAULT_SESSION_LENGTH = 7776000;
|
||||
export const DEFAULT_SESSION_DURATION = 90 * TIME.DAY;
|
||||
|
||||
/**
|
||||
* COMMENT_REPEAT_POST_TIMESPAN is the length of time in seconds that a previous comment ID is stored for a
|
||||
* user to prevent them from posting the same comment repeatedly.
|
||||
* COMMENT_REPEAT_POST_DURATION is the length of time in seconds that a
|
||||
* previous comment ID is stored for a user to prevent them from posting the
|
||||
* same comment repeatedly.
|
||||
*/
|
||||
export const COMMENT_REPEAT_POST_TIMESPAN = 21600;
|
||||
export const COMMENT_REPEAT_POST_DURATION = 6 * TIME.MINUTE;
|
||||
|
||||
@@ -1,29 +1,19 @@
|
||||
/**
|
||||
* UNIT are units that can be used in the
|
||||
* DurationField components.
|
||||
*/
|
||||
export enum UNIT {
|
||||
SECONDS = 1,
|
||||
MINUTES = 60,
|
||||
HOURS = 3600,
|
||||
DAYS = 86400,
|
||||
WEEKS = 604800,
|
||||
}
|
||||
import TIME from "coral-common/time";
|
||||
|
||||
export const UNIT_MAP = {
|
||||
[UNIT.SECONDS]: "second",
|
||||
[UNIT.MINUTES]: "minute",
|
||||
[UNIT.HOURS]: "hour",
|
||||
[UNIT.DAYS]: "day",
|
||||
[UNIT.WEEKS]: "week",
|
||||
[TIME.SECOND]: "second",
|
||||
[TIME.MINUTE]: "minute",
|
||||
[TIME.HOUR]: "hour",
|
||||
[TIME.DAY]: "day",
|
||||
[TIME.WEEK]: "week",
|
||||
};
|
||||
|
||||
export const DEFAULT_UNITS = [
|
||||
UNIT.WEEKS,
|
||||
UNIT.DAYS,
|
||||
UNIT.HOURS,
|
||||
UNIT.MINUTES,
|
||||
UNIT.SECONDS,
|
||||
TIME.WEEK,
|
||||
TIME.DAY,
|
||||
TIME.HOUR,
|
||||
TIME.MINUTE,
|
||||
TIME.SECOND,
|
||||
];
|
||||
|
||||
type ValueOf<T> = T[keyof T];
|
||||
@@ -37,11 +27,11 @@ export interface ScaledUnit {
|
||||
|
||||
export default function reduceSeconds(
|
||||
value: number,
|
||||
units: UNIT[] = DEFAULT_UNITS
|
||||
units: TIME[] = DEFAULT_UNITS
|
||||
): ScaledUnit {
|
||||
// Find the largest match for the smallest number.
|
||||
const unit: keyof typeof UNIT_MAP =
|
||||
units.find(compare => value >= compare) || UNIT.SECONDS;
|
||||
units.find(compare => value >= compare) || TIME.SECOND;
|
||||
|
||||
// Scale the value to the unit.
|
||||
const scaled = Math.round((value / unit) * 100) / 100;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* TIME represends various constants for second representations of times.
|
||||
*/
|
||||
enum TIME {
|
||||
SECOND = 1,
|
||||
MINUTE = 60 * TIME.SECOND,
|
||||
HOUR = 60 * TIME.MINUTE,
|
||||
DAY = 24 * TIME.HOUR,
|
||||
WEEK = 7 * TIME.DAY,
|
||||
}
|
||||
|
||||
export default TIME;
|
||||
Reference in New Issue
Block a user