Skip to content

Commit

Permalink
Merge pull request #999 from OneCommunityGlobal/development
Browse files Browse the repository at this point in the history
Backend Release to Main [1.82]
  • Loading branch information
one-community authored Jun 22, 2024
2 parents 804486d + 3f771e2 commit 2e760d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/controllers/timeEntryController.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const moment = require('moment-timezone');
const mongoose = require('mongoose');
const logger = require('../startup/logger');
const { getInfringementEmailBody } = require('../helpers/userHelper')();
const UserProfile = require('../models/userProfile');
const Project = require('../models/project');
const Task = require('../models/task');
Expand Down Expand Up @@ -329,7 +328,7 @@ const addEditHistory = async (
description: `${totalRecentEdits} time entry edits in the last calendar year`,
});

const infringementNotificationEmail = `
const infringementNotificationToAdminEmailBody = `
<p>
${userprofile.firstName} ${userprofile.lastName} (${userprofile.email}) was issued a blue square for editing their time entries ${totalRecentEdits} times
within the last calendar year.
Expand All @@ -339,28 +338,20 @@ const addEditHistory = async (
</p>
`;

const emailInfringement = {
date: moment().tz('America/Los_Angeles').format('MMMM-DD-YY'),
description: `You edited your time entries ${totalRecentEdits} times within the last 365 days, exceeding the limit of 4 times per year you can edit them without penalty.`,
};
const infringementNotificationToUserEmailBody = `You edited your time entries ${totalRecentEdits} times within the last 365 days, exceeding the limit of 4 times per year you can edit them without penalty.`;

pendingEmailCollection.push(
emailSender.bind(
null,
'[email protected]',
`${userprofile.firstName} ${userprofile.lastName} was issued a blue square for for editing a time entry ${totalRecentEdits} times`,
infringementNotificationEmail,
infringementNotificationToAdminEmailBody,
),
emailSender.bind(
null,
userprofile.email,
"You've been issued a blue square for editing your time entry",
getInfringementEmailBody(
userprofile.firstName,
userprofile.lastName,
emailInfringement,
userprofile.infringements.length,
),
infringementNotificationToUserEmailBody,
),
);
}
Expand Down
1 change: 1 addition & 0 deletions src/controllers/userProfileController.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ const userProfileController = function (UserProfile) {

if (await hasPermission(req.body.requestor, 'putUserProfileImportantInfo')) {
const importantFields = [
'email',
'role',
'isRehireable',
'isActive',
Expand Down

0 comments on commit 2e760d1

Please sign in to comment.