Skip to content

Commit

Permalink
Merge pull request #4440 from coralproject/hotfix/dsa-tenant-8.6.1
Browse files Browse the repository at this point in the history
[HOTFIX] Resolve possible null and undefined tenant DSA configurations (8.6.1)
  • Loading branch information
nick-funk authored Nov 29, 2023
2 parents 5667759 + 177a423 commit 6182831
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 17 deletions.
4 changes: 2 additions & 2 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coralproject/talk",
"version": "8.6.0",
"version": "8.6.1",
"author": "The Coral Project",
"homepage": "https://coralproject.net/",
"sideEffects": [
Expand Down
4 changes: 2 additions & 2 deletions common/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "common",
"version": "8.6.0",
"version": "8.6.1",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions config/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "common",
"version": "8.6.0",
"version": "8.6.1",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coralproject/talk",
"version": "8.6.0",
"version": "8.6.1",
"author": "The Coral Project",
"homepage": "https://coralproject.net/",
"sideEffects": [
Expand Down
2 changes: 1 addition & 1 deletion server/src/core/server/cron/accountDeletion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const deleteScheduledAccounts: ScheduledJobCommand<Options> = async ({
user.id,
tenant.id,
now,
tenant.dsa.enabled
tenant.dsa?.enabled
);

// If the user has an email, then send them a confirmation that their account
Expand Down
2 changes: 1 addition & 1 deletion server/src/core/server/graph/mutators/Users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export const Users = (ctx: GraphContext) => ({
input.userID,
ctx.tenant.id,
ctx.now,
ctx.tenant.dsa.enabled
ctx.tenant.dsa?.enabled
);
},
cancelAccountDeletion: async (
Expand Down
7 changes: 7 additions & 0 deletions server/src/core/server/models/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
GQLAuth,
GQLAuthenticationTargetFilter,
GQLCOMMENT_BODY_FORMAT,
GQLDSA_METHOD_OF_REDRESS,
GQLEmailConfiguration,
GQLFacebookAuthIntegration,
GQLGoogleAuthIntegration,
Expand Down Expand Up @@ -421,8 +422,14 @@ export const defaultRTEConfiguration: RTEConfiguration = {

export interface DSAConfiguration {
enabled: boolean;
methodOfRedress: {
method: GQLDSA_METHOD_OF_REDRESS;
};
}

export const defaultDSAConfiguration: DSAConfiguration = {
enabled: false,
methodOfRedress: {
method: GQLDSA_METHOD_OF_REDRESS.NONE,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import moderate, { Moderate } from "./moderate";

import {
GQLCOMMENT_STATUS,
GQLDSA_METHOD_OF_REDRESS,
GQLUSER_ROLE,
} from "coral-server/graph/schema/__generated__/types";
import { I18n } from "coral-server/services/i18n";
Expand All @@ -23,7 +24,10 @@ jest.mock("coral-server/models/action/moderation/comment");

it("requires a valid rejection reason if dsaFeatures are enabled", async () => {
const tenant = createTenantFixture({
dsa: { enabled: true },
dsa: {
enabled: true,
methodOfRedress: { method: GQLDSA_METHOD_OF_REDRESS.NONE },
},
});
const config = {} as Config;
const story = createStoryFixture({ tenantID: tenant.id });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default async function moderate(
}
) {
if (
tenant.dsa.enabled &&
tenant.dsa?.enabled &&
input.status === GQLCOMMENT_STATUS.REJECTED &&
!input.rejectionReason
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ export const external: IntermediateModerationPhase = async (ctx) => {
!ctx.tenant.integrations.external ||
ctx.tenant.integrations.external.phases.length === 0 ||
// (marcushaddon) DSA and external moderation are mutually exclusive for the time being
ctx.tenant.dsa.enabled
ctx.tenant.dsa?.enabled
) {
return;
}
Expand Down

0 comments on commit 6182831

Please sign in to comment.