forked from kemitix/git-next
fix: shout.desktop should be optional
If the value isn't present, then it is treated as false
This commit is contained in:
parent
a9783807b3
commit
3895246b72
3 changed files with 11 additions and 5 deletions
|
@ -26,8 +26,10 @@ impl Handler<NotifyUser> for AlertsActor {
|
|||
if let Some(email_config) = shout.email() {
|
||||
send_email(&user_notification, email_config);
|
||||
}
|
||||
if shout.desktop() {
|
||||
send_desktop_notification(&user_notification);
|
||||
if let Some(desktop) = shout.desktop() {
|
||||
if desktop {
|
||||
send_desktop_notification(&user_notification);
|
||||
}
|
||||
}
|
||||
}
|
||||
.in_current_span()
|
||||
|
|
|
@ -209,7 +209,7 @@ impl ServerStorage {
|
|||
pub struct Shout {
|
||||
webhook: Option<OutboundWebhook>,
|
||||
email: Option<EmailConfig>,
|
||||
desktop: bool,
|
||||
desktop: Option<bool>,
|
||||
}
|
||||
impl Shout {
|
||||
pub const fn webhook(&self) -> Option<&OutboundWebhook> {
|
||||
|
@ -228,7 +228,7 @@ impl Shout {
|
|||
self.email.as_ref()
|
||||
}
|
||||
|
||||
pub const fn desktop(&self) -> bool {
|
||||
pub const fn desktop(&self) -> Option<bool> {
|
||||
self.desktop
|
||||
}
|
||||
}
|
||||
|
|
|
@ -774,7 +774,11 @@ mod given {
|
|||
ServerStorage::new(a_name().into())
|
||||
}
|
||||
pub fn a_shout() -> Shout {
|
||||
Shout::new(Some(an_outbound_webhook()), Some(an_email_config()), true)
|
||||
Shout::new(
|
||||
Some(an_outbound_webhook()),
|
||||
Some(an_email_config()),
|
||||
Some(true),
|
||||
)
|
||||
}
|
||||
pub fn some_forge_configs() -> BTreeMap<String, ForgeConfig> {
|
||||
[(a_name(), a_forge_config())].into()
|
||||
|
|
Loading…
Reference in a new issue