Skip to content

Commit

Permalink
Refine field copying logic in registrationList [packages-only]
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi749 committed Nov 14, 2024
1 parent 9b86af2 commit ff1a0b4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,16 @@ export default class IdeaRegistrationCommand extends BaseListViewCommandSet<any>
const field = registrationList.fields.find(
(f) => f.internalName === col.InternalName || f.displayName === col.Title
)
return field && columns.some((contentCol) => contentCol.internalName === col.InternalName)

const fieldsToCopy =
field &&
columns.find(
(contentCol) =>
contentCol.internalName === field.internalName ||
contentCol.fieldName === field.displayName
)

return fieldsToCopy
})

const copyData = columnsToCopy
Expand All @@ -270,8 +279,12 @@ export default class IdeaRegistrationCommand extends BaseListViewCommandSet<any>
}
}

const internalName = registrationList.fields.find(
(fld) => fld.displayName === col.Title || fld.internalName === col.InternalName
)?.internalName

return {
[col.InternalName]: registrationList.getValueByName(col.InternalName)
[col.InternalName]: registrationList.getValueByName(internalName)
}
})
.reduce((acc, val) => ({ ...acc, ...val }), {})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,11 @@ export const IdeaModule: FC<IIdeaModuleProps> = (props) => {
{state.selectedIdea.item.processing && (
<Accordion openItems={openItems} onToggle={handleToggle} multiple collapsible>
<AccordionItem value='registration'>
<AccordionHeader className={styles.accordion} size='large' icon={getFluentIcon('Lightbulb')}>
<AccordionHeader
className={styles.accordion}
size='large'
icon={getFluentIcon('Lightbulb')}
>
Registrert idé
</AccordionHeader>
<AccordionPanel>
Expand Down

0 comments on commit ff1a0b4

Please sign in to comment.