-
Notifications
You must be signed in to change notification settings - Fork 32
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
feat: adding organisations thumbnails to records #511
Conversation
Affected libs:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me except the mandatory changes mentioned in the comments.
Overall, I would have some comments about the implementation from @jahow
- It's disturbing that we add duplicated contacts within the
contacts
&resourcesContact
properties of theMetadataRecord
objects. I wonder if we shouldn't clearly separate this concern with anorganization
property in the record. mapContact()
could take an optional 3rd argument as theorganization
, for the group strategy, the group is mapped to the organisation first.- The records should not have the catalog logo by default
- I think we should try to maintain a cache because the mapping between contacts & organisation + the hydration would be repeated a lot for nothing. Not in this PR though.
Overall the organisation domain object should raise above contacts/groups, we should just treat with organisations; contacts (for metadata) or groups (for group) should be mapped to an organisation and be forgotten.
): MetadataContact { | ||
const logoUrl = getAsUrl(`${organisation.logoUrl}`) | ||
return { | ||
name: organisation.name[lang3], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contacts or not multilingual yet
multilingual index fields ends with Object
eg organizationObject
]).pipe( | ||
map(([record, organisations]) => { | ||
const org = organisations.filter( | ||
(o) => o.name === record.contact.organisation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resourceContact[0]
)[0] | ||
if (org) { | ||
const lang3 = LANG_2_TO_3_MAPPER[this.translateService.currentLang] | ||
record.contact = this.mapContactFromOrganisation(org, lang3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid object mutation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just looked through quickly but I think the approach is good since it's only touching the orgs-from-metadata implementation 🙂
Yes clearly the record format is awkward on that part. I think we should address that in the pivot format and not overthink it with the current
I feel like simply adding a 3rd optional argument would be a work around for something missing elsewhere, but not really sure about this.
I think that's the point of this PR, display the thumbnail if any and display the contact logo otherwise. Or am I missing something? Maybe we shouldn't overwrite any existing logo on the record?
Why not but in my understanding the contacts in the raw metadata can have many different forms and the method used to match with the groups use several fields. We can't just maintain a map between an org email and a group for example; the mapping could use a combination of the org fields (name, email...). But I also think that this concern would be "premature optimization": the hydration happens maybe at most twenty times in a row when showing the records list, and I don't think this is going to be noticeable in any way. |
ATM it uses the |
Thinking about this and the issue is more about the confusion between contact & orgs. |
For me, I think it would be clearer if we edit the MetadataRecord interface with something like : export interface MetadataRecord {
id: string
...
contact?: MetadataContact
resourceContacts?: MetadataContact[]
organisation?: Organisation
...
} but this doesn't match XML format ... What if we create an export interface ExtendedMetadataRecord {
record: MetadataRecord
organisation?: Organisation
} |
6ad11ad
to
844c970
Compare
remove untranslated organisation name fields, improving addOrganisationToRecordFromSource without forkJoin, alter mapLogo to not use the record logo for a contact
It's not clear in the US, but to me the rules are
|
It's conflicting what @jahow told me : Keeping catalog logo if org logo is not present for the feed. @fgravin Can you confirm that we won't use record logo (catalog's logo) for organisation logo ? It will change actual display of logos in the feed preview |
Ok, to me this is the kind of things to be discussed with Geo2France/MEL, but you can go as @jahow told you for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the missing behavior of hydrating the records with the organisation details.
Works well, but it lacks of tests. You should test the hydration.
I still have a weird behavior (which is expected), i have an org with a logo in the organization tab, when i click on it, the metadata in the result list has the catalog logo instead of the org one (because the organisation is the second resourceContact
). Actually, having several resourceContact
breaks a bit the approch we have, because the record does not have only one organisation, anyway.
Feel free to merge after adding a test.
Thanks, great work
check if record collect the right logo/thumbnail
Organisations thumbnails are now visible in feed and datasets tabs.
If the organization strategy is set to metadata (default behaviour), matching is done on the organization name set in the contact property of the record.
Maybe the IMAGE_URL constant could be common in
organisations-from-groups.service.ts
andorganisations-from-metadata.service.ts
.@fgravin @jahow @tkohr Tell me if this solution would be suitable.
Thanks :)