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

Added bcc to salesforce #5708

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { initiateConfirm } from '../../actions/confirm_actions.js';
import TextAreaInput from '@components/common/text_area_input.jsx';
Expand All @@ -11,6 +11,11 @@ import { ALERT_INSTRUCTOR_UPDATE_MESSAGE, ALERT_INSTRUCTOR_UPDATE_SUBJECT, ALERT
const NotifyInstructorsButton = (props) => {
const { notification, visible } = props;
const dispatch = useDispatch();
const [bccEnabled, setBccEnabled] = useState(true);

const toggleBcc = () => {
setBccEnabled(!bccEnabled);
};

const sendNotificationHandler = () => {
dispatch(
Expand All @@ -20,7 +25,8 @@ const NotifyInstructorsButton = (props) => {
courseTitle: props.courseTitle,
courseId: props.courseId,
subject: notification.subject,
message: notification.message
message: notification.message,
bccToSalesforce: bccEnabled
}),
})
);
Expand All @@ -41,6 +47,21 @@ const NotifyInstructorsButton = (props) => {

{notification.status === 'FAILED' && <div className="notice--error">{notification.error}</div>}

<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
<label htmlFor="bcc" style={{ marginRight: '.5rem' }}>
BCC to Salesforce
</label>
<input
checked={bccEnabled}
className="top2"
id="bcc"
name="bcc"
onChange={toggleBcc}
type="checkbox"
style={{ width: '50px' }}
/>
</div>

<TextInput
placeholder={I18n.t('course_instructor_notification.write_subject')}
editable
Expand Down
4 changes: 4 additions & 0 deletions app/mailers/instructor_notification_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ def email(alert)
unless @alert.sender_email.nil?
params[:bcc] = @alert.sender_email # sender_email gives user email of the sender
end
if bcc_to_salesforce && !@alert.sender_email.nil?
params[:bcc] ||= []
params[:bcc] << ENV['SALESFORCE_BCC_EMAIL']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest mirroring the implementation in ticket_notification_mailer.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made the code changes, can you please have a look at it?

end
mail(params)
end

Expand Down