Skip to content

Commit

Permalink
Fix GtIdeaReporter (Idea)
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi749 committed Sep 13, 2024
1 parent fc4c048 commit fe0688b
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ export default class IdeaRegistrationCommand extends BaseListViewCommandSet<any>
private _onSubmit = async (row: RowAccessor, comment: string): Promise<void> => {
const rowId = row.getValueByName('ID')
const rowTitle = row.getValueByName('Title')
const rowReporter = row.getValueByName('GtIdeaReporter')[0] || ''

await this._sp.web.lists
.getByTitle(this._config.registrationList)
Expand All @@ -218,7 +219,7 @@ export default class IdeaRegistrationCommand extends BaseListViewCommandSet<any>
Log.info(LOG_SOURCE, `Updated ${this._config.registrationList}: Approved`)

const pageUrl = await this._createSitePage(row)
await this._updateProcessingList(rowId, rowTitle, pageUrl)
await this._updateProcessingList(rowId, rowTitle, rowReporter, pageUrl)

window.location.reload()
}
Expand Down Expand Up @@ -259,12 +260,14 @@ export default class IdeaRegistrationCommand extends BaseListViewCommandSet<any>
private _updateProcessingList = async (
rowId: number,
rowTitle: string,
rowReporter: any,
pageUrl: string
): Promise<void> => {
await this._sp.web.lists.getByTitle(this._config.processingList).items.add({
Title: rowTitle,
GtRegistratedIdeaId: rowId,
GtIdeaUrl: pageUrl
GtIdeaUrl: pageUrl,
GtIdeaReporterId: rowReporter?.id,
})

Log.info(LOG_SOURCE, 'Updated work list')
Expand Down Expand Up @@ -296,7 +299,7 @@ export default class IdeaRegistrationCommand extends BaseListViewCommandSet<any>
'Article'
)

const reporter = row.getValueByName('GtIdeaReporter')[0] || ''
const reporter = row.getValueByName('GtIdeaReporter')[0] || null

page.layoutType = 'NoImage'
page.showTopicHeader = true
Expand All @@ -322,10 +325,9 @@ export default class IdeaRegistrationCommand extends BaseListViewCommandSet<any>
`<h3>Overordnet gjennomføringsplan</h3>${row.getValueByName('GtIdeaExecutionPlan')}`
)
)

column2.addControl(
new ClientsideText(
`<h3>Innmelder</h3><a href="mailto:${reporter.email}" target="_blank">${reporter.title}</a>`
`<h3>Innmelder</h3>${reporter ? `<a href="mailto:${reporter?.email}" target="_blank">${reporter?.title}</a>` : 'Ikke angitt'}`
)
)
column2.addControl(
Expand Down

0 comments on commit fe0688b

Please sign in to comment.