Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix[mobile]: channel message links (#1769)

Peter Chinman8ed267f51e00
diff --git a/js/app/packages/channel/Channel/create-channel-message-actions.ts b/js/app/packages/channel/Channel/create-channel-message-actions.ts
index cd9d7aa07b..9f118f934c 100644
--- a/js/app/packages/channel/Channel/create-channel-message-actions.ts
+++ b/js/app/packages/channel/Channel/create-channel-message-actions.ts
@@ -1,4 +1,5 @@
import { toast } from '@core/component/Toast/Toast';
+import { getWebOrigin } from '@core/util/webOrigin';
import type { Accessor } from 'solid-js';
import type {
MessageActionHandler,
@@ -60,7 +61,11 @@ export type CreateChannelMessageActionsOptions = {
function createDefaultEffects(): ChannelMessageActionEffects {
return {
- getLocationHref: () => window.location.href,
+ getLocationHref: () =>
+ getWebOrigin() +
+ window.location.pathname +
+ window.location.search +
+ window.location.hash,
copyToClipboard: (text) => navigator.clipboard.writeText(text),
promptForEdit: (content) => window.prompt('Edit message', content),
notifyCopyLinkSuccess: () => {
diff --git a/js/app/packages/core/util/url.ts b/js/app/packages/core/util/url.ts
index 64be958b71..b212747667 100644
--- a/js/app/packages/core/util/url.ts
+++ b/js/app/packages/core/util/url.ts
@@ -1,7 +1,6 @@
import { fileTypeToBlockName } from '@core/constant/allBlocks';
-import { isTauri } from './platform';
import shortuuid from 'short-uuid';
-
+import { getWebOrigin } from './webOrigin';
const short = shortuuid(shortuuid.constants.flickrBase58, {
consistentLength: false,
});
@@ -18,15 +17,6 @@ export function openExternalUrl(url: string) {
window.open(url, '_blank', 'noopener,noreferrer')?.focus();
}
-function getWebOrigin(): string {
- if (isTauri()) {
- return import.meta.env.MODE === 'development'
- ? 'https://dev.macro.com'
- : 'https://macro.com';
- }
- return window.location.origin;
-}
-
export function transformShortIdInUrlPathname(pathname: string) {
const parts = pathname.split('/');
const newParts = [];
diff --git a/js/app/packages/core/util/webOrigin.ts b/js/app/packages/core/util/webOrigin.ts
new file mode 100644
index 0000000000..d73e98debc
--- /dev/null
+++ b/js/app/packages/core/util/webOrigin.ts
@@ -0,0 +1,10 @@
+import { isTauri } from './platform';
+
+export function getWebOrigin(): string {
+ if (isTauri()) {
+ return import.meta.env.MODE === 'development'
+ ? 'https://dev.macro.com'
+ : 'https://macro.com';
+ }
+ return window.location.origin;
+}