Skip to content

Commit

Permalink
Merge branch 'master' of github.com:AletheiaFact/aletheia into stage
Browse files Browse the repository at this point in the history
  • Loading branch information
thesocialdev committed Jun 3, 2024
2 parents c209932 + f1e64e1 commit 23d91e7
Show file tree
Hide file tree
Showing 37 changed files with 386 additions and 604 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.19.1]
node-version: [18.14.0]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -44,7 +44,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.19.1]
node-version: [18.14.0]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -62,7 +62,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.19.1]
node-version: [18.14.0]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -79,7 +79,7 @@ jobs:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# node-version: [18.19.1]
# node-version: [18.14.0]
# steps:
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.19.1
18.14.0
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18.19.1-alpine AS package
FROM node:18.17.0-alpine AS package

ARG NEXT_PUBLIC_UMAMI_SITE_ID
ARG NEXT_PUBLIC_RECAPTCHA_SITEKEY
Expand Down Expand Up @@ -40,7 +40,7 @@ RUN NEXT_PUBLIC_UMAMI_SITE_ID=$NEXT_PUBLIC_UMAMI_SITE_ID \
NEXT_PUBLIC_ORY_SDK_URL=$NEXT_PUBLIC_ORY_SDK_URL \
yarn build

FROM node:18.19.1-alpine
FROM node:18.17.0-alpine

LABEL maintainer="Giovanni Rossini <giovannijrrossini@gmail.com>"

Expand Down
9 changes: 4 additions & 5 deletions public/locales/en/home.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"title": "checking claims from your favorite personalities",
"title": "checking claims",
"subtitle0": "from your",
"subtitle1": "favorite personalities",
"statsPersonalities": "personalities",
"statsClaims": "claims",
"statsClaimReviews": "reviews",
"statsFooter": "Contribute to an internet free of disinformation",
"createAccountButton": "Sign-up",
"homeHeaderSearchTitle": "Search in our platform",
"homeHeaderSearchButton": "Search",
"createAccountButton": "Sign-up and be part of the Movement",
"donateButton": "Donate to Aletheia",
"homeFeedTitle": "Results",
"seeMorePersonalitiesButton": "See more Personalities",
"sectionTitle1": "Personalities",
"sectionTitle2": "Join the movement",
Expand Down
9 changes: 4 additions & 5 deletions public/locales/pt/home.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"title": "checagem de afirmações das suas personalidades favoritas",
"title": "checagem de afirmações",
"subtitle0": "das suas",
"subtitle1": "personalidades favoritas",
"statsPersonalities": "personalidades",
"statsClaims": "discursos",
"statsClaimReviews": "checagens",
"statsFooter": "Contribua para uma internet livre de desinformação",
"createAccountButton": "Cadastre-se",
"createAccountButton": "Cadastre-se e faça parte do Movimento",
"donateButton": "Doe para Aletheia",
"homeHeaderSearchTitle": "Busque em nossa plataforma",
"homeHeaderSearchButton": "Buscar",
"homeFeedTitle": "Resultados",
"seeMorePersonalitiesButton": "Veja mais personalidades",
"sectionTitle1": "Personalidades",
"sectionTitle2": "Junte-se ao movimento",
Expand Down
14 changes: 0 additions & 14 deletions server/claim/claim-revision/claim-revision.controller.ts

This file was deleted.

3 changes: 0 additions & 3 deletions server/claim/claim-revision/claim-revision.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import { ParagraphModule } from "../types/paragraph/paragraph.module";
import { SpeechModule } from "../types/speech/speech.module";
import { ImageModule } from "../types/image/image.module";
import { DebateModule } from "../types/debate/debate.module";
import { ClaimRevisionController } from "./claim-revision.controller";
import { UtilService } from "../../util";

const ClaimRevisionModel = MongooseModule.forFeature([
{
Expand All @@ -38,7 +36,6 @@ const ClaimRevisionModel = MongooseModule.forFeature([
ViewModule,
SourceModule,
],
controllers: [ClaimRevisionController],
exports: [ClaimRevisionService],
providers: [UtilService, ClaimRevisionService],
})
Expand Down
13 changes: 1 addition & 12 deletions server/claim/claim-revision/claim-revision.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class ClaimRevisionService {
};
}

/** get ClaimRevision by ID */
getRevision(match) {
try {
return this.ClaimRevisionModel.findOne(match)
Expand All @@ -45,18 +46,6 @@ export class ClaimRevisionService {
throw new NotFoundException();
}
}

/** get ClaimRevision by ID */
getRevisionById(id) {
try {
return this.ClaimRevisionModel.findById(id)
.populate("personalities")
.populate("content")
.lean();
} catch {
throw new NotFoundException();
}
}
/**
*
* @param claimId an unique claim id
Expand Down
1 change: 0 additions & 1 deletion server/claim/types/sentence/sentence.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ export class SentenceService {
"personality.name": 1,
"claim.slug": 1,
"claim.date": 1,
"claim._id": 1,
"claim.contentModel": 1,
},
},
Expand Down
23 changes: 0 additions & 23 deletions src/api/claimRevision.ts

This file was deleted.

25 changes: 0 additions & 25 deletions src/api/searchApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,33 +47,8 @@ const getResults = (dispatch, options: SearchOptions = {}) => {
});
};

const getFeedResults = (options: SearchOptions = {}): any => {
const params = {
type: options.type,
searchText: options.searchText,
page: options.page ? options.page : 0,
pageSize: options.pageSize ? options.pageSize : 5,
nameSpace: options.nameSpace ? options.nameSpace : NameSpaceEnum.Main,
};

return request
.get(`/`, { params })
.then((response) => {
const { personalities, sentences, claims } = response.data;
return {
personalities,
sentences,
claims,
};
})
.catch((e) => {
console.error(e);
});
};

const SearchApi = {
getResults,
getFeedResults,
};

export default SearchApi;
9 changes: 0 additions & 9 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export enum ButtonType {
gray = "gray",
whiteBlue = "whiteBlue",
whiteBlack = "whiteBlack",
lightBlue = "lightBlue",
}

type AletheiaButtonProps = Omit<ButtonProps, "type">;
Expand Down Expand Up @@ -78,14 +77,6 @@ const AletheiaButton: (props: IAletheiaButtonProps) => JSX.Element = (
color: colors.blackSecondary,
};
break;
case ButtonType.lightBlue:
buttonStyle = {
...buttonStyle,
background: colors.lightBlueMain,
borderColor: colors.lightBlueMain,
color: colors.white,
};
break;
case ButtonType.blue:
default:
buttonStyle = {
Expand Down
9 changes: 2 additions & 7 deletions src/components/Claim/ClaimCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,12 @@ const CommentStyled = styled(Comment)`
}
`;

const ClaimCard = ({
personality,
claim,
collapsed = true,
content = null,
}) => {
const ClaimCard = ({ personality, claim, collapsed = true }) => {
const { t } = useTranslation();
const dispatch = useDispatch();
const { selectedClaim } = useAppSelector((state) => state);
const review = claim?.stats?.reviews[0];
const paragraphs = content || claim.content;
const paragraphs = claim.content;
const [claimContent, setClaimContent] = useState("");
const [nameSpace] = useAtom(currentNameSpace);
const isSpeech = claim?.contentModel === ContentModelEnum.Speech;
Expand Down
59 changes: 39 additions & 20 deletions src/components/ClaimReview/ClaimReviewDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ import AletheiaButton, { ButtonType } from "../Button";
import ClaimReviewView from "./ClaimReviewView";
import Loading from "../Loading";
import LargeDrawer from "../LargeDrawer";
import { ContentModelEnum } from "../../types/enums";
import { CollaborativeEditorProvider } from "../Collaborative/CollaborativeEditorProvider";
import { NameSpaceEnum } from "../../types/Namespace";
import { useAtom } from "jotai";
import { currentNameSpace } from "../../atoms/namespace";
import colors from "../../styles/colors";
import { generateClaimContentPath } from "../../utils/GetClaimContentHref";

const ClaimReviewDrawer = () => {
const [isLoading, setIsLoading] = useState<boolean>(true);
Expand All @@ -33,21 +34,42 @@ const ClaimReviewDrawer = () => {
content,
data_hash,
enableCopilotChatBot,
} = useAppSelector((state) => ({
reviewDrawerCollapsed:
state?.reviewDrawerCollapsed !== undefined
? state?.reviewDrawerCollapsed
: true,
vw: state?.vw,
personality: state?.selectedPersonality,
claim: state?.selectedClaim,
content: state?.selectedContent,
data_hash: state?.selectedDataHash,
enableCopilotChatBot: state?.enableCopilotChatBot,
}));
} = useAppSelector((state) => {
return {
reviewDrawerCollapsed:
state?.reviewDrawerCollapsed !== undefined
? state?.reviewDrawerCollapsed
: true,
vw: state?.vw,
personality: state?.selectedPersonality,
claim: state?.selectedClaim,
content: state?.selectedContent,
data_hash: state?.selectedDataHash,
enableCopilotChatBot: state?.enableCopilotChatBot,
};
});

useEffect(() => setIsLoading(false), [claim, data_hash]);

let href = nameSpace !== NameSpaceEnum.Main ? `/${nameSpace}` : "";

const contentProps = {
[ContentModelEnum.Speech]: {
href: `${href}/personality/${personality?.slug}/claim/${claim?.slug}/sentence/${data_hash}`,
},
[ContentModelEnum.Image]: {
href: `${href}${
personality ? `/personality/${personality?.slug}` : ""
}/claim/${claim?.slug}/image/${data_hash}`,
},
[ContentModelEnum.Debate]: {
href: `${href}/personality/${personality?.slug}/claim/${claim?.slug}/sentence/${data_hash}`,
},
[ContentModelEnum.Unattributed]: {
href: `${href}/claim/${claim?.slug}/sentence/${data_hash}`,
},
};

return (
<LargeDrawer
open={!reviewDrawerCollapsed}
Expand Down Expand Up @@ -78,13 +100,10 @@ const ClaimReviewDrawer = () => {
</AletheiaButton>
<Col span={vw?.xs ? 8 : 14}>
<AletheiaButton
href={generateClaimContentPath(
nameSpace,
personality,
claim,
claim.contentModel,
data_hash
)}
href={
contentProps[claim.contentModel]
.href
}
onClick={() => setIsLoading(true)}
type={ButtonType.gray}
style={{
Expand Down
18 changes: 7 additions & 11 deletions src/components/Form/InputSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@ const InputSearch = (props) => {
let loading = false;

const doSearch = (e) => {
if (props.callback) {
const searchText = e.target.value;
if (timeout) clearTimeout(timeout);
timeout = setTimeout(() => {
loading = true;
props?.callback(searchText);
loading = false;
}, 1000);
}
const searchText = e.target.value;
if (timeout) clearTimeout(timeout);
timeout = setTimeout(() => {
loading = true;
props.callback(searchText);
loading = false;
}, 1000);
};

return (
Expand All @@ -49,9 +47,7 @@ const InputSearch = (props) => {
addonBefore={false}
onChange={(e) => doSearch(e)}
suffix={props.suffix || <></>}
prefix={props.prefix || <></>}
data-cy={props["data-cy"] || "testInputSearchPersonality"}
{...props}
/>
);
};
Expand Down
Loading

0 comments on commit 23d91e7

Please sign in to comment.