From 9b8ab6de5fe40f775cc75ad4e896a3fdd88ddc4d Mon Sep 17 00:00:00 2001
From: Wyatt Johnson
Date: Tue, 14 Jan 2020 16:39:21 +0000
Subject: [PATCH] 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.
---
.vscode/settings.json | 3 +
.../UserHistoryDrawer/RecentHistory.tsx | 5 +-
.../sections/Advanced/CustomCSSConfig.tsx | 7 +-
.../General/ClosingCommentStreamsConfig.tsx | 6 +-
.../sections/General/CommentEditingConfig.tsx | 6 +-
.../Moderation/NewCommentersConfig.tsx | 2 +-
.../Moderation/RecentCommentHistoryConfig.tsx | 2 +-
.../__snapshots__/advanced.spec.tsx.snap | 2 +-
.../__snapshots__/moderation.spec.tsx.snap | 2 +-
src/core/client/admin/test/fixtures.ts | 10 +-
.../components/DurationField.spec.tsx | 8 +-
.../framework/components/DurationField.tsx | 24 +-
.../framework/lib/network/createNetwork.ts | 4 +-
.../StreamDeletionRequestCalloutContainer.tsx | 16 +-
.../ChangeUsernameContainer.tsx | 19 +-
.../Pages/RequestAccountDeletionMutation.tsx | 9 +-
.../Settings/DownloadCommentsContainer.tsx | 15 +-
.../v2/DurationField/DurationField.spec.tsx | 8 +-
.../v2/DurationField/DurationField.tsx | 24 +-
.../components/v2/SelectField/SelectField.css | 2 +-
src/core/client/ui/theme/variables2.ts | 1 -
src/core/common/constants.ts | 32 +-
src/core/common/helpers/i18n/reduceSeconds.ts | 36 +-
src/core/common/time.ts | 12 +
src/core/server/errors/index.ts | 15 +-
src/core/server/models/story/helpers.ts | 10 +-
src/core/server/models/tenant/tenant.ts | 16 +-
src/core/server/queue/Task.ts | 6 +-
src/core/server/services/comments/comments.ts | 10 +-
src/core/server/services/jwt/index.ts | 4 +-
src/core/server/services/users/users.ts | 16 +-
src/core/server/stacks/editComment.ts | 10 +-
src/locales/da/admin.ftl | 4 +-
src/locales/en-US/admin.ftl | 6 +-
src/locales/fr-FR/admin.ftl | 1756 ++++++++---------
src/locales/pt-BR/admin.ftl | 16 +-
36 files changed, 1061 insertions(+), 1063 deletions(-)
create mode 100644 src/core/common/time.ts
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 2c4bf4a1a..91e78f999 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -55,4 +55,7 @@
"__generated__"
],
"debug.node.autoAttach": "on",
+ "search.exclude": {
+ "package-lock.json": true
+ },
}
diff --git a/src/core/client/admin/components/UserHistoryDrawer/RecentHistory.tsx b/src/core/client/admin/components/UserHistoryDrawer/RecentHistory.tsx
index adcbfbeaa..dac85cdc4 100644
--- a/src/core/client/admin/components/UserHistoryDrawer/RecentHistory.tsx
+++ b/src/core/client/admin/components/UserHistoryDrawer/RecentHistory.tsx
@@ -2,7 +2,8 @@ import { Localized } from "@fluent/react/compat";
import cn from "classnames";
import React, { FunctionComponent } from "react";
-import { reduceSeconds, UNIT } from "coral-common/helpers/i18n";
+import { reduceSeconds } from "coral-common/helpers/i18n";
+import TIME from "coral-common/time";
import {
Flex,
HorizontalGutter,
@@ -25,7 +26,7 @@ const RecentHistory: FunctionComponent = ({
rejectionRate,
submitted,
}) => {
- const { scaled, unit } = reduceSeconds(timeFrame, [UNIT.DAYS]);
+ const { scaled, unit } = reduceSeconds(timeFrame, [TIME.DAY]);
return (
diff --git a/src/core/client/admin/routes/Configure/sections/Advanced/CustomCSSConfig.tsx b/src/core/client/admin/routes/Configure/sections/Advanced/CustomCSSConfig.tsx
index bce7da112..a0c92ef42 100644
--- a/src/core/client/admin/routes/Configure/sections/Advanced/CustomCSSConfig.tsx
+++ b/src/core/client/admin/routes/Configure/sections/Advanced/CustomCSSConfig.tsx
@@ -30,13 +30,10 @@ const CustomCSSConfig: FunctionComponent = ({ disabled }) => (
}
>
- }
- >
+ }>
URL of a CSS stylesheet that will override default Embed Stream
- styles. Can be internal or external.
+ styles.
diff --git a/src/core/client/admin/routes/Configure/sections/General/ClosingCommentStreamsConfig.tsx b/src/core/client/admin/routes/Configure/sections/General/ClosingCommentStreamsConfig.tsx
index 708b56cf1..b0b86de0e 100644
--- a/src/core/client/admin/routes/Configure/sections/General/ClosingCommentStreamsConfig.tsx
+++ b/src/core/client/admin/routes/Configure/sections/General/ClosingCommentStreamsConfig.tsx
@@ -80,9 +80,9 @@ const ClosingCommentStreamsConfig: FunctionComponent = ({
= ({ disabled }) => (
= ({ disabled }) => {
= ({ disabled }) => {
{({ input, meta }) => (
<>
- URL of a CSS stylesheet that will override default Embed Stream styles. Can be internal or external.
+ URL of a CSS stylesheet that will override default Embed Stream styles.
- Number of first comments sent for approval
+ Number of comments that must be approved
({
},
recentCommentHistory: {
enabled: false,
- // 7 days in seconds.
- timeFrame: 604800,
+ timeFrame: 7 * TIME.DAY,
// Rejection rate defaulting to 30%, once exceeded, comments will be
// pre-moderated.
triggerRejectionRate: 0.3,
@@ -94,7 +94,7 @@ export const settings = createFixture
({
},
},
auth: {
- sessionDuration: DEFAULT_SESSION_LENGTH,
+ sessionDuration: DEFAULT_SESSION_DURATION,
integrations: {
local: {
enabled: true,
@@ -175,7 +175,7 @@ export const settingsWithEmptyAuth = createFixture(
{
id: "settings",
auth: {
- sessionDuration: DEFAULT_SESSION_LENGTH,
+ sessionDuration: DEFAULT_SESSION_DURATION,
integrations: {
local: {
enabled: true,
diff --git a/src/core/client/framework/components/DurationField.spec.tsx b/src/core/client/framework/components/DurationField.spec.tsx
index 7cea24a92..b989597d7 100644
--- a/src/core/client/framework/components/DurationField.spec.tsx
+++ b/src/core/client/framework/components/DurationField.spec.tsx
@@ -24,7 +24,7 @@ it("renders correctly with specified units", () => {
value: "",
disabled: false,
onChange: noop,
- units: [DURATION_UNIT.SECONDS, DURATION_UNIT.HOURS],
+ units: [DURATION_UNIT.SECOND, DURATION_UNIT.HOUR],
};
const renderer = createRenderer();
renderer.render();
@@ -37,7 +37,7 @@ it("use best matching unit", () => {
value: "3600",
disabled: false,
onChange: noop,
- units: [DURATION_UNIT.SECONDS, DURATION_UNIT.MINUTES, DURATION_UNIT.HOURS],
+ units: [DURATION_UNIT.SECOND, DURATION_UNIT.MINUTE, DURATION_UNIT.HOUR],
};
const renderer = createRenderer();
renderer.render();
@@ -50,7 +50,7 @@ it("use initial unit if 0", () => {
value: "0",
disabled: false,
onChange: noop,
- units: [DURATION_UNIT.SECONDS, DURATION_UNIT.MINUTES, DURATION_UNIT.HOURS],
+ units: [DURATION_UNIT.SECOND, DURATION_UNIT.MINUTE, DURATION_UNIT.HOUR],
};
const renderer = createRenderer();
renderer.render();
@@ -63,7 +63,7 @@ it("accepts invalid input", () => {
value: "this is so invalid",
disabled: false,
onChange: noop,
- units: [DURATION_UNIT.SECONDS, DURATION_UNIT.MINUTES, DURATION_UNIT.HOURS],
+ units: [DURATION_UNIT.SECOND, DURATION_UNIT.MINUTE, DURATION_UNIT.HOUR],
};
const renderer = createRenderer();
renderer.render();
diff --git a/src/core/client/framework/components/DurationField.tsx b/src/core/client/framework/components/DurationField.tsx
index 915b8274a..619c6a53f 100644
--- a/src/core/client/framework/components/DurationField.tsx
+++ b/src/core/client/framework/components/DurationField.tsx
@@ -8,7 +8,7 @@ import React, {
useState,
} from "react";
-import { UNIT } from "coral-common/helpers/i18n";
+import TIME from "coral-common/time";
import {
Flex,
Option,
@@ -23,14 +23,14 @@ import styles from "./DurationField.css";
* DURATION_UNIT are units that can be used in the
* DurationField components.
*/
-export const DURATION_UNIT = UNIT;
+export const DURATION_UNIT = TIME;
const DURATION_UNIT_MAP = {
- [DURATION_UNIT.SECONDS]: "second",
- [DURATION_UNIT.MINUTES]: "minute",
- [DURATION_UNIT.HOURS]: "hour",
- [DURATION_UNIT.DAYS]: "day",
- [DURATION_UNIT.WEEKS]: "week",
+ [DURATION_UNIT.SECOND]: "second",
+ [DURATION_UNIT.MINUTE]: "minute",
+ [DURATION_UNIT.HOUR]: "hour",
+ [DURATION_UNIT.DAY]: "day",
+ [DURATION_UNIT.WEEK]: "week",
};
interface Props {
@@ -39,18 +39,18 @@ interface Props {
disabled: boolean;
onChange: (v: string) => void;
/** Specifiy units to include */
- units?: ReadonlyArray;
+ units?: ReadonlyArray