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) {
|
||||
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({
|
||||
text: intl.formatMessage(messages.external, { domain }),
|
||||
icon: require('@tabler/icons/outline/external-link.svg'),
|
||||
href: status.uri,
|
||||
href: externalNostrUrl || status.uri,
|
||||
target: '_blank',
|
||||
});
|
||||
}
|
||||
|
|
|
@ -311,14 +311,19 @@ const Header: React.FC<IHeader> = ({ account }) => {
|
|||
});
|
||||
}
|
||||
|
||||
if (features.federating && !account.local) {
|
||||
const domain = account.fqn.split('@')[1];
|
||||
const externalNostrUrl = account.ditto.external_url ? new URL(account.ditto.external_url).host : undefined;
|
||||
if (features.federating && (!account.local || externalNostrUrl)) {
|
||||
const domain = externalNostrUrl || account.fqn.split('@')[1];
|
||||
const url = account.ditto.external_url || account.url;
|
||||
|
||||
menu.push({
|
||||
text: intl.formatMessage(messages.profileExternal, { domain }),
|
||||
action: () => onProfileExternal(account.url),
|
||||
icon: require('@tabler/icons/outline/external-link.svg'),
|
||||
});
|
||||
if (domain && url) {
|
||||
menu.push({
|
||||
text: intl.formatMessage(messages.profileExternal, { domain }),
|
||||
action: () => onProfileExternal(url),
|
||||
icon: require('@tabler/icons/outline/external-link.svg'),
|
||||
href: url,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
menu.push({
|
||||
|
|
|
@ -67,6 +67,7 @@ export const StatusRecord = ImmutableRecord({
|
|||
muted: false,
|
||||
pinned: false,
|
||||
pleroma: ImmutableMap<string, any>(),
|
||||
ditto: ImmutableMap<string, any>(),
|
||||
poll: null as EmbeddedEntity<Poll>,
|
||||
quote: null as EmbeddedEntity<any>,
|
||||
quotes_count: 0,
|
||||
|
|
|
@ -43,6 +43,7 @@ const baseAccountSchema = z.object({
|
|||
ditto: coerceObject({
|
||||
accepts_zaps: z.boolean().catch(false),
|
||||
is_registered: z.boolean().catch(false),
|
||||
external_url: z.string().optional().catch(undefined),
|
||||
}),
|
||||
emojis: filteredArray(customEmojiSchema),
|
||||
fields: filteredArray(fieldSchema),
|
||||
|
|
|
@ -24,6 +24,10 @@ const statusPleromaSchema = z.object({
|
|||
quote_visible: z.boolean().catch(true),
|
||||
});
|
||||
|
||||
const statusDittoSchema = z.object({
|
||||
external_url: z.string().optional().catch(undefined),
|
||||
});
|
||||
|
||||
const baseStatusSchema = z.object({
|
||||
account: accountSchema,
|
||||
application: z.object({
|
||||
|
@ -51,6 +55,7 @@ const baseStatusSchema = z.object({
|
|||
muted: z.coerce.boolean(),
|
||||
pinned: z.coerce.boolean(),
|
||||
pleroma: statusPleromaSchema.optional().catch(undefined),
|
||||
ditto: statusDittoSchema.optional().catch(undefined),
|
||||
reactions: filteredArray(emojiReactionSchema),
|
||||
poll: pollSchema.nullable().catch(null),
|
||||
quote: z.literal(null).catch(null),
|
||||
|
@ -152,4 +157,4 @@ const statusSchema = baseStatusSchema.extend({
|
|||
|
||||
type Status = Resolve<z.infer<typeof statusSchema>>;
|
||||
|
||||
export { statusSchema, type Status };
|
||||
export { statusSchema, type Status };
|
||||
|
|
Ładowanie…
Reference in New Issue