Skip to content

Commit

Permalink
(ajustements) : les données d'utilisateur populé sont maintenant cent…
Browse files Browse the repository at this point in the history
…ralisé dans le midleware et le model. Ce n'est plus un paramètres de middleware.
  • Loading branch information
mamarmite committed Sep 10, 2024
1 parent 450409c commit a30b1a6
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 14 deletions.
22 changes: 17 additions & 5 deletions src/DataTypes/Entity/models/EntityModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {getType, TYPE_DEFAULT} from "@/DataTypes/Entity/Types";
import {removeHtml} from "@/src/helpers/str";
import {appUrl, replacePathname} from "@/src/helpers/url";
import EntityTag from "@/DataTypes/Entity/layouts/EntityTag";
import {lang} from "@/src/common/Data/GlobalConstants";

/**
* The abstract model for all the entities.
Expand Down Expand Up @@ -259,12 +260,23 @@ class EntityModel {
}

setUsersMetas() {
this.setUsersMetasOn(this.meta.requestedBy);
this.setUsersMetasOn(this.meta.lastModifiedBy);
console.log(this.title, "setUsersMetas", this.meta);
}

if (this.meta.requestedBy && typeof this.meta.requestedBy === "object" && (this.meta.requestedBy?.name === "" || !this.meta.requestedBy?.name)) {
this.meta.requestedBy.name = this.meta.requestedBy?.firstName + " " + this.meta.requestedBy?.lastName;
}
if (this.meta.lastModifiedBy && typeof this.meta.lastModifiedBy === "object" && (this.meta.lastModifiedBy?.name === "" || !this.meta.lastModifiedBy?.name)) {
this.meta.lastModifiedBy.name = this.meta.lastModifiedBy?.firstName + " " + this.meta.lastModifiedBy?.lastName;
setUsersMetasOn(targetUserData) {
if (targetUserData &&
typeof targetUserData === "object" &&
(targetUserData.name === "" || !targetUserData.name))
{
targetUserData.name = lang.anonyme;
if (targetUserData.firstName && targetUserData.firstName !== "") {
targetUserData.name += targetUserData.firstName + " " + targetUserData.lastName;
}
if (targetUserData.lastName && targetUserData.lastName !== "") {
targetUserData.name += targetUserData.firstName + " " + targetUserData.lastName;
}
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/DataTypes/Organisation/models/Organisation.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ class Organisation extends EntityModel {
//this.taxonomies.set("skills", raw.skills);

this.meta = {title: this.title, description: this.description, ...raw.meta};
console.log(this.meta);
//this.setUsersMetas();
this.setUsersMetas();

params.showMeta = params.showMeta ?? true;
params.showStatus = params.showStatus ?? true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ const PersonSingleView = ({ data }) => {
}, [firstName]);



/****************************
* Sections
***************************/
Expand Down Expand Up @@ -201,7 +200,6 @@ const PersonSingleView = ({ data }) => {
title={lang.entityMetadata}
className="border-top pt-3"
>
{/*********** Entity data ***********/}
<SingleEntityMeta createdAt={createdAt} updatedAt={updatedAt} meta={meta} />
</SingleInfo>
}
Expand Down
1 change: 0 additions & 1 deletion src/DataTypes/common/layouts/single/SingleBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ const SingleBase = (props) => {
</div>
</section>
}

</div>
</>
)
Expand Down
3 changes: 0 additions & 3 deletions src/common/PageMeta/PageMeta.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,6 @@ const PageMeta = (props) => {
type='application/ld+json'
dangerouslySetInnerHTML={{__html: DOMPurify.sanitize(JSON.stringify(props.structuredData))}}
/>



</Head>
)
}
Expand Down
2 changes: 2 additions & 0 deletions src/languages/en-ca/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export const base = {
"continue": "Continue",
"about": "About",
"contactInformations": "Contact informations",
"anonyme": "anonym",
"parAvnu": "by AVNU",

// App

Expand Down
3 changes: 2 additions & 1 deletion src/languages/fr-ca/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ const base = {
"hyperlinks":"Hyperliens",
"externalLinks": "Liens externes",
"contactInformations": "Informations de contact",

"anonyme": "anonyme",
"parAvnu": "par AVNU",

// App

Expand Down

0 comments on commit a30b1a6

Please sign in to comment.