Create component to send userMessages
The design should be similar to this one, for the submission-wizard/SubmitErrorReport component:
-
From the Submission Header, an admin sees a link to the "Activity" page. A normal user sees a link to open this component and send a message to the helpdesk.
-
From the Activity page, the admin user can open this component to send a "New message", or to Reply to a message from the reviewer or submitter. The difference is that in a reply, the sender of the previous message is auto-selected as a recipient, and the subject is auto-filled as "Re: [previous subject]"
-
An admin can select as the recipient(s) the submitter and/or the reviewer (if they are different from the submitter). A normal user can select the helpdesk and, if the user is different from themselves, the reviewer or submitter.
-
Forwarding messages, and non-user CCs, are out of scope for now.
-
The message should be saved as a note in the following format
{
notesType: 'userMessage',
content: JSON.stringify({
to: [user.id], // can be multiple
subject,
message,
}),
}
- For each recipient, you should send an email to the email attached to the user.id, using the server/email userMessage function. If the person writing the message is an admin, the from/sender should be left blank and will automatically be the helpdesk email address. Otherwise it should be the email address associated with the account of the person writing the message.
I hope this answers any questions! Let me know if you have any more!