Don't show "they won't know if you decline" when request is accepted

This commit is contained in:
Antonio Scandurra 2022-05-16 15:37:29 +02:00
parent c2973f33c2
commit e6576b32b2
3 changed files with 10 additions and 6 deletions

View file

@ -45,6 +45,7 @@ impl View for ContactNotification {
ContactEventKind::Requested => render_user_notification(
self.event.user.clone(),
"wants to add you as a contact",
Some("They won't know if you decline."),
RespondToContactRequest {
user_id: self.event.user.id,
accept: false,
@ -70,6 +71,7 @@ impl View for ContactNotification {
ContactEventKind::Accepted => render_user_notification(
self.event.user.clone(),
"accepted your contact request",
None,
Dismiss(self.event.user.id),
vec![],
cx,

View file

@ -57,6 +57,7 @@ impl View for JoinProjectNotification {
render_user_notification(
self.user.clone(),
"wants to join your project",
Some("They won't know if you decline."),
Decline,
vec![("Decline", Box::new(Decline)), ("Accept", Box::new(Accept))],
cx,

View file

@ -13,7 +13,8 @@ enum Button {}
pub fn render_user_notification<V: View, A: Action + Clone>(
user: Arc<User>,
message: &str,
title: &str,
body: Option<&str>,
dismiss_action: A,
buttons: Vec<(&'static str, Box<dyn Action>)>,
cx: &mut RenderContext<V>,
@ -39,7 +40,7 @@ pub fn render_user_notification<V: View, A: Action + Clone>(
}))
.with_child(
Text::new(
format!("{} {}", user.github_login, message),
format!("{} {}", user.github_login, title),
theme.header_message.text.clone(),
)
.contained()
@ -74,15 +75,15 @@ pub fn render_user_notification<V: View, A: Action + Clone>(
)
.named("contact notification header"),
)
.with_child(
.with_children(body.map(|body| {
Label::new(
"They won't know if you decline.".to_string(),
body.to_string(),
theme.body_message.text.clone(),
)
.contained()
.with_style(theme.body_message.container)
.boxed(),
)
.boxed()
}))
.with_children(if buttons.is_empty() {
None
} else {