Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove beta access from afterwork #120

Merged
merged 2 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

<aura:registerEvent name="appEvent" type="c:afterworkEvent" />
<aura:handler event="c:afterworkEvent" action="{!c.handleChatEnded}" />
<aura:handler name="init" action="{!c.doInit}" value="{!this}" />

<aura:attribute name="betaAccess" type="boolean" default="false" />
<aura:attribute name="timer" type="integer" default="150" />
<aura:attribute name="maxTimer" type="integer" />
<aura:attribute name="percentageTimer" type="integer" default="100" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,4 @@
({
doInit: function (component) {
var action = component.get('c.hasBetaAccess');
action.setCallback(this, function (response) {
var state = response.getState();
if (state === 'SUCCESS') {
component.set('v.betaAccess', response.getReturnValue());

// You would typically fire a event here to trigger
// client-side notification that the server-side
// action is complete
} else if (state === 'INCOMPLETE') {
// do something
} else if (state === 'ERROR') {
var errors = response.getError();
if (errors) {
if (errors[0] && errors[0].message) {
console.log('Error message: ' + errors[0].message);
}
} else {
console.log('Unknown error');
}
}
});
$A.enqueueAction(action);
},
handleChatEnded: function (component, event, helper) {
var type = event.getParam('type');
if (type === 'startTimer') {
Expand Down
5 changes: 0 additions & 5 deletions force-app/main/default/classes/NKS_ChatAfterWork.cls
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
public with sharing class NKS_ChatAfterWork {
@AuraEnabled
public static Boolean hasBetaAccess() {
return FeatureManagement.checkPermission('NKS_Beta');
}

@AuraEnabled
public static Id reportThreatClick() {
try {
Expand Down
25 changes: 25 additions & 0 deletions force-app/main/default/classes/NKS_ChatAfterWork_Test.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@IsTest
public with sharing class NKS_ChatAfterWork_Test {
@IsTest
static void ThreatReportTest() {
Test.startTest();
NKS_ChatAfterWork.reportThreatClick();
Test.stopTest();
Assert.areEqual(1, [SELECT Id FROM ReportingData__c WHERE CRM_Category__c = 'Chat Threat'].size());
}

@IsTest
static void ThreatValueTest() {
Test.startTest();
Id reportId = NKS_ChatAfterWork.reportThreatClick();
NKS_ChatAfterWork.updateThreatClickValue(reportId, 15000);
Test.stopTest();
ReportingData__c report = [
SELECT Id, CRM_Value__c
FROM ReportingData__c
WHERE CRM_Category__c = 'Chat Threat'
LIMIT 1
];
Assert.areEqual(15000, report.CRM_Value__c);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<status>Active</status>
</ApexClass>
Loading