Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
WebMon9099 committed Dec 23, 2024
1 parent 28aba57 commit dafb045
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 26 deletions.
6 changes: 5 additions & 1 deletion backend/api/views/announcement.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,11 @@ def new_announce(role):
for recipient in recipients:
res, res_msg = send_email(
recipient=recipient.email,
data={"link": target_url, "title": announce.name},
data={
"link": target_url,
"title": announce.name,
"subject": "New Announcement",
},
template_id=NEW_ANNOUNCE_TEMPLATE,
)
if not res:
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/UpdateAnnouncementModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function UpdateAnnouncementModal({
);
} else {
setImage(null);
form.setFieldValue("send_notification", true);
}
}, [open, currentAnnounce]);

Expand Down Expand Up @@ -136,7 +137,7 @@ function UpdateAnnouncementModal({
name="send_notification"
valuePropName="checked"
>
<Checkbox>Send Notification</Checkbox>
<Checkbox defaultChecked>Send Notification</Checkbox>
</Form.Item>
)}
<Form.Item
Expand Down
20 changes: 12 additions & 8 deletions frontend/src/components/pages/AdminAnnouncement.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,21 +231,25 @@ const AdminAnnouncement = () => {
dataIndex: "file_name",
key: "file_name",
render: (file_name, record) => {
return (
<AdminDownloadDropdown
options={getAvailableLangs(record)}
title={file_name}
onClick={(lang) => handleAnnounceDownload(record, lang)}
/>
);
if (file_name && file_name !== "") {
return (
<AdminDownloadDropdown
options={getAvailableLangs(record)}
title={file_name}
onClick={(lang) => handleAnnounceDownload(record, lang)}
/>
);
}
},
},
{
title: "Image",
dataIndex: "image",
key: "image",
render: (image) => {
return <img style={{ maxHeight: "50px" }} src={image.url} alt="" />;
if (image) {
return <img style={{ maxHeight: "50px" }} src={image.url} alt="" />;
}
},
},
{
Expand Down
28 changes: 12 additions & 16 deletions frontend/src/components/pages/Announcements.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,6 @@ function Announcements() {
});
};

function truncate(str, maxLength) {
return str.length > maxLength ? (
<Tooltip title={str}> {str.substring(0, maxLength - 3) + "..."} </Tooltip>
) : (
str
);
}

const getFilterForm = () => (
<>
<Title
Expand Down Expand Up @@ -146,21 +138,25 @@ function Announcements() {
dataIndex: "file_name",
key: "file_name",
render: (file_name, record) => {
return (
<AdminDownloadDropdown
options={getAvailableLangs(record)}
title={file_name}
onClick={(lang) => handleAnnounceDownload(record, lang)}
/>
);
if (file_name && file_name !== "") {
return (
<AdminDownloadDropdown
options={getAvailableLangs(record)}
title={file_name}
onClick={(lang) => handleAnnounceDownload(record, lang)}
/>
);
}
},
},
{
title: "Image",
dataIndex: "image",
key: "image",
render: (image) => {
return <img style={{ maxHeight: "50px" }} src={image.url} alt="" />;
if (image) {
return <img style={{ maxHeight: "50px" }} src={image.url} alt="" />;
}
},
},
{
Expand Down

0 comments on commit dafb045

Please sign in to comment.