fix: additional bugs - push notification unwraps and as any cleanup
- Replace Option::unwrap() with let-chains for push subscription fields - Remove unsafe (repo as any).branch_count access in settings
This commit is contained in:
parent
bdb5393835
commit
e96bb29434
@ -58,15 +58,11 @@ impl AppService {
|
|||||||
|
|
||||||
if let Ok(Some(prefs)) = prefs {
|
if let Ok(Some(prefs)) = prefs {
|
||||||
if prefs.push_enabled
|
if prefs.push_enabled
|
||||||
&& prefs.push_subscription_endpoint.is_some()
|
&& let Some(endpoint) = &prefs.push_subscription_endpoint
|
||||||
&& prefs.push_subscription_keys_p256dh.is_some()
|
&& let Some(p256dh) = &prefs.push_subscription_keys_p256dh
|
||||||
&& prefs.push_subscription_keys_auth.is_some()
|
&& let Some(auth) = &prefs.push_subscription_keys_auth
|
||||||
{
|
{
|
||||||
let endpoint = prefs.push_subscription_endpoint.unwrap();
|
if let Err(e) = push.send(endpoint, p256dh, auth, &payload).await {
|
||||||
let p256dh = prefs.push_subscription_keys_p256dh.unwrap();
|
|
||||||
let auth = prefs.push_subscription_keys_auth.unwrap();
|
|
||||||
|
|
||||||
if let Err(e) = push.send(&endpoint, &p256dh, &auth, &payload).await {
|
|
||||||
tracing::warn!(user_id = %user_id, error = %e, "WebPush send failed");
|
tracing::warn!(user_id = %user_id, error = %e, "WebPush send failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -269,7 +269,7 @@ export function RepoSettingsGeneral() {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Label className="text-muted-foreground text-xs uppercase tracking-wide">Branches</Label>
|
<Label className="text-muted-foreground text-xs uppercase tracking-wide">Branches</Label>
|
||||||
<p className="font-medium mt-0.5">{(repo as any).branch_count ?? 0}</p>
|
<p className="font-medium mt-0.5">—</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user