Skip to content
New issue

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

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

Already on GitHub? # to your account

[Publication] Fix baseurl missing from emails #9186

Merged
merged 6 commits into from
Apr 16, 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
16 changes: 8 additions & 8 deletions modules/publication/ajax/FileUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function uploadPublication() : void
showPublicationError($e->getMessage(), 500);
}

notify($pubID, 'submission');
notify($pubID, 'submission', $_POST['baseURL']);
}

/**
Expand Down Expand Up @@ -426,12 +426,13 @@ function cleanup(int $pubID) : void
/**
* Send out email notifications for project submission
*
* @param int $pubID publication ID
* @param string $type The notification type i.e., submission|edit|review
* @param int $pubID publication ID
* @param string $type The notification type i.e., submission|edit|review
* @param string $baseURL the base URL of the loris site
*
* @return void
*/
function notify($pubID, $type) : void
function notify($pubID, $type, $baseURL) : void
{
$acceptedTypes = [
'submission',
Expand Down Expand Up @@ -464,12 +465,11 @@ function notify($pubID, $type) : void
);
throw new \LorisException('Invalid publication ID specified.');
}
$url = \NDB_Factory::singleton()->settings()->getBaseURL();

$emailData['Title'] = $data['Title'];
$emailData['Date'] = $data['DateProposed'];
$emailData['User'] = $user->getFullname();
$emailData['URL'] = $url . '/publication/view_project/?id='.$pubID;
$emailData['URL'] = $baseURL . '/publication/view_project/?id='.$pubID;
$emailData['ProjectName'] = $config->getSetting('prefix');
$Notifier = new \NDB_Notifier(
"publication",
Expand Down Expand Up @@ -618,10 +618,10 @@ function editProject() : void
processFiles($id);
// if publication status is changed, send review email
if (isset($toUpdate['PublicationStatusID'])) {
notify($id, 'review');
notify($id, 'review', $_POST['baseURL']);
} else {
// otherwise send edit email
notify($id, 'edit');
notify($id, 'edit', $_POST['baseURL']);
}
if (!empty($toUpdate)) {
$db->update(
Expand Down
5 changes: 4 additions & 1 deletion modules/publication/jsx/uploadForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ class PublicationUploadForm extends React.Component {
);
return;
}
let formData = this.state.formData;
let formData = {
...this.state.formData,
baseURL: loris.BaseURL,
};

let formObj = new FormData();
for (let key in formData) {
Expand Down
6 changes: 5 additions & 1 deletion modules/publication/jsx/viewProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ class ViewProject extends React.Component {
);
return;
}
let formData = this.state.formData;
let formData = {
...this.state.formData,
baseURL: loris.BaseURL,
};

let formObj = new FormData();
for (let key in formData) {
if (formData.hasOwnProperty(key) && formData[key] !== '') {
Expand Down
Loading