diff --git a/app/actions/definitions/developer.tsx b/app/actions/definitions/developer.tsx
index 9831f78ea..290202ee9 100644
--- a/app/actions/definitions/developer.tsx
+++ b/app/actions/definitions/developer.tsx
@@ -1,4 +1,5 @@
-import { ToolsIcon, TrashIcon, UserIcon } from "outline-icons";
+import copy from "copy-to-clipboard";
+import { CopyIcon, ToolsIcon, TrashIcon, UserIcon } from "outline-icons";
import * as React from "react";
import { toast } from "sonner";
import { createAction } from "~/actions";
@@ -8,6 +9,71 @@ import { client } from "~/utils/ApiClient";
import Logger from "~/utils/Logger";
import { deleteAllDatabases } from "~/utils/developer";
+export const copyId = createAction({
+ name: ({ t }) => t("Copy ID"),
+ icon: ,
+ keywords: "uuid",
+ section: DeveloperSection,
+ children: ({
+ currentTeamId,
+ currentUserId,
+ activeCollectionId,
+ activeDocumentId,
+ }) => {
+ function copyAndToast(text: string | null | undefined) {
+ if (text) {
+ copy(text);
+ toast.success("Copied to clipboard");
+ }
+ }
+
+ return [
+ createAction({
+ name: "Copy User ID",
+ section: DeveloperSection,
+ icon: ,
+ visible: () => !!currentUserId,
+ perform: () => copyAndToast(currentUserId),
+ }),
+ createAction({
+ name: "Copy Team ID",
+ section: DeveloperSection,
+ icon: ,
+ visible: () => !!currentTeamId,
+ perform: () => copyAndToast(currentTeamId),
+ }),
+ createAction({
+ name: "Copy Collection ID",
+ icon: ,
+ section: DeveloperSection,
+ visible: () => !!activeCollectionId,
+ perform: () => copyAndToast(activeCollectionId),
+ }),
+ createAction({
+ name: "Copy Document ID",
+ icon: ,
+ section: DeveloperSection,
+ visible: () => !!activeDocumentId,
+ perform: () => copyAndToast(activeDocumentId),
+ }),
+ createAction({
+ name: "Copy Team ID",
+ icon: ,
+ section: DeveloperSection,
+ visible: () => !!currentTeamId,
+ perform: () => copyAndToast(currentTeamId),
+ }),
+ createAction({
+ name: "Copy Release ID",
+ icon: ,
+ section: DeveloperSection,
+ visible: () => !!env.RELEASE,
+ perform: () => copyAndToast(env.RELEASE),
+ }),
+ ];
+ },
+});
+
export const clearIndexedDB = createAction({
name: ({ t }) => t("Delete IndexedDB cache"),
icon: ,
@@ -67,7 +133,13 @@ export const developer = createAction({
icon: ,
iconInContextMenu: false,
section: DeveloperSection,
- children: [clearIndexedDB, toggleDebugLogging, createToast, createTestUsers],
+ children: [
+ copyId,
+ clearIndexedDB,
+ toggleDebugLogging,
+ createToast,
+ createTestUsers,
+ ],
});
export const rootDeveloperActions = [developer];
diff --git a/shared/i18n/locales/en_US/translation.json b/shared/i18n/locales/en_US/translation.json
index 5710e6c8b..09598a19a 100644
--- a/shared/i18n/locales/en_US/translation.json
+++ b/shared/i18n/locales/en_US/translation.json
@@ -10,6 +10,7 @@
"Unstar": "Unstar",
"Delete": "Delete",
"Delete collection": "Delete collection",
+ "Copy ID": "Copy ID",
"Delete IndexedDB cache": "Delete IndexedDB cache",
"IndexedDB cache deleted": "IndexedDB cache deleted",
"Toggle debug logging": "Toggle debug logging",