Skip to content

Commit

Permalink
fix: Query missing feature flags on Debate page render for claim reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
caneppelevitor committed Nov 25, 2024
1 parent d9e0361 commit 2f2318f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
19 changes: 19 additions & 0 deletions server/claim/claim.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,30 @@ export class ClaimController {
namespace as NameSpaceEnum
);

const enableCollaborativeEditor =
this.featureFlagService.isEnableCollaborativeEditor();
const enableCopilotChatBot =
this.featureFlagService.isEnableCopilotChatBot();
const enableEditorAnnotations =
this.featureFlagService.isEnableEditorAnnotations();
const enableAddEditorSourcesWithoutSelecting =
this.featureFlagService.isEnableAddEditorSourcesWithoutSelecting();
const enableReviewersUpdateReport =
this.featureFlagService.isEnableReviewersUpdateReport();
const enableViewReportPreview =
this.featureFlagService.isEnableViewReportPreview();

const queryObject = Object.assign(parsedUrl.query, {
claim,
sitekey: this.configService.get<string>("recaptcha_sitekey"),
websocketUrl: this.configService.get<string>("websocketUrl"),
nameSpace: req.params.namespace,
enableCollaborativeEditor,
enableEditorAnnotations,
enableCopilotChatBot,
enableAddEditorSourcesWithoutSelecting,
enableReviewersUpdateReport,
enableViewReportPreview,
});

await this.viewService.render(req, res, "/debate-page", queryObject);
Expand Down
24 changes: 24 additions & 0 deletions src/pages/debate-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,28 @@ const DebatePage: NextPage<any> = ({
claim,
sitekey,
nameSpace,
enableCollaborativeEditor,
enableCopilotChatBot,
enableEditorAnnotations,
enableAddEditorSourcesWithoutSelecting,
enableReviewersUpdateReport,
enableViewReportPreview,
}: InferGetServerSidePropsType<typeof getServerSideProps>): any => {
const setCurrentNameSpace = useSetAtom(currentNameSpace);
setCurrentNameSpace(nameSpace);
const dispatch = useDispatch();
dispatch(actions.setSitekey(sitekey));
dispatch(
actions.setEditorEnvironment(
enableCollaborativeEditor,
enableAddEditorSourcesWithoutSelecting,
enableEditorAnnotations,
enableCopilotChatBot,
false,
enableReviewersUpdateReport,
enableViewReportPreview
)
);

return (
<>
Expand All @@ -38,6 +55,13 @@ export async function getServerSideProps({ query, locale, locales, req }) {
claim: JSON.parse(JSON.stringify(query?.claim)),
sitekey: query.sitekey,
nameSpace: query.nameSpace ? query.nameSpace : NameSpaceEnum.Main,
enableCollaborativeEditor: query?.enableCollaborativeEditor,
enableCopilotChatBot: query?.enableCopilotChatBot,
enableEditorAnnotations: query?.enableEditorAnnotations,
enableAddEditorSourcesWithoutSelecting:
query?.enableAddEditorSourcesWithoutSelecting,
enableViewReportPreview: query?.enableViewReportPreview,
enableReviewersUpdateReport: query?.enableReviewersUpdateReport,
},
};
}
Expand Down

0 comments on commit 2f2318f

Please sign in to comment.