mirror of
https://github.com/wassname/talk.git
synced 2026-08-17 11:27:52 +08:00
[CORL-239, CORL-128] Support disabled commenting and closed stories in Stream (#2205)
* feat: closed story + disabled commenting * test: add feature test and fix bugs * fix: snapshot * fix: isClosed can't be null * fix: remove duplicate DeepPartial type * fix: border color
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { CommentingDisabledError } from "talk-server/errors";
|
||||
import { ModerationSettings } from "talk-server/models/settings";
|
||||
import {
|
||||
IntermediateModerationPhase,
|
||||
@@ -16,7 +17,6 @@ export const commentingDisabled: IntermediateModerationPhase = ({
|
||||
testDisabledCommenting(tenant) ||
|
||||
(story.settings && testDisabledCommenting(story.settings))
|
||||
) {
|
||||
// TODO: (wyattjoh) return better error.
|
||||
throw new Error("commenting has been disabled tenant wide");
|
||||
throw new CommentingDisabledError();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { StoryClosedError } from "talk-server/errors";
|
||||
import {
|
||||
IntermediateModerationPhase,
|
||||
IntermediatePhaseResult,
|
||||
@@ -11,7 +12,6 @@ export const storyClosed: IntermediateModerationPhase = ({
|
||||
}): IntermediatePhaseResult | void => {
|
||||
const closedAt = getStoryClosedAt(tenant, story);
|
||||
if (closedAt && closedAt.valueOf() <= Date.now()) {
|
||||
// TODO: (wyattjoh) return better error.
|
||||
throw new Error("story is currently closed for commenting");
|
||||
throw new StoryClosedError();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user