You've already forked AstralRinth
forked from didirus/AstralRinth
Return pending TMs, fix notifs serde (#575)
* Return pending TMs, fix notifs serde * fix compile
This commit is contained in:
@@ -18,12 +18,12 @@ pub struct NotificationId(pub u64);
|
|||||||
pub struct Notification {
|
pub struct Notification {
|
||||||
pub id: NotificationId,
|
pub id: NotificationId,
|
||||||
pub user_id: UserId,
|
pub user_id: UserId,
|
||||||
#[serde(rename = "type")]
|
|
||||||
pub read: bool,
|
pub read: bool,
|
||||||
pub created: DateTime<Utc>,
|
pub created: DateTime<Utc>,
|
||||||
pub body: NotificationBody,
|
pub body: NotificationBody,
|
||||||
|
|
||||||
// DEPRECATED: use body field instead
|
// DEPRECATED: use body field instead
|
||||||
|
#[serde(rename = "type")]
|
||||||
pub type_: Option<String>,
|
pub type_: Option<String>,
|
||||||
pub title: String,
|
pub title: String,
|
||||||
pub text: String,
|
pub text: String,
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ pub async fn team_members_get(
|
|||||||
|
|
||||||
let current_user = get_user_from_headers(req.headers(), &**pool).await.ok();
|
let current_user = get_user_from_headers(req.headers(), &**pool).await.ok();
|
||||||
|
|
||||||
if let Some(user) = current_user {
|
if let Some(user) = ¤t_user {
|
||||||
let team_member =
|
let team_member =
|
||||||
TeamMember::get_from_user_id(id.into(), user.id.into(), &**pool)
|
TeamMember::get_from_user_id(id.into(), user.id.into(), &**pool)
|
||||||
.await
|
.await
|
||||||
@@ -106,9 +106,15 @@ pub async fn team_members_get(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let user_id = current_user.map(|x| x.id.into());
|
||||||
let team_members: Vec<_> = members_data
|
let team_members: Vec<_> = members_data
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter(|x| x.accepted)
|
.filter(|x| {
|
||||||
|
x.accepted
|
||||||
|
|| user_id
|
||||||
|
.map(|y: crate::database::models::UserId| y == x.user.id)
|
||||||
|
.unwrap_or(false)
|
||||||
|
})
|
||||||
.map(|data| crate::models::teams::TeamMember::from(data, true))
|
.map(|data| crate::models::teams::TeamMember::from(data, true))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user