New Creator Notifications (#4383)

* Some new notification types

* Fix error

* Use existing DB models rather than inline queries

* Fix template fillout

* Fix ModerationThreadMessageReceived

* Insert more notifications, fix some formatting

* chore: query cache, clippy, fmt

* chore: query cache, clippy, fmt

* Use outer transactions to insert notifications instead of creating a new one

* Join futures
This commit is contained in:
François-Xavier Talbot
2025-09-17 15:37:21 -04:00
committed by GitHub
parent 8149618187
commit 6da190ed01
25 changed files with 1211 additions and 77 deletions

View File

@@ -878,7 +878,7 @@ pub async fn transfer_ownership(
// Forbid transferring ownership of a project team that is owned by an organization
// These are owned by the organization owner, and must be removed from the organization first
// There shouldnt be an ownr on these projects in these cases, but just in case.
// There shouldnt be an owner on these projects in these cases, but just in case.
let team_association_id =
DBTeam::get_association(id.into(), &**pool).await?;
if let Some(TeamAssociationId::Project(pid)) = team_association_id {
@@ -1018,7 +1018,21 @@ pub async fn transfer_ownership(
vec![]
};
// If this team is associated with a project, notify the new owner
if let Some(TeamAssociationId::Project(pid)) = team_association_id {
NotificationBuilder {
body: NotificationBody::ProjectTransferred {
project_id: pid.into(),
new_owner_user_id: Some(new_owner.user_id),
new_owner_organization_id: None,
},
}
.insert(new_owner.user_id.into(), &mut transaction, &redis)
.await?;
}
transaction.commit().await?;
DBTeamMember::clear_cache(id.into(), &redis).await?;
for team_id in project_teams_edited {
DBTeamMember::clear_cache(team_id, &redis).await?;