mirror of
https://github.com/ReCloudStudio/WebHooker.git
synced 2026-09-23 00:21:28 +00:00
fix(render): link title head to the event object URL
This commit is contained in:
parent
2f8a87048e
commit
7ac7bb7958
4 changed files with 13 additions and 31 deletions
|
|
@ -6,7 +6,6 @@ import {
|
|||
MAX_FIELD_VALUE,
|
||||
MAX_FOOTER,
|
||||
MAX_TITLE,
|
||||
repoUrlFromMessage,
|
||||
splitMessageTitle,
|
||||
} from "../../formatters/helpers";
|
||||
|
||||
|
|
@ -27,10 +26,9 @@ export function renderNeutralMessage(message: NeutralMessage): FormattedMessage
|
|||
: undefined;
|
||||
|
||||
// Discord embed titles can only be linked as a whole, so only the repo head
|
||||
// goes into the title (linked to the repository); the `: subject` text is
|
||||
// rendered as the first line of the description, unlinked.
|
||||
// goes into the title (linked to the event's object URL); the `: subject`
|
||||
// text is rendered as the first line of the description, unlinked.
|
||||
const { head, subject } = splitMessageTitle(message.title);
|
||||
const repoUrl = repoUrlFromMessage(message.url);
|
||||
const rawDescription = subject
|
||||
? message.description
|
||||
? `${subject}\n${message.description}`
|
||||
|
|
@ -48,7 +46,7 @@ export function renderNeutralMessage(message: NeutralMessage): FormattedMessage
|
|||
embeds: [
|
||||
{
|
||||
title: cap(head, MAX_TITLE),
|
||||
url: subject ? repoUrl : message.url,
|
||||
url: message.url,
|
||||
color: message.color,
|
||||
description: cap(rawDescription, MAX_DESCRIPTION) || undefined,
|
||||
author: message.author
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue