Skip to content

Commit 8d34493

Browse files
authored
v0.1.3 - Current User Queue bugfix (#14)
* Fixes #13 by adding special logic when current user is part of queue * Partial sf cli migration - updated scanner to prevent false positive when using Assert classes * Updating deploy.yml syntax
1 parent 3c5e5d6 commit 8d34493

23 files changed

+36065
-15463
lines changed

.github/workflows/deploy.yml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,12 @@ jobs:
4242
ref: ${{ github.head_ref }}
4343

4444
- name: 'Setup node'
45-
uses: actions/setup-node@v2
45+
uses: actions/setup-node@v3
4646
with:
47-
node-version: '14'
47+
node-version: '18.17.0'
48+
cache: 'npm'
4849

49-
- name: 'Restore node_modules cache'
50-
id: cache-npm
51-
uses: actions/cache@v2
52-
with:
53-
path: node_modules
54-
key: npm-${{ hashFiles('**/package-lock.json') }}
55-
restore-keys: |
56-
npm-${{ env.cache-name }}-
57-
npm-
58-
59-
- name: 'Install NPM'
60-
if: steps.cache-npm.outputs.cache-hit != 'true'
61-
run: npm ci
50+
- run: npm ci
6251

6352
- name: 'Run LWC Unit Tests'
6453
run: npm run test:lwc

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
## Deployment
77

8-
<a href="https://login.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008fjhyAAA">
8+
<a href="https://login.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008C6lwAAC">
99
<img alt="Deploy to Salesforce"
1010
src="./media/deploy-package-to-prod.png">
1111
</a>
1212

13-
<a href="https://test.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008fjhyAAA">
13+
<a href="https://test.salesforce.com/packaging/installPackage.apexp?p0=04t6g000008C6lwAAC">
1414
<img alt="Deploy to Salesforce Sandbox"
1515
src="./media/deploy-package-to-sandbox.png">
1616
</a>
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
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
3-
<apiVersion>57.0</apiVersion>
3+
<apiVersion>58.0</apiVersion>
44
<status>Active</status>
55
</ApexClass>
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
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
3-
<apiVersion>57.0</apiVersion>
3+
<apiVersion>58.0</apiVersion>
44
<status>Active</status>
55
</ApexClass>
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
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
3-
<apiVersion>57.0</apiVersion>
3+
<apiVersion>58.0</apiVersion>
44
<status>Active</status>
55
</ApexClass>
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
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
3-
<apiVersion>57.0</apiVersion>
3+
<apiVersion>58.0</apiVersion>
44
<status>Active</status>
55
</ApexClass>
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
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
3-
<apiVersion>57.0</apiVersion>
3+
<apiVersion>58.0</apiVersion>
44
<status>Active</status>
55
</ApexClass>

core/classes/QueryAssigner.cls

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ public without sharing class QueryAssigner implements RoundRobinAssigner.IAssign
44

55
public QueryAssigner(String query, String assignmentFieldName) {
66
Set<Id> assignmentIds = new Set<Id>();
7-
List<SObject> matchingRecords;
8-
if (QUERY_TO_RECORDS.containsKey(query)) {
9-
matchingRecords = QUERY_TO_RECORDS.get(query);
10-
} else {
7+
List<SObject> matchingRecords = QUERY_TO_RECORDS.get(query);
8+
if (matchingRecords == null) {
119
matchingRecords = Database.query(query);
1210
QUERY_TO_RECORDS.put(query, matchingRecords);
1311
}
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
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
3-
<apiVersion>57.0</apiVersion>
3+
<apiVersion>58.0</apiVersion>
44
<status>Active</status>
55
</ApexClass>

core/classes/RoundRobinAssigner.cls

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,14 @@ public without sharing class RoundRobinAssigner implements IThreadSafeCacheVisit
5757
for (SObject record : records) {
5858
Id ownerId = (Id) record.get(this.details.ownerField);
5959
Id nextOwnerId = assignmentIds[nextAssignmentIndex];
60-
if (ownerId == null || activeAssignmentIds.contains(ownerId) == false || nextOwnerId == ownerId) {
61-
record.put(OWNER_ID, nextOwnerId);
60+
if (
61+
ownerId == null ||
62+
activeAssignmentIds.contains(ownerId) == false ||
63+
nextOwnerId == ownerId ||
64+
// edge case: the running user is part of the queue
65+
ownerId == UserInfo.getUserId()
66+
) {
67+
record.put(this.details.ownerField, nextOwnerId);
6268
cachedAssignment.Index__c = nextOwnerId;
6369
nextAssignmentIndex = nextAssignmentIndex == assignmentIds.size() - 1 ? 0 : nextAssignmentIndex + 1;
6470
}

0 commit comments

Comments
 (0)