mirror of
https://github.com/fromchat-messenger/web.git
synced 2026-09-23 03:25:07 +03:00
Start inline reply
This commit is contained in:
@@ -88,7 +88,7 @@ export class DMPanel extends MessagePanel {
|
||||
}
|
||||
}
|
||||
|
||||
async sendMessage(content: string): Promise<void> {
|
||||
async sendMessage(content: string, _replyToId?: number): Promise<void> {
|
||||
if (!this.currentUser.authToken || !this.dmData || !content.trim()) return;
|
||||
|
||||
try {
|
||||
|
||||
@@ -48,7 +48,7 @@ export abstract class MessagePanel {
|
||||
abstract activate(): Promise<void>;
|
||||
abstract deactivate(): void;
|
||||
abstract loadMessages(): Promise<void>;
|
||||
abstract sendMessage(content: string): Promise<void>;
|
||||
abstract sendMessage(content: string, replyToId?: number): Promise<void>;
|
||||
abstract isDm(): boolean;
|
||||
|
||||
// Optional WebSocket message handler (can be overridden by subclasses)
|
||||
@@ -115,8 +115,8 @@ export abstract class MessagePanel {
|
||||
}
|
||||
|
||||
// Event handlers
|
||||
handleSendMessage = (content: string): void => {
|
||||
this.sendMessage(content);
|
||||
handleSendMessage = (content: string, replyToId?: number): void => {
|
||||
this.sendMessage(content, replyToId);
|
||||
};
|
||||
|
||||
handleEditMessage = (messageId: number, content: string): void => {
|
||||
|
||||
@@ -61,12 +61,12 @@ export class PublicChatPanel extends MessagePanel {
|
||||
}
|
||||
}
|
||||
|
||||
async sendMessage(content: string): Promise<void> {
|
||||
async sendMessage(content: string, replyToId?: number): Promise<void> {
|
||||
if (!this.currentUser.authToken || !content.trim()) return;
|
||||
|
||||
try {
|
||||
const response = await request({
|
||||
data: { content: content.trim() },
|
||||
data: { content: content.trim(), ...(replyToId ? { reply_to_id: replyToId } : {}) },
|
||||
credentials: {
|
||||
scheme: "Bearer",
|
||||
credentials: this.currentUser.authToken
|
||||
|
||||
Reference in New Issue
Block a user