fix(app): honour silent and emoticon settings on forward comments (#2000)

This commit is contained in:
Hampus authored and GitHub committed 2026-08-25 12:56:53 +02:00
1 parent 9f5a5b16d3
commit 42e45a0e3a
1 file changed
+8 -5
@@ -31,9 +31,10 @@ import {
collectMessageModelGuildMemberUserIds, collectMessageModelGuildMemberUserIds,
collectWireMessageGuildMemberUserIds, collectWireMessageGuildMemberUserIds,
} from '@app/features/messaging/utils/MessageMemberLoadUtils'; } from '@app/features/messaging/utils/MessageMemberLoadUtils';
import type { import {
ApiAttachmentMetadata, type ApiAttachmentMetadata,
ApiMessageEditAttachmentMetadata, type ApiMessageEditAttachmentMetadata,
normalizeMessageContent,
} from '@app/features/messaging/utils/MessageRequestUtils'; } from '@app/features/messaging/utils/MessageRequestUtils';
import * as IARCommands from '@app/features/moderation/commands/IARCommands'; import * as IARCommands from '@app/features/moderation/commands/IARCommands';
import * as NavigationCommands from '@app/features/navigation/commands/NavigationCommands'; import * as NavigationCommands from '@app/features/navigation/commands/NavigationCommands';
@@ -814,6 +815,7 @@ export async function forward(
optionalMessage?: string, optionalMessage?: string,
): Promise<boolean> { ): Promise<boolean> {
logger.debug(`Forwarding message ${messageReference.message_id} to ${channelIds.length} channels`); logger.debug(`Forwarding message ${messageReference.message_id} to ${channelIds.length} channels`);
const normalizedComment = optionalMessage == null ? null : normalizeMessageContent(optionalMessage);
try { try {
for (const channelId of channelIds) { for (const channelId of channelIds) {
const nonce = SnowflakeUtils.fromTimestamp(Date.now()); const nonce = SnowflakeUtils.fromTimestamp(Date.now());
@@ -835,11 +837,12 @@ export async function forward(
return false; return false;
} }
SlowmodeCommands.confirmMessageSend(channelId, forwardedMessage.timestamp); SlowmodeCommands.confirmMessageSend(channelId, forwardedMessage.timestamp);
if (optionalMessage) { if (normalizedComment != null && normalizedComment.content.length > 0) {
const commentNonce = SnowflakeUtils.fromTimestamp(Date.now() + 1); const commentNonce = SnowflakeUtils.fromTimestamp(Date.now() + 1);
const commentMessage = await send(channelId, { const commentMessage = await send(channelId, {
content: optionalMessage, content: normalizedComment.content,
nonce: commentNonce, nonce: commentNonce,
flags: normalizedComment.flags,
}); });
if (!commentMessage) { if (!commentMessage) {
logger.warn(`Forward comment send failed in channel ${channelId}`); logger.warn(`Forward comment send failed in channel ${channelId}`);