Skip to content

Commit

Permalink
Merge pull request #1124 from AletheiaFact/stage
Browse files Browse the repository at this point in the history
Production Release
  • Loading branch information
thesocialdev authored Feb 7, 2024
2 parents e9cba28 + 2201e7a commit 27db648
Show file tree
Hide file tree
Showing 62 changed files with 818 additions and 173 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ jobs:
sed -i "s/TAG/$GITHUB_SHA/" deployment/websocket.yml
- name: Applying Kubernetes Deployment
uses: giovannirossini/aws-eks@v1
uses: giovannirossini/aws-eks@v1.0.1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand All @@ -196,7 +196,7 @@ jobs:
command: kubectl apply -f ./deployment/

- name: Validation
uses: giovannirossini/aws-eks@v1
uses: giovannirossini/aws-eks@v1.0.1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand All @@ -206,7 +206,7 @@ jobs:
if: success()

- name: Rollback
uses: giovannirossini/aws-eks@v1
uses: giovannirossini/aws-eks@v1.0.1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ jobs:
path: dist
- name: List contents of aletheia-dist
run: ls -lah /home/runner/work/aletheia/aletheia
- run: yarn install
- run: |
echo '{"CI_ORY_USER_PASSWORD": "${{ env.CI_ORY_USER_PASSWORD }}"}' > ./cypress.env.json
yarn install
- name: Cypress run
uses: cypress-io/github-action@v6
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

# testing
/coverage
/cypress.env.json

# production
/build
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified .yarn/install-state.gz
Binary file not shown.
6 changes: 5 additions & 1 deletion cypress/e2e/tests/review.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,16 @@ describe("Test claim review", () => {
cy.get(locators.claimReview.BTN_FINISH_REPORT)
.should("be.enabled")
.click();
cy.get(locators.claimReview.INPUT_REVIEWER).should("exist");
cy.get(locators.claimReview.BTN_SELECTED_REVIEW).should("exist");
});

it("should not be able submit after choosing assigned user as reviewer", () => {
cy.login();
goToClaimReviewPage();
cy.checkRecaptcha();
cy.get(locators.claimReview.BTN_SELECTED_REVIEW)
.should("exist")
.click();
cy.get(locators.claimReview.INPUT_REVIEWER)
.should("exist")
.type(review.username, { delay: 200 });
Expand Down
2 changes: 1 addition & 1 deletion cypress/fixtures/user.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const user = {
email: "[email protected]",
password: "TEST_USER_PASS",
password: Cypress.env("CI_ORY_USER_PASSWORD"),
};

export default user;
3 changes: 2 additions & 1 deletion cypress/support/locators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ const locators = {
INPUT_CLASSIFICATION: "[data-cy=testClassificationText]",
INPUT_REVIEWER: "[data-cy=testClaimReviewreviewerId]",
BTN_SAVE_DRAFT: "[data-cy=testClaimReviewSAVE_DRAFT]",
BTN_SUBMIT: "[data-cy=testClaimReviewSUBMIT]",
BTN_SUBMIT: "[data-cy=testClaimReviewSEND_TO_REVIEW]",
BTN_PUBLISH: "[data-cy=testClaimReviewPUBLISH]",
BTN_SELECTED_REVIEW: "[data-cy=testClaimReviewSELECTED_REVIEW]",
TEXT_REVIEWER_ERROR: "[data-cy=testReviewerError]",
},

Expand Down
2 changes: 1 addition & 1 deletion public/locales/en/CTARegistration.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"Wanna be a reviewer? Aletheia is currently on Beta Test and we are accepting all journalists and fact-checking professionals to test the platform!",
"footer":
"Our goal is to be open for all users to add and review claims once tests are done. Keep it up with us on social media!",
"button": "Apply to be a reviewer"
"button": "Sign-up to be part of the movement"
}
2 changes: 1 addition & 1 deletion public/locales/en/home.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"statsClaims": "claims",
"statsClaimReviews": "reviews",
"statsFooter": "Contribute to an internet free of disinformation",
"createAccountButton": "Be a reviewer",
"createAccountButton": "Sign-up and be part of the Movement",
"donateButton": "Donate to Aletheia",
"seeMorePersonalitiesButton": "See more Personalities",
"sectionTitle1": "Personalities",
Expand Down
6 changes: 6 additions & 0 deletions public/locales/en/materials.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"title": "Supportive Materials",
"loggedOutMessage": "You need to login to access the supportive materials.",
"disclaimerFirstParagraph": "When you complete your registration, you will have access to all areas of the AletheiaFact.org platform, including complementary materials, up-to-date fact-checking reports and, of course, our complete Fact-Checking Manual. We offer totally free information and guidance so that you can fight disinformation independently and credibly.",
"disclaimerSecondParagraph": "To find out more about how you can become a fact-checker and publish your reports on the platform, contributing to the Movement on a voluntary basis, please contact us at"
}
4 changes: 3 additions & 1 deletion public/locales/en/menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@
"personalityItem": "Personalities",
"claimItem": "Claims",
"kanbanItem": "Kanban",
"nameSpaceItem": "Namespace"
"nameSpaceItem": "Namespace",
"supportiveMaterials": "Supportive Materials"

}
2 changes: 1 addition & 1 deletion public/locales/pt/CTARegistration.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"Aletheia está atualmente em teste beta e estamos aceitando todos os jornalistas e profissionais de checagem de fatos para testar a plataforma!",
"footer":
"Nosso objetivo é estar aberto para que todos os usuários adicionem e revisem alegações assim que os testes forem concluídos. Acompanhe-nos nas redes sociais!",
"button": "Inscreva-se para ser um revisor"
"button": "Inscreva-se para ser parte do movimento"
}
2 changes: 1 addition & 1 deletion public/locales/pt/home.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"statsClaims": "discursos",
"statsClaimReviews": "checagens",
"statsFooter": "Contribua para uma internet livre de desinformação",
"createAccountButton": "Seja um revisor",
"createAccountButton": "Cadastre-se e faça parte do Movimento",
"donateButton": "Doe para Aletheia",
"seeMorePersonalitiesButton": "Veja mais personalidades",
"sectionTitle1": "Personalidades",
Expand Down
7 changes: 7 additions & 0 deletions public/locales/pt/materials.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"title": "Materiais de Apoio",
"loggedOutMessage": "Para acessar os materias de apoio é preciso ter uma conta na plataforma.",
"disclaimerFirstParagraph": "Ao finalizar o seu cadastro, você terá acesso a todas as áreas da plataforma AletheiaFact.org, incluindo materiais complementares, relatórios de checagem atualizados e, é claro, ao nosso Manual de Checagem completo. Oferecemos informações e orientações totalmente gratuitas para que você combata a desinformação de forma autônoma e com credibilidade.",
"disclaimerSecondParagraph": "Para saber mais sobre como você pode se tornar um checador de fatos e publicar seus relatórios na plataforma, contribuindo para o Movimento de forma voluntária, entre em contato conosco pelo e-mail:"

}
3 changes: 2 additions & 1 deletion public/locales/pt/menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"personalityItem": "Personalidades",
"claimItem": "Afirmações",
"kanbanItem": "Kanban",
"nameSpaceItem": "Namespace"
"nameSpaceItem": "Namespace",
"supportiveMaterials": "Materiais de Apoio"
}
Binary file added public/manual-thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/timeline-thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions server/claim-review-task/claim-review-task.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ export class ClaimReviewController {
public async personalityList(@Req() req: Request, @Res() res: Response) {
const parsedUrl = parse(req.url, true);
const enableCollaborativeEditor = this.isEnableCollaborativeEditor();
const enableEditorAnnotations = this.isEnableEditorAnnotations();

await this.viewService.getNextServer().render(
req,
Expand All @@ -171,6 +172,7 @@ export class ClaimReviewController {
Object.assign(parsedUrl.query, {
sitekey: this.configService.get<string>("recaptcha_sitekey"),
enableCollaborativeEditor,
enableEditorAnnotations,
websocketUrl: this.configService.get<string>("websocketUrl"),
nameSpace: req.params.namespace,
})
Expand All @@ -184,4 +186,12 @@ export class ClaimReviewController {
? this.unleash.isEnabled("enable_collaborative_editor")
: false;
}

private isEnableEditorAnnotations() {
const config = this.configService.get<string>("feature_flag");

return config
? this.unleash.isEnabled("enable_editor_annotations")
: false;
}
}
8 changes: 8 additions & 0 deletions server/claim-review-task/mongo-utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
export const getQueryMatchForMachineValue = (value) => {
if (value === "cross-checking") {
return {
"machine.value": {
$in: ["cross-checking", "addCommentCrossChecking"],
},
};
}

return plainValues.includes(value)
? { "machine.value": value }
: { [`machine.value.${value}`]: { $exists: true } };
Expand Down
36 changes: 15 additions & 21 deletions server/claim/claim.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export class ClaimController {
? `/personality/${personality.slug}/claim/${claim.slug}`
: `/personality/${personality.slug}`;
return {
_id: claim._id,
title: claim.title,
path:
claim.nameSpace !== NameSpaceEnum.Main
Expand All @@ -147,9 +148,6 @@ export class ClaimController {
@ApiTags("claim")
@Post("api/claim/image")
async createClaimImage(@Body() createClaimDTO) {
if (!this.isEnabledImageClaim()) {
throw new NotFoundException();
}
try {
const claim = await this._createClaim(createClaimDTO);

Expand Down Expand Up @@ -333,6 +331,7 @@ export class ClaimController {
}

const enableCollaborativeEditor = this.isEnableCollaborativeEditor();
const enableEditorAnnotations = this.isEnableEditorAnnotations();

hideDescriptions[TargetModel.Claim] =
await this.historyService.getDescriptionForHide(
Expand Down Expand Up @@ -361,6 +360,7 @@ export class ClaimController {
sitekey: this.configService.get<string>("recaptcha_sitekey"),
hideDescriptions,
enableCollaborativeEditor,
enableEditorAnnotations,
websocketUrl: this.configService.get<string>("websocketUrl"),
nameSpace: req.params.namespace,
})
Expand Down Expand Up @@ -486,8 +486,6 @@ export class ClaimController {
) {
const parsedUrl = parse(req.url, true);

const enableImageClaim = this.isEnabledImageClaim();

const personality = query.personality
? await this.personalityService.getClaimsByPersonalitySlug(
{
Expand All @@ -505,7 +503,6 @@ export class ClaimController {
Object.assign(parsedUrl.query, {
personality,
sitekey: this.configService.get<string>("recaptcha_sitekey"),
enableImageClaim,
nameSpace: req.params.namespace,
})
);
Expand All @@ -519,10 +516,6 @@ export class ClaimController {
@Req() req: BaseRequest,
@Res() res: Response
) {
if (!this.isEnabledImageClaim()) {
throw new NotFoundException();
}

const parsedUrl = parse(req.url, true);

await this.viewService.getNextServer().render(
Expand All @@ -548,13 +541,7 @@ export class ClaimController {
namespace as NameSpaceEnum
);
const enableCollaborativeEditor = this.isEnableCollaborativeEditor();

if (
claim.contentModel === ContentModelEnum.Image &&
!this.isEnabledImageClaim()
) {
throw new NotFoundException();
}
const enableEditorAnnotations = this.isEnableEditorAnnotations();

if (claim.personalities.length > 0) {
const personalitySlug = slugify(claim.personalities[0].name, {
Expand All @@ -575,6 +562,7 @@ export class ClaimController {
claim,
sitekey: this.configService.get<string>("recaptcha_sitekey"),
enableCollaborativeEditor,
enableEditorAnnotations,
websocketUrl: this.configService.get<string>("websocketUrl"),
nameSpace: namespace,
})
Expand All @@ -594,6 +582,7 @@ export class ClaimController {
const parsedUrl = parse(req.url, true);

const enableCollaborativeEditor = this.isEnableCollaborativeEditor();
const enableEditorAnnotations = this.isEnableEditorAnnotations();

const personality =
await this.personalityService.getClaimsByPersonalitySlug(
Expand Down Expand Up @@ -624,6 +613,7 @@ export class ClaimController {
claim,
sitekey: this.configService.get<string>("recaptcha_sitekey"),
enableCollaborativeEditor,
enableEditorAnnotations,
websocketUrl: this.configService.get<string>("websocketUrl"),
hideDescriptions,
nameSpace: namespace,
Expand All @@ -650,6 +640,7 @@ export class ClaimController {
);

const enableCollaborativeEditor = this.isEnableCollaborativeEditor();
const enableEditorAnnotations = this.isEnableEditorAnnotations();

const claim = await this.claimService.getByPersonalityIdAndClaimSlug(
personality._id,
Expand All @@ -665,6 +656,7 @@ export class ClaimController {
personality,
claim,
enableCollaborativeEditor,
enableEditorAnnotations,
websocketUrl: this.configService.get<string>("websocketUrl"),
nameSpace: namespace,
})
Expand Down Expand Up @@ -798,17 +790,19 @@ export class ClaimController {
);
}

private isEnabledImageClaim() {
private isEnableCollaborativeEditor() {
const config = this.configService.get<string>("feature_flag");

return config ? this.unleash.isEnabled("enable_image_claim") : false;
return config
? this.unleash.isEnabled("enable_collaborative_editor")
: false;
}

private isEnableCollaborativeEditor() {
private isEnableEditorAnnotations() {
const config = this.configService.get<string>("feature_flag");

return config
? this.unleash.isEnabled("enable_collaborative_editor")
? this.unleash.isEnabled("enable_editor_annotations")
: false;
}
}
4 changes: 2 additions & 2 deletions server/claim/claim.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ export class ClaimService {

const claims = await this.ClaimModel.find(query)
.populate("latestRevision")
.skip(page * pageSize)
.limit(pageSize)
.skip(page * parseInt(pageSize, 10))
.limit(parseInt(pageSize, 10))
.sort({ _id: order })
.lean();

Expand Down
1 change: 0 additions & 1 deletion server/claim/dto/create-claim.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export class CreateClaimDTO {
title: string;

@IsNotEmpty()
@IsString()
@ApiProperty()
content: string;

Expand Down
Loading

0 comments on commit 27db648

Please sign in to comment.