fix: shout.desktop should be optional
Some checks failed
Rust / build (push) Successful in 2m34s
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
Release Please / Release-plz (push) Failing after 15s
Some checks failed
Rust / build (push) Successful in 2m34s
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
Release Please / Release-plz (push) Failing after 15s
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() {
|
if let Some(email_config) = shout.email() {
|
||||||
send_email(&user_notification, email_config);
|
send_email(&user_notification, email_config);
|
||||||
}
|
}
|
||||||
if shout.desktop() {
|
if let Some(desktop) = shout.desktop() {
|
||||||
send_desktop_notification(&user_notification);
|
if desktop {
|
||||||
|
send_desktop_notification(&user_notification);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.in_current_span()
|
.in_current_span()
|
||||||
|
|
|
@ -209,7 +209,7 @@ impl ServerStorage {
|
||||||
pub struct Shout {
|
pub struct Shout {
|
||||||
webhook: Option<OutboundWebhook>,
|
webhook: Option<OutboundWebhook>,
|
||||||
email: Option<EmailConfig>,
|
email: Option<EmailConfig>,
|
||||||
desktop: bool,
|
desktop: Option<bool>,
|
||||||
}
|
}
|
||||||
impl Shout {
|
impl Shout {
|
||||||
pub const fn webhook(&self) -> Option<&OutboundWebhook> {
|
pub const fn webhook(&self) -> Option<&OutboundWebhook> {
|
||||||
|
@ -228,7 +228,7 @@ impl Shout {
|
||||||
self.email.as_ref()
|
self.email.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const fn desktop(&self) -> bool {
|
pub const fn desktop(&self) -> Option<bool> {
|
||||||
self.desktop
|
self.desktop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -774,7 +774,11 @@ mod given {
|
||||||
ServerStorage::new(a_name().into())
|
ServerStorage::new(a_name().into())
|
||||||
}
|
}
|
||||||
pub fn a_shout() -> Shout {
|
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> {
|
pub fn some_forge_configs() -> BTreeMap<String, ForgeConfig> {
|
||||||
[(a_name(), a_forge_config())].into()
|
[(a_name(), a_forge_config())].into()
|
||||||
|
|
Loading…
Reference in a new issue