Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

fix(app): show active incidents on the reconnecting banner (#3128)

Hampusb54016653b5b
diff --git a/fluxer_app/src/features/app/hooks/useConnectionNotice.ts b/fluxer_app/src/features/app/hooks/useConnectionNotice.ts
index b32907096..cde682b19 100644
--- a/fluxer_app/src/features/app/hooks/useConnectionNotice.ts
+++ b/fluxer_app/src/features/app/hooks/useConnectionNotice.ts
@@ -60,12 +60,12 @@ export interface ConnectionNoticeShape {
}
export function resolveConnectionNoticeShape(): ConnectionNoticeShape {
- if (isClientReconnecting()) {
- return {tone: ConnectionNoticeTone.NEUTRAL, hasActions: false};
- }
if (StatusPage.scheduledMaintenance != null) {
return {tone: ConnectionNoticeTone.MAINTENANCE, hasActions: true};
}
+ if (isClientReconnecting()) {
+ return {tone: ConnectionNoticeTone.NEUTRAL, hasActions: StatusPage.incident != null};
+ }
return {tone: ConnectionNoticeTone.NEUTRAL, hasActions: true};
}
@@ -103,21 +103,14 @@ export function useConnectionNotice(): ConnectionNotice | null {
if (!forced && !connectionUnavailable) {
return null;
}
- if (reconnecting) {
- return {
- tone: ConnectionNoticeTone.NEUTRAL,
- message: i18n._(CONNECTION_LOST_DESCRIPTOR),
- action: null,
- showSwitchAccount: false,
- };
- }
+ const noticeShowsSwitchAccount = showSwitchAccount && !reconnecting;
const maintenance = StatusPage.scheduledMaintenance;
if (maintenance != null) {
return {
tone: ConnectionNoticeTone.MAINTENANCE,
message: maintenance.name,
action: {label: i18n._(VIEW_MAINTENANCE_DETAILS_DESCRIPTOR), url: maintenance.url},
- showSwitchAccount,
+ showSwitchAccount: noticeShowsSwitchAccount,
};
}
const incident = StatusPage.incident;
@@ -126,7 +119,15 @@ export function useConnectionNotice(): ConnectionNotice | null {
tone: ConnectionNoticeTone.NEUTRAL,
message: incident.name,
action: {label: i18n._(VIEW_INCIDENT_DETAILS_DESCRIPTOR), url: incident.url},
- showSwitchAccount,
+ showSwitchAccount: noticeShowsSwitchAccount,
+ };
+ }
+ if (reconnecting) {
+ return {
+ tone: ConnectionNoticeTone.NEUTRAL,
+ message: i18n._(CONNECTION_LOST_DESCRIPTOR),
+ action: null,
+ showSwitchAccount: false,
};
}
return {