Page MenuHomePhabricator

D12426.diff
No OneTemporary

D12426.diff

diff --git a/keyserver/src/creators/invite-link-creator.js b/keyserver/src/creators/invite-link-creator.js
--- a/keyserver/src/creators/invite-link-creator.js
+++ b/keyserver/src/creators/invite-link-creator.js
@@ -3,10 +3,8 @@
import Filter from 'bad-words';
import uuid from 'uuid';
-import {
- inviteLinkBlobHash,
- inviteSecretRegex,
-} from 'lib/shared/invite-links.js';
+import { inviteSecretRegex } from 'lib/shared/invite-links-constants.js';
+import { inviteLinkBlobHash } from 'lib/shared/invite-links.js';
import { isStaff } from 'lib/shared/staff-utils.js';
import type {
CreateOrUpdatePublicLinkRequest,
diff --git a/keyserver/src/responders/website-responders.js b/keyserver/src/responders/website-responders.js
--- a/keyserver/src/responders/website-responders.js
+++ b/keyserver/src/responders/website-responders.js
@@ -10,7 +10,7 @@
import { promisify } from 'util';
import stores from 'lib/facts/stores.js';
-import { inviteSecretRegex } from 'lib/shared/invite-links.js';
+import { inviteSecretRegex } from 'lib/shared/invite-links-constants.js';
import getTitle from 'web/title/get-title.js';
import { waitForStream } from '../utils/json-stream.js';
diff --git a/lib/shared/invite-links-constants.js b/lib/shared/invite-links-constants.js
new file mode 100644
--- /dev/null
+++ b/lib/shared/invite-links-constants.js
@@ -0,0 +1,26 @@
+// @flow
+
+const inviteLinkErrorMessages: { +[string]: string } = {
+ invalid_characters: 'Link cannot contain any spaces or special characters.',
+ offensive_words: 'No offensive or abusive words allowed.',
+ already_in_use: 'Public link URL already in use.',
+ link_reserved:
+ 'This public link is currently reserved. Please contact support@' +
+ 'comm.app if you would like to claim this link.',
+};
+
+const defaultErrorMessage = 'Unknown error.';
+
+const inviteSecretRegexString = '[a-zA-Z0-9-]+';
+
+const inviteSecretRegex: RegExp = new RegExp(
+ `^${inviteSecretRegexString}$`,
+ 'i',
+);
+
+export {
+ inviteSecretRegex,
+ inviteSecretRegexString,
+ defaultErrorMessage,
+ inviteLinkErrorMessages,
+};
diff --git a/lib/shared/invite-links.js b/lib/shared/invite-links.js
--- a/lib/shared/invite-links.js
+++ b/lib/shared/invite-links.js
@@ -3,17 +3,6 @@
import blobService from '../facts/blob-service.js';
import { getBlobFetchableURL } from '../utils/blob-service.js';
-const inviteLinkErrorMessages: { +[string]: string } = {
- invalid_characters: 'Link cannot contain any spaces or special characters.',
- offensive_words: 'No offensive or abusive words allowed.',
- already_in_use: 'Public link URL already in use.',
- link_reserved:
- 'This public link is currently reserved. Please contact support@' +
- 'comm.app if you would like to claim this link.',
-};
-
-const defaultErrorMessage = 'Unknown error.';
-
function inviteLinkBlobHash(secret: string): string {
return `invite_${secret}`;
}
@@ -45,17 +34,4 @@
return null;
}
-const inviteSecretRegexString = '[a-zA-Z0-9-]+';
-const inviteSecretRegex: RegExp = new RegExp(
- `^${inviteSecretRegexString}$`,
- 'i',
-);
-
-export {
- inviteLinkErrorMessages,
- defaultErrorMessage,
- inviteLinkBlobHash,
- getKeyserverOverrideForAnInviteLink,
- inviteSecretRegexString,
- inviteSecretRegex,
-};
+export { inviteLinkBlobHash, getKeyserverOverrideForAnInviteLink };
diff --git a/lib/utils/url-utils.js b/lib/utils/url-utils.js
--- a/lib/utils/url-utils.js
+++ b/lib/utils/url-utils.js
@@ -9,7 +9,7 @@
pendingThreadIDRegex,
tUserID,
} from './validation-utils.js';
-import { inviteSecretRegexString } from '../shared/invite-links.js';
+import { inviteSecretRegexString } from '../shared/invite-links-constants.js';
type MutableURLInfo = {
year?: number,
diff --git a/native/invite-links/manage-public-link-screen.react.js b/native/invite-links/manage-public-link-screen.react.js
--- a/native/invite-links/manage-public-link-screen.react.js
+++ b/native/invite-links/manage-public-link-screen.react.js
@@ -9,7 +9,7 @@
import {
defaultErrorMessage,
inviteLinkErrorMessages,
-} from 'lib/shared/invite-links.js';
+} from 'lib/shared/invite-links-constants.js';
import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js';
import Button from '../components/button.react.js';
diff --git a/web/invite-links/manage/edit-link-modal.react.js b/web/invite-links/manage/edit-link-modal.react.js
--- a/web/invite-links/manage/edit-link-modal.react.js
+++ b/web/invite-links/manage/edit-link-modal.react.js
@@ -9,7 +9,7 @@
import {
defaultErrorMessage,
inviteLinkErrorMessages,
-} from 'lib/shared/invite-links.js';
+} from 'lib/shared/invite-links-constants.js';
import type { InviteLink } from 'lib/types/link-types.js';
import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js';

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 1, 10:14 PM (19 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2606198
Default Alt Text
D12426.diff (4 KB)

Event Timeline