Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production Release #1124

Merged
merged 31 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0ba87bb
Create claim and personality integrations tests
pepermao Nov 25, 2023
2587a04
Remove enable_image_claim feature flag
pepermao Nov 29, 2023
242f168
Fixed cypress review tests
pepermao Nov 29, 2023
521d4f8
Create kanban cross-checking column
pepermao Nov 29, 2023
73b4fc8
Create enableEditorAnnotations feature_flag
pepermao Nov 29, 2023
8b1c8fb
Change key Enter by ctrl+enter or cmd+enter
pepermao Nov 29, 2023
aa55c24
Replace MongoDB Lookup to mongoose populate
pepermao Nov 29, 2023
82cffd6
create env variable for user password and replace it on CI jobs run
pepermao Dec 1, 2023
c32614b
Change the password replace approach
pepermao Dec 1, 2023
d5e9bea
fixed command
pepermao Dec 1, 2023
f860578
invert the commands to install packages first
pepermao Dec 1, 2023
e818d5a
Create cypress.env.json file and set user password env variable
pepermao Dec 1, 2023
ebcc158
gitignore cypress env file
pepermao Dec 1, 2023
09b148e
corrected file path
pepermao Dec 1, 2023
408cd1c
correct file path
pepermao Dec 1, 2023
33c749c
Fixed cross-checking comments card click
pepermao Dec 1, 2023
87d18c3
move cypress.env.json to root directory
pepermao Dec 1, 2023
295252d
Fixed create-claim-image dto
pepermao Dec 5, 2023
d1d1357
Merge pull request #1121 from AletheiaFact/fixed-cypress-cy
thesocialdev Dec 5, 2023
34de3cb
Merge branch 'stage' of github.com:AletheiaFact/aletheia into replace…
thesocialdev Dec 6, 2023
7f42a91
Merge pull request #1116 from AletheiaFact/replace-mongoDB-lookup-to-…
pepermao Dec 6, 2023
230c20e
Merge pull request #1122 from AletheiaFact/hotfix-realase-features
thesocialdev Jan 27, 2024
2c98861
Bump aws-eks github action version
thesocialdev Feb 2, 2024
3ec6c24
Introduce a static page for supportive materials
thesocialdev Feb 2, 2024
4a092b4
Change CTA in the home page
thesocialdev Feb 6, 2024
8fb052a
Change sign-up button label
thesocialdev Feb 6, 2024
4f11fe6
Fix issues in the code, change the CTA button label, and add a new se…
thesocialdev Feb 7, 2024
b8e0214
Delete newrelic_agent.log
thesocialdev Feb 7, 2024
63955b0
Merge pull request #1126 from AletheiaFact/supportive-material-page
thesocialdev Feb 7, 2024
6462784
Revert "Replace MongoDB Lookup to mongoose populate"
thesocialdev Feb 7, 2024
2201e7a
Merge pull request #1127 from AletheiaFact/revert-1116-replace-mongoD…
thesocialdev Feb 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: "test-cypress@aletheiafact.org",
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
Loading