You've already forked AstralRinth
forked from didirus/AstralRinth
Fix users getting a notification for private moderation messages (#4302)
This commit is contained in:
@@ -382,6 +382,8 @@ pub async fn thread_send_message(
|
|||||||
|
|
||||||
let string: database::models::DBThreadId = info.into_inner().0.into();
|
let string: database::models::DBThreadId = info.into_inner().0.into();
|
||||||
|
|
||||||
|
let is_private: bool;
|
||||||
|
|
||||||
if let MessageBody::Text {
|
if let MessageBody::Text {
|
||||||
body,
|
body,
|
||||||
replying_to,
|
replying_to,
|
||||||
@@ -421,6 +423,8 @@ pub async fn thread_send_message(
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_private = *private;
|
||||||
} else {
|
} else {
|
||||||
return Err(ApiError::InvalidInput(
|
return Err(ApiError::InvalidInput(
|
||||||
"You may only send text messages through this route!".to_string(),
|
"You may only send text messages through this route!".to_string(),
|
||||||
@@ -454,6 +458,7 @@ pub async fn thread_send_message(
|
|||||||
if let Some(project) = project
|
if let Some(project) = project
|
||||||
&& project.inner.status != ProjectStatus::Processing
|
&& project.inner.status != ProjectStatus::Processing
|
||||||
&& user.role.is_mod()
|
&& user.role.is_mod()
|
||||||
|
&& !is_private
|
||||||
{
|
{
|
||||||
let members =
|
let members =
|
||||||
database::models::DBTeamMember::get_from_team_full(
|
database::models::DBTeamMember::get_from_team_full(
|
||||||
@@ -491,7 +496,7 @@ pub async fn thread_send_message(
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if user.id != report.reporter.into() {
|
if user.id != report.reporter.into() && !is_private {
|
||||||
NotificationBuilder {
|
NotificationBuilder {
|
||||||
body: NotificationBody::ModeratorMessage {
|
body: NotificationBody::ModeratorMessage {
|
||||||
thread_id: thread.id.into(),
|
thread_id: thread.id.into(),
|
||||||
|
|||||||
Reference in New Issue
Block a user