Skip to content

Commit ef874e4

Browse files
authored
Merge branch 'main' into dependabot/npm_and_yarn/multi-0ca592796f
2 parents 26d8560 + ce9b79a commit ef874e4

File tree

150 files changed

+1346
-14949
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+1346
-14949
lines changed

force-app/access-control/thread/classes/NKS_ThreadAccessHandler.cls

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
global class NKS_ThreadAccessHandler extends MyTriggers {
22
private static final List<String> THREAD_TYPES_OF_INTEREST = new List<String>{ 'STO', 'STB', 'BTO', 'CHAT' };
3+
private static final Set<String> TOLK_THREAD_TYPES = new Set<String>{ 'HOT_BRUKER-TOLK' };
34

45
global override void onAfterUpdate(Map<Id, sObject> triggerOldMap) {
56
List<String> fieldNamesToCheck = new List<String>{
@@ -42,7 +43,10 @@ global class NKS_ThreadAccessHandler extends MyTriggers {
4243
//run sharing in a platform event
4344

4445
for (Thread__c thread : (List<Thread__c>) records) {
45-
if (THREAD_TYPES_OF_INTEREST.contains(thread.CRM_Thread_Type__c)) {
46+
if (
47+
THREAD_TYPES_OF_INTEREST.contains(thread.CRM_Thread_Type__c) ||
48+
TOLK_THREAD_TYPES.contains(thread.CRM_Thread_Type__c) // fire event for TOLK threads as well
49+
) {
4650
RecordSharingEvent__e event = new RecordSharingEvent__e();
4751
event.RecordId__c = thread.Id;
4852
event.ObjectType__c = 'Thread__c';

force-app/access-control/thread/classes/NKS_ThreadSharingEventHandler.cls

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
public without sharing class NKS_ThreadSharingEventHandler extends RecordSharingEvent {
2+
private static final List<String> THREAD_TYPES_OF_INTEREST = new List<String>{ 'STO', 'STB', 'BTO', 'CHAT' };
3+
private static final Set<String> TOLK_THREAD_TYPES = new Set<String>{ 'HOT_BRUKER-TOLK' };
24
private static LoggerUtility logger = new LoggerUtility('STO');
35
List<Id> recordIds = new List<Id>();
46

@@ -11,22 +13,23 @@ public without sharing class NKS_ThreadSharingEventHandler extends RecordSharing
1113
recordIds.add(sharingEvent.RecordId__c);
1214
}
1315

14-
List<Thread__c> threads = [
15-
SELECT
16-
Id,
17-
CRM_Account__c,
18-
CRM_Henvendelse_BehandlingsId__c,
19-
CRM_Office_Restriction__c,
20-
CRM_Theme_Code__c,
21-
CRM_Theme_Group_Name__c,
22-
STO_Category__c,
23-
CRM_Theme__c,
24-
CRM_Thread_Type__c
25-
FROM Thread__c
26-
WHERE Id IN :recordIds
27-
];
28-
if (threads.size() > 0) {
29-
new NKS_ThreadAccessHandler().grantAccessToNewThreads(threads);
16+
List<Thread__c> threads = getThreadsByIds(recordIds);
17+
List<Thread__c> nksThreads = new List<Thread__c>();
18+
List<Thread__c> tolkThreads = new List<Thread__c>();
19+
for (Thread__c thread : threads) {
20+
if (THREAD_TYPES_OF_INTEREST.contains(thread.CRM_Thread_Type__c)) {
21+
nksThreads.add(thread);
22+
} else if (TOLK_THREAD_TYPES.contains(thread.CRM_Thread_Type__c)) {
23+
tolkThreads.add(thread);
24+
}
25+
}
26+
if (nksThreads.size() > 0 || tolkThreads.size() > 0) {
27+
if (nksThreads.size() > 0) {
28+
new NKS_ThreadAccessHandler().grantAccessToNewThreads(threads);
29+
}
30+
if (tolkThreads.size() > 0) {
31+
this.processTolkThreads(tolkThreads);
32+
}
3033
} else {
3134
logger.critical(
3235
'Recieved Record Sharing event but found no Threads: \n' + String.join(recordIds, ', '),
@@ -50,4 +53,33 @@ public without sharing class NKS_ThreadSharingEventHandler extends RecordSharing
5053
logger.publish();
5154
}
5255
}
56+
private static List<Thread__c> getThreadsByIds(List<Id> threadIds) {
57+
String queryString =
58+
'SELECT Id, CRM_Account__c, CRM_Henvendelse_BehandlingsId__c, CRM_Office_Restriction__c, ' +
59+
'CRM_Theme_Code__c, CRM_Theme_Group_Name__c, STO_Category__c, CRM_Theme__c, CRM_Thread_Type__c, ' +
60+
(Test.isRunningTest() ? '' : 'HOT_ParticipantIds__c, ') +
61+
'CRM_Related_Object__c ' +
62+
'FROM Thread__c ' +
63+
'WHERE Id IN :threadIds';
64+
return (List<Thread__c>) Database.queryWithBinds(
65+
queryString,
66+
new Map<String, Object>{ 'threadIds' => threadIds },
67+
AccessLevel.SYSTEM_MODE
68+
);
69+
}
70+
private void processTolkThreads(List<Thread__c> threads) {
71+
Type hotThreadHandlerType = Type.forName('HOT_ThreadHandler');
72+
if (hotThreadHandlerType == null || !Callable.class.isAssignableFrom(hotThreadHandlerType)) {
73+
logger.critical(
74+
'HOT_ThreadHandler class not found or not Callable:\n' +
75+
String.join(new List<Id>(new Map<Id, Thread__c>(threads).keySet()), ', '),
76+
null,
77+
CRM_ApplicationDomain.Domain.HOT
78+
);
79+
return;
80+
}
81+
Callable hotThreadHandler = (Callable) hotThreadHandlerType.newInstance();
82+
Map<String, List<Thread__c>> params = new Map<String, List<Thread__c>>{ 'threads' => threads };
83+
hotThreadHandler.call('setInterpreter', params);
84+
}
5385
}

force-app/brukervarsel/lwc/nksBrukervarsel/newDesignTemplate.html

Lines changed: 0 additions & 45 deletions
This file was deleted.

force-app/brukervarsel/lwc/nksBrukervarsel/newDesignTemplate.css renamed to force-app/brukervarsel/lwc/nksBrukervarsel/nksBrukervarsel.css

File renamed without changes.
Lines changed: 35 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,45 @@
11
<template>
2-
<article aria-label={varselType}>
3-
<lightning-layout multiple-rows="true">
4-
<lightning-layout-item size="12">
5-
<lightning-layout>
6-
<lightning-layout-item size="2">
7-
<p>{getDate}</p>
8-
</lightning-layout-item>
9-
<lightning-layout-item size="6">
10-
<h4>{varselType}</h4>
11-
</lightning-layout-item>
12-
<lightning-layout-item size="3" alignment-bump="right">
13-
<ul class="slds-list_horizontal slds-has-dividers_left slds-wrap">
14-
<template if:true={channelList} for:each={channelList} for:item="channel">
15-
<li class="slds-item" key={channel}>{channel}</li>
16-
</template>
17-
</ul>
18-
</lightning-layout-item>
19-
<lightning-layout-item size="1">
20-
<lightning-button-icon
21-
if:false={showDetails}
22-
icon-name="utility:chevrondown"
23-
variant="bare"
24-
alternative-text="Vis detaljer"
25-
title="Vis detaljer"
26-
aria-label="Vis detaljer"
27-
aria-expanded="false"
28-
size="large"
29-
onclick={onShowHide}
30-
></lightning-button-icon>
31-
<lightning-button-icon
32-
if:true={showDetails}
33-
icon-name="utility:chevronup"
34-
variant="bare"
35-
alternative-text="Skjul detaljer"
36-
title="Skjul detaljer"
37-
aria-label="Skjul detaljer"
38-
aria-expanded="true"
39-
size="large"
40-
onclick={onShowHide}
41-
></lightning-button-icon>
42-
</lightning-layout-item>
43-
</lightning-layout>
44-
</lightning-layout-item>
45-
<lightning-layout-item size="12" if:true={showVarselListe} class="slds-box">
2+
<c-nks-expandable-panel is-expandable chevron-right ontoggle={onShowHide}>
3+
<div slot="date">{getDate}</div>
4+
<div slot="type">{varselType}</div>
5+
<div slot="channel">
6+
<ul class="slds-list_horizontal slds-has-dividers_left slds-wrap">
7+
<template lwc:if={channelList} for:each={channelList} for:item="channel">
8+
<li class="slds-item" key={channel}>{channel}</li>
9+
</template>
10+
</ul>
11+
</div>
12+
<template lwc:if={showVarselListe}>
13+
<div class="slds-box slds-var-m-vertical_x-small">
4614
<ol class="slds-has-dividers_bottom-space">
4715
<template iterator:it={sortedVarselList}>
48-
<li if:false={it.last} class="slds-item" key={it.value.sendt}>
16+
<li lwc:if={it.last} class="slds-p-left_x-small slds-p-top_x-small" key={it.value.sendt}>
4917
<c-nks-brukervarsel-melding message={it.value}></c-nks-brukervarsel-melding>
5018
</li>
51-
<li if:true={it.last} class="slds-p-left_x-small slds-p-top_x-small" key={it.value.sendt}>
19+
<li lwc:else class="slds-item" key={it.value.sendt}>
5220
<c-nks-brukervarsel-melding message={it.value}></c-nks-brukervarsel-melding>
5321
</li>
5422
</template>
5523
</ol>
56-
</lightning-layout-item>
57-
<lightning-layout-item size="12" if:true={showNotifikasjon} class="slds-box">
58-
<c-nks-brukervarsel-notifikasjon
59-
usernotification={brukervarsel.brukernotifikasjon}
60-
></c-nks-brukervarsel-notifikasjon>
61-
</lightning-layout-item>
62-
</lightning-layout>
63-
</article>
24+
</div>
25+
</template>
26+
<template lwc:if={showNotifikasjon}>
27+
<lightning-layout class="slds-var-p-horizontal_medium" style="padding-bottom: 1rem">
28+
<lightning-layout-item size="2"></lightning-layout-item>
29+
<lightning-layout-item>
30+
<strong><p>{brukervarsel.brukernotifikasjon.tekst}</p></strong>
31+
<p>{brukervarsel.brukernotifikasjon.link}</p>
32+
<p lwc:if={brukervarsel.brukernotifikasjon.eksternVarsling}>
33+
<template
34+
lwc:if={brukervarsel.brukernotifikasjon.eksternVarsling.sendteKanaler}
35+
for:each={brukervarsel.brukernotifikasjon.eksternVarsling.sendteKanaler}
36+
for:item="kanal"
37+
>
38+
<span key={kanal} class="kanal">{kanal}</span>
39+
</template>
40+
</p>
41+
</lightning-layout-item>
42+
</lightning-layout>
43+
</template>
44+
</c-nks-expandable-panel>
6445
</template>

force-app/brukervarsel/lwc/nksBrukervarsel/nksBrukervarsel.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
import { LightningElement, api } from 'lwc';
22
import { publishToAmplitude } from 'c/amplitude';
3-
import newDesignTemplate from './newDesignTemplate.html';
4-
import standardTemplate from './nksBrukervarsel.html';
53

64
export default class NksBrukervarsel extends LightningElement {
75
@api brukervarsel;
8-
@api newDesign = false;
96

107
sortedVarselList;
118
showDetails = false;
129

13-
render() {
14-
return this.newDesign ? newDesignTemplate : standardTemplate;
15-
}
16-
1710
get showVarselListe() {
1811
let retValue = this.hasMessageList && this.showDetails;
1912
if (retValue && this.sortedVarselList == null)
@@ -190,7 +183,7 @@ export default class NksBrukervarsel extends LightningElement {
190183
}
191184

192185
onShowHide(event) {
193-
this.showDetails = this.newDesign ? event?.detail?.isExpanded : !this.showDetails;
186+
this.showDetails = event?.detail?.isExpanded;
194187
publishToAmplitude('UN List', { type: 'toggle show details' });
195188
}
196189
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
3-
<apiVersion>62.0</apiVersion>
3+
<apiVersion>64.0</apiVersion>
44
<isExposed>false</isExposed>
55
</LightningComponentBundle>

force-app/brukervarsel/lwc/nksBrukervarselList/newDesignTemplate.html

Lines changed: 0 additions & 110 deletions
This file was deleted.

0 commit comments

Comments
 (0)