Skip to content

Commit

Permalink
Cleaned up some items found during code review
Browse files Browse the repository at this point in the history
  • Loading branch information
jongpie committed Apr 28, 2024
1 parent f70d9bc commit 15d2304
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public without sharing class LogHandler extends LoggerSObjectHandler {
this.logs = (List<Log__c>) triggerNew;
this.loggerScenariosById = queryLoggerScenarios(this.logs);

this.setHasCommentsField();
this.setClosedStatusFields();
this.setOrganizationLimits();
// The log OwnerId field should support being manually changed, so only auto-set it on insert
Expand All @@ -54,7 +53,6 @@ public without sharing class LogHandler extends LoggerSObjectHandler {
this.logs = (List<Log__c>) triggerNewMap.values();
this.oldLogsById = (Map<Id, Log__c>) triggerOldMap;

this.setHasCommentsField();
this.setClosedStatusFields();
// Priority logic relies on roll-up fields, so only run on update (after log entries are inserted)
this.setPriority();
Expand All @@ -68,12 +66,6 @@ public without sharing class LogHandler extends LoggerSObjectHandler {
this.shareLogsWithLoggingUsers();
}

private void setHasCommentsField() {
for (Log__c log : this.logs) {
log.HasComments__c = String.isNotBlank(log.Comments__c);
}
}

private void setClosedStatusFields() {
Map<String, LogStatus__mdt> logStatusNameToStatus = loadActiveLogStatuses();
for (Log__c log : this.logs) {
Expand Down Expand Up @@ -222,6 +214,7 @@ public without sharing class LogHandler extends LoggerSObjectHandler {

private void setCheckboxFields() {
for (Log__c log : this.logs) {
log.HasComments__c = log.Comments__c != null;
log.HasLoggedByFederationIdentifier__c = log.LoggedByFederationIdentifier__c != null;
log.HasOrganizationLimits__c = log.OrganizationLimits__c != null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>LoggedByFederationIdentifier__c</fullName>
<businessStatus>Active</businessStatus>
<complianceGroup>None</complianceGroup>
<complianceGroup>PII;GDPR;CCPA</complianceGroup>
<externalId>false</externalId>
<label>User Federation Identifier</label>
<length>512</length>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@
<field>LogEntryTag__c.LogLink__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>false</editable>
<field>Log__c.LoggedByFederationIdentifier__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>false</editable>
<field>LogEntryTag__c.LoggedByUsernameLink__c</field>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>LoggedByFederationIdentifier__c</fullName>
<businessStatus>Active</businessStatus>
<complianceGroup>PII;GDPR;CCPA</complianceGroup>
<externalId>false</externalId>
<isFilteringDisabled>false</isFilteringDisabled>
<isNameField>false</isNameField>
<isSortingDisabled>false</isSortingDisabled>
<label>User Federation Identifier</label>
<length>512</length>
<securityClassification>Confidential</securityClassification>
<type>LongTextArea</type>
<visibleLines>3</visibleLines>
</CustomField>
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"docs:verify": "pwsh ./scripts/build/verify-docs-up-to-date.ps1",
"experience:deploy": "sf project deploy start --source-dir ./config/experience-cloud --wait 30",
"husky:pre-commit": "lint-staged --config ./config/linters/lint-staged.config.js",
"lightning:debug:enable": "sf apex run --file ./scripts/build/enable-debug-mode.apex",
"package:version:create:managed": "pwsh ./scripts/build/create-managed-package-beta-version.ps1",
"package:version:create:unlocked": "sf package version create --json --package \"Nebula Logger - Core\" --skip-ancestor-check --code-coverage --installation-key-bypass --wait 30",
"package:version:number:fix": "pwsh ./scripts/build/sync-package-version-number.ps1",
Expand Down
1 change: 0 additions & 1 deletion scripts/build/enable-debug-mode.apex

This file was deleted.

3 changes: 1 addition & 2 deletions scripts/data/create-sample-log-entries.apex
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ Logger.getUserSettings().IsDataMaskingEnabled__c = true;
Schema.User currentUser = [SELECT Id, Name, Username, Profile.Name FROM User WHERE Id = :System.UserInfo.getUserId()];
currentUser.AboutMe = 'I hope you dont leak my social, which is 400-11-9999, btw.';

new ExampleClassWithLogging().doSomething();
new ExampleClassWithLogging().insertAccount('some account name');
new ExampleClassWithComplexLogging().doSomething();

// Logger.error('Example ERROR entry', new DmlException('fake DML exception')).addTag('some important tag');
Logger.error('Here is my fake Visa credit card 4000-1111-2222-0004, please don\'t steal it').addTag('data masking rule').addTag('credit card masking');
Expand Down
2 changes: 1 addition & 1 deletion sfdx-project.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"definitionFile": "./config/scratch-orgs/base-scratch-def.json",
"scopeProfiles": true,
"versionNumber": "4.13.11.NEXT",
"versionName": "Track User Federation Identitifier",
"versionName": "Track User Federation Identifier",
"versionDescription": "Added new fields LoggedByFederationIdentifier__c on LogEntryEvent__e and Log__c to track the value of Schema.User.FederationIdentifier for the logging user",
"releaseNotesUrl": "https://github.com/jongpie/NebulaLogger/releases",
"unpackagedMetadata": {
Expand Down

0 comments on commit 15d2304

Please sign in to comment.