Skip to content

Commit 00f843e

Browse files
chrisbobbegnprice
authored andcommitted
ServerCompatBanner [nfc]: Bring out constant kServerSupportDocUrl
1 parent df7f6f2 commit 00f843e

File tree

4 files changed

+25
-33
lines changed

4 files changed

+25
-33
lines changed

src/common/ServerCompatBanner.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,19 @@ import { ZulipVersion } from '../utils/zulipVersion';
1313
import { getOwnUserRole, roleIsAtLeast } from '../permissionSelectors';
1414
import { Role } from '../api/permissionsTypes';
1515

16+
/**
17+
* The doc stating our oldest supported server version.
18+
*/
19+
// TODO: Instead, link to new Help Center doc once we have it:
20+
// https://github.com/zulip/zulip/issues/23842
21+
export const kServerSupportDocUrl: URL = new URL(
22+
'https://zulip.readthedocs.io/en/stable/overview/release-lifecycle.html#compatibility-and-upgrading',
23+
);
24+
1625
/**
1726
* The oldest version we currently support.
1827
*
19-
* Should match what we say at:
20-
* https://zulip.readthedocs.io/en/stable/overview/release-lifecycle.html#compatibility-and-upgrading
28+
* Should match what we say at kServerSupportDocUrl.
2129
*
2230
* See also kMinAllowedServerVersion in apiErrors.js, for the version below
2331
* which we just refuse to connect.
@@ -98,14 +106,7 @@ export default function ServerCompatBanner(props: Props): Node {
98106
id: 'learn-more',
99107
label: 'Learn more',
100108
onPress: () => {
101-
openLinkWithUserPreference(
102-
// TODO: Instead, link to new Help Center doc once we have it:
103-
// https://github.com/zulip/zulip/issues/23842
104-
new URL(
105-
'https://zulip.readthedocs.io/en/stable/overview/release-lifecycle.html#compatibility-and-upgrading',
106-
),
107-
settings,
108-
);
109+
openLinkWithUserPreference(kServerSupportDocUrl, settings);
109110
},
110111
},
111112
]}

src/events/eventActions.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ import { tryFetch, fetchPrivateMessages } from '../message/fetchActions';
3434
import { MIN_RECENTPMS_SERVER_VERSION } from '../pm-conversations/pmConversationsModel';
3535
import { sendOutbox } from '../outbox/outboxActions';
3636
import { initNotifications, tryStopNotifications } from '../notification/notifTokens';
37-
import { kMinSupportedVersion, kNextMinSupportedVersion } from '../common/ServerCompatBanner';
37+
import {
38+
kMinSupportedVersion,
39+
kNextMinSupportedVersion,
40+
kServerSupportDocUrl,
41+
} from '../common/ServerCompatBanner';
3842
import { maybeRefreshServerEmojiData } from '../emoji/data';
3943

4044
const registerStart = (): PerAccountAction => ({
@@ -171,11 +175,7 @@ export const registerAndStartPolling =
171175
'Could not connect',
172176
`${identity.realm.toString()} is running Zulip Server ${e.version.raw()}, which is unsupported. The minimum supported version is Zulip Server ${kMinSupportedVersion.raw()}.`,
173177
{
174-
url: new URL(
175-
// TODO: Instead, link to new Help Center doc once we have it:
176-
// https://github.com/zulip/zulip/issues/23842
177-
'https://zulip.readthedocs.io/en/stable/overview/release-lifecycle.html#compatibility-and-upgrading',
178-
),
178+
url: kServerSupportDocUrl,
179179
globalSettings: getGlobalSettings(),
180180
},
181181
);

src/message/fetchActions.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ import { ALL_PRIVATE_NARROW, apiNarrowOfNarrow, caseNarrow, topicNarrow } from '
3838
import { BackoffMachine, promiseTimeout, TimeoutError } from '../utils/async';
3939
import { getAllUsersById, getOwnUserId } from '../users/userSelectors';
4040
import type { ServerSettings } from '../api/settings/getServerSettings';
41-
import { kMinSupportedVersion, kNextMinSupportedVersion } from '../common/ServerCompatBanner';
41+
import {
42+
kMinSupportedVersion,
43+
kNextMinSupportedVersion,
44+
kServerSupportDocUrl,
45+
} from '../common/ServerCompatBanner';
4246

4347
const messageFetchStart = (
4448
narrow: Narrow,
@@ -400,13 +404,7 @@ export async function fetchServerSettings(realm: URL): Promise<
400404
minSupportedVersion: kMinSupportedVersion.raw(),
401405
},
402406
};
403-
learnMoreButton = {
404-
url: new URL(
405-
// TODO: Instead, link to new Help Center doc once we have it:
406-
// https://github.com/zulip/zulip/issues/23842
407-
'https://zulip.readthedocs.io/en/stable/overview/release-lifecycle.html#compatibility-and-upgrading',
408-
),
409-
};
407+
learnMoreButton = { url: kServerSupportDocUrl };
410408
logging.setTagsFromServerVersion(error.version);
411409
logging.error(error, {
412410
kMinAllowedServerVersion: kMinAllowedServerVersion.raw(),

src/settings/SettingsScreen.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { setGlobalSettings } from '../actions';
2525
import { shouldUseInAppBrowser } from '../utils/openLink';
2626
import TextRow from '../common/TextRow';
2727
import { getIdentity, getServerVersion } from '../account/accountsSelectors';
28-
import { kMinSupportedVersion } from '../common/ServerCompatBanner';
28+
import { kMinSupportedVersion, kServerSupportDocUrl } from '../common/ServerCompatBanner';
2929
import { kWarningColor } from '../styles/constants';
3030
import { showErrorAlert } from '../utils/info';
3131
import { TranslationContext } from '../boot/TranslationProvider';
@@ -145,14 +145,7 @@ export default function SettingsScreen(props: Props): Node {
145145
minSupportedVersion: kMinSupportedVersion.raw(),
146146
},
147147
}),
148-
{
149-
url: new URL(
150-
// TODO: Instead, link to new Help Center doc once we have it:
151-
// https://github.com/zulip/zulip/issues/23842
152-
'https://zulip.readthedocs.io/en/stable/overview/release-lifecycle.html#compatibility-and-upgrading',
153-
),
154-
globalSettings,
155-
},
148+
{ url: kServerSupportDocUrl, globalSettings },
156149
);
157150
},
158151
})}

0 commit comments

Comments
 (0)