kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Merge branch 'use-external-viewer-link' into 'main'
Use external viewer link Closes #1673 See merge request soapbox-pub/soapbox!3070environments/review-main-yi2y9f/deployments/4710
commit
60d3ad3ebd
|
@ -464,11 +464,13 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (features.federating && !account.local) {
|
if (features.federating && !account.local) {
|
||||||
const { hostname: domain } = new URL(status.uri);
|
const externalNostrUrl: string | undefined = status.ditto?.get('external_url');
|
||||||
|
const { hostname: domain } = new URL(externalNostrUrl || status.uri);
|
||||||
|
|
||||||
menu.push({
|
menu.push({
|
||||||
text: intl.formatMessage(messages.external, { domain }),
|
text: intl.formatMessage(messages.external, { domain }),
|
||||||
icon: require('@tabler/icons/outline/external-link.svg'),
|
icon: require('@tabler/icons/outline/external-link.svg'),
|
||||||
href: status.uri,
|
href: externalNostrUrl || status.uri,
|
||||||
target: '_blank',
|
target: '_blank',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -311,15 +311,20 @@ const Header: React.FC<IHeader> = ({ account }) => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (features.federating && !account.local) {
|
const externalNostrUrl = account.ditto.external_url ? new URL(account.ditto.external_url).host : undefined;
|
||||||
const domain = account.fqn.split('@')[1];
|
if (features.federating && (!account.local || externalNostrUrl)) {
|
||||||
|
const domain = externalNostrUrl || account.fqn.split('@')[1];
|
||||||
|
const url = account.ditto.external_url || account.url;
|
||||||
|
|
||||||
|
if (domain && url) {
|
||||||
menu.push({
|
menu.push({
|
||||||
text: intl.formatMessage(messages.profileExternal, { domain }),
|
text: intl.formatMessage(messages.profileExternal, { domain }),
|
||||||
action: () => onProfileExternal(account.url),
|
action: () => onProfileExternal(url),
|
||||||
icon: require('@tabler/icons/outline/external-link.svg'),
|
icon: require('@tabler/icons/outline/external-link.svg'),
|
||||||
|
href: url,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
menu.push({
|
menu.push({
|
||||||
text: intl.formatMessage(messages.copy),
|
text: intl.formatMessage(messages.copy),
|
||||||
|
|
|
@ -67,6 +67,7 @@ export const StatusRecord = ImmutableRecord({
|
||||||
muted: false,
|
muted: false,
|
||||||
pinned: false,
|
pinned: false,
|
||||||
pleroma: ImmutableMap<string, any>(),
|
pleroma: ImmutableMap<string, any>(),
|
||||||
|
ditto: ImmutableMap<string, any>(),
|
||||||
poll: null as EmbeddedEntity<Poll>,
|
poll: null as EmbeddedEntity<Poll>,
|
||||||
quote: null as EmbeddedEntity<any>,
|
quote: null as EmbeddedEntity<any>,
|
||||||
quotes_count: 0,
|
quotes_count: 0,
|
||||||
|
|
|
@ -43,6 +43,7 @@ const baseAccountSchema = z.object({
|
||||||
ditto: coerceObject({
|
ditto: coerceObject({
|
||||||
accepts_zaps: z.boolean().catch(false),
|
accepts_zaps: z.boolean().catch(false),
|
||||||
is_registered: z.boolean().catch(false),
|
is_registered: z.boolean().catch(false),
|
||||||
|
external_url: z.string().optional().catch(undefined),
|
||||||
}),
|
}),
|
||||||
emojis: filteredArray(customEmojiSchema),
|
emojis: filteredArray(customEmojiSchema),
|
||||||
fields: filteredArray(fieldSchema),
|
fields: filteredArray(fieldSchema),
|
||||||
|
|
|
@ -24,6 +24,10 @@ const statusPleromaSchema = z.object({
|
||||||
quote_visible: z.boolean().catch(true),
|
quote_visible: z.boolean().catch(true),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const statusDittoSchema = z.object({
|
||||||
|
external_url: z.string().optional().catch(undefined),
|
||||||
|
});
|
||||||
|
|
||||||
const baseStatusSchema = z.object({
|
const baseStatusSchema = z.object({
|
||||||
account: accountSchema,
|
account: accountSchema,
|
||||||
application: z.object({
|
application: z.object({
|
||||||
|
@ -51,6 +55,7 @@ const baseStatusSchema = z.object({
|
||||||
muted: z.coerce.boolean(),
|
muted: z.coerce.boolean(),
|
||||||
pinned: z.coerce.boolean(),
|
pinned: z.coerce.boolean(),
|
||||||
pleroma: statusPleromaSchema.optional().catch(undefined),
|
pleroma: statusPleromaSchema.optional().catch(undefined),
|
||||||
|
ditto: statusDittoSchema.optional().catch(undefined),
|
||||||
reactions: filteredArray(emojiReactionSchema),
|
reactions: filteredArray(emojiReactionSchema),
|
||||||
poll: pollSchema.nullable().catch(null),
|
poll: pollSchema.nullable().catch(null),
|
||||||
quote: z.literal(null).catch(null),
|
quote: z.literal(null).catch(null),
|
||||||
|
|
Ładowanie…
Reference in New Issue