Commit 13350257 by Sixong.Zhu Committed by 杨铁龙

支持消息撤回和撤回消息过滤

parent 19f15b59
Showing with 26 additions and 3 deletions
...@@ -52,6 +52,16 @@ export type ChatListRequestList = { ...@@ -52,6 +52,16 @@ export type ChatListRequestList = {
total: number; total: number;
}; };
export const enum MessageType {
Text = "text",
Image = "image",
File = "file",
Video = "video",
Voice = "voice",
GeneralOrderMsg = "general_order_msg",
Withdraw = "withdraw",
}
export interface Message { export interface Message {
at_id: string; at_id: string;
chat_id: number; chat_id: number;
...@@ -69,7 +79,7 @@ export interface Message { ...@@ -69,7 +79,7 @@ export interface Message {
status: number; status: number;
total_read_count: number; total_read_count: number;
ts: number; ts: number;
type: "text" | "image" | "file" | "video" | "voice" | "general_order_msg"; type: MessageType;
update_time: number; update_time: number;
url: string; url: string;
} }
......
import { RootStoreState } from "@/store/model"; import { RootStoreState } from "@/store/model";
import { Module } from "vuex"; import { Module } from "vuex";
import Vue from "vue" import Vue from "vue"
import { ChatMember } from "../model"; import { ChatMember, MessageType } from "../model";
import { isAccessibleUrl } from "../service/tools"; import { isAccessibleUrl } from "../service/tools";
import { unique } from "../utils"; import { unique } from "../utils";
import { getChatModelInfo } from "../utils/chat-info"; import { getChatModelInfo } from "../utils/chat-info";
...@@ -787,7 +787,10 @@ export default { ...@@ -787,7 +787,10 @@ export default {
}, },
getters: { getters: {
[ChatStore.STATE_CHAT_MSG_HISTORY](state) { [ChatStore.STATE_CHAT_MSG_HISTORY](state) {
return state[ChatStore.STATE_CHAT_MSG_HISTORY] ?? []; // 过滤消息撤回
const msgList = state[ChatStore.STATE_CHAT_MSG_HISTORY] ?? [];
const drawList = msgList.filter(i => i.type === MessageType.Withdraw).map(i => +i.msg);
return msgList.filter(i => !drawList.includes(i.id));
}, },
[ChatStore.STATE_CHAT_SENDING_MESSAGES](state) { [ChatStore.STATE_CHAT_SENDING_MESSAGES](state) {
return state[ChatStore.STATE_CHAT_SENDING_MESSAGES] || []; return state[ChatStore.STATE_CHAT_SENDING_MESSAGES] || [];
......
...@@ -285,6 +285,16 @@ export class Xim { ...@@ -285,6 +285,16 @@ export class Xim {
return this; return this;
} }
public async withdraw(chat: number, msg: number) {
this.checkConnected();
if (this.client == null) {
throw new Error("client shouldn't undefined");
}
return this.client
.withdrawMsg(chatType, chat, msg)
.then((r) => r.args[0]);
}
/** /**
* 移除会话(用户端/移动端使用) * 移除会话(用户端/移动端使用)
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment