Skip to content

Conversation

@nicolaskempf57
Copy link
Contributor

No description provided.

const source = props.notification.details.transfer_owner
const sourceName = 'first_name' in source ? `${source.first_name} ${source.last_name}` : source.name
const subject = props.notification.details.transfer_subject
const subjectPath = `${subject.class.toLowerCase()}s`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to have a explicit mapping if there is not a lot of subjects types?

const details = computed(() => {
const recipient = props.notification.details.transfer_recipient
const source = props.notification.details.transfer_owner
const sourceName = 'first_name' in source ? `${source.first_name} ${source.last_name}` : source.name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this working:

Suggested change
const sourceName = 'first_name' in source ? `${source.first_name} ${source.last_name}` : source.name
const sourceName = source.class === 'User' ? `${source.first_name} ${source.last_name}` : source.name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll update the OrganizationReference and UserReference types to have the class and then pray that typescript is smart

const sourceName = 'first_name' in source ? `${source.first_name} ${source.last_name}` : source.name
const subject = props.notification.details.transfer_subject
const subjectPath = `${subject.class.toLowerCase()}s`
if ('first_name' in recipient) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use recipient.class instead?

Suggested change
if ('first_name' in recipient) {
if (recipient.class === 'User') {

@ThibaudDauce
Copy link
Contributor

I think it could be merge before the udata part without any conflicts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants