feat: Add emoji and alot of other fixes
This commit is contained in:
@@ -13,6 +13,7 @@ import { DirectMessageRepository } from '../../infrastructure/direct-message.rep
|
||||
import { OfflineMessageQueueService } from './offline-message-queue.service';
|
||||
import { PeerDeliveryService } from './peer-delivery.service';
|
||||
import { AttachmentFacade } from '../../../attachment';
|
||||
import { CustomEmojiService } from '../../../custom-emoji';
|
||||
import {
|
||||
advanceDirectMessageStatus,
|
||||
createDirectConversation,
|
||||
@@ -65,6 +66,7 @@ export class DirectMessageService {
|
||||
private readonly offlineQueue = inject(OfflineMessageQueueService);
|
||||
private readonly delivery = inject(PeerDeliveryService);
|
||||
private readonly attachments = inject(AttachmentFacade);
|
||||
private readonly customEmoji = inject(CustomEmojiService);
|
||||
private readonly store = inject(Store);
|
||||
private readonly router = inject(Router);
|
||||
private readonly currentUser = this.store.selectSignal(selectCurrentUser);
|
||||
@@ -694,6 +696,12 @@ export class DirectMessageService {
|
||||
|
||||
await this.persistConversation(ownerId, updatedConversation);
|
||||
|
||||
if (payload.type === 'edit' && payload.content) {
|
||||
this.customEmoji.pushEmojisInContent(payload.content);
|
||||
} else if (payload.type === 'reaction-add' && payload.reaction?.emoji) {
|
||||
this.customEmoji.pushEmojisInContent(payload.reaction.emoji);
|
||||
}
|
||||
|
||||
for (const recipientId of recipientIds) {
|
||||
this.delivery.sendViaWebRTC(recipientId, {
|
||||
type: 'direct-message-mutation',
|
||||
@@ -761,6 +769,8 @@ export class DirectMessageService {
|
||||
|
||||
let sentCount = 0;
|
||||
|
||||
this.customEmoji.pushEmojisInContent(message.content);
|
||||
|
||||
for (const recipientId of recipientIds) {
|
||||
if (this.delivery.sendViaWebRTC(recipientId, {
|
||||
type: 'direct-message',
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
lucideClock3
|
||||
} from '@ng-icons/lucide';
|
||||
import { ChatMessageMarkdownComponent } from '../../../chat';
|
||||
import { isSingleUnicodeEmojiOnlyMessage } from '../../../custom-emoji';
|
||||
import type { DirectMessage } from '../../domain/models/direct-message.model';
|
||||
|
||||
const RICH_MARKDOWN_PATTERNS = [
|
||||
@@ -40,7 +41,8 @@ export class DmMessageComponent {
|
||||
readonly isOutgoing = computed(() => this.message().senderId === this.currentUserId());
|
||||
|
||||
requiresRichMarkdown(content: string): boolean {
|
||||
return RICH_MARKDOWN_PATTERNS.some((pattern) => pattern.test(content));
|
||||
return isSingleUnicodeEmojiOnlyMessage(content)
|
||||
|| RICH_MARKDOWN_PATTERNS.some((pattern) => pattern.test(content));
|
||||
}
|
||||
|
||||
statusIcon(status: DirectMessage['status']): string {
|
||||
|
||||
Reference in New Issue
Block a user