Files
AstralRinth/apps/frontend/src/helpers/threads.js
Evan Song abec2e48d4 Add TailwindCSS (#1252)
* Setup TailwindCSS

* Fully setup configuration

* Refactor some tailwind variables
2024-07-06 20:57:32 -07:00

27 lines
604 B
JavaScript

export function addReportMessage(thread, report) {
if (!thread || !report) {
return thread;
}
if (
!thread.members.some((user) => {
return user.id === report.reporterUser.id;
})
) {
thread.members.push(report.reporterUser);
}
if (!thread.messages.some((message) => message.id === "original")) {
thread.messages.push({
id: "original",
author_id: report.reporterUser.id,
body: {
type: "text",
body: report.body,
private: false,
replying_to: null,
},
created: report.created,
});
}
return thread;
}