Commit d58cd01c by Sixong.Zhu

消息撤回机制修正

parent 8d03d0e7
......@@ -11,7 +11,7 @@ export function parserMessage(type: string, rawMsg: string) {
} else if (type === MessageType.File) {
return `[文件]`;
} else if (type === MessageType.Withdraw) {
return `[撤回了一条消息]`;
return `[撤回了一条消息]`;
} else {
return `[系统自动回复]`;
}
......
......@@ -355,7 +355,7 @@ export default class MessageList extends Vue {
return v;
}
private refresh(msg: number) {
private refresh() {
this.fetchNewMsg();
}
}
......
......@@ -93,7 +93,7 @@
class="msg-detail withdraw-message"
v-else-if="messageType === 'withdraw'"
>
撤回了一条消息
{{ userName }}撤回了一条消息
</div>
<!-- Text -->
<div
......@@ -482,9 +482,7 @@ export default class Message extends Mixins(Filters) {
<style lang="less" scoped>
.message-con {
margin: 20px 0;
padding-bottom: 20px;
margin-bottom: 0;
margin-right: 15px;
position: relative;
......
......@@ -141,7 +141,7 @@ class ChatCacheDatabaseController {
this.setupChatMessageDatabase(chat).finally(() => {
const store = this.buildChatMessageStore(chat);
for (const item of items) {
store.add(item, item.id);
store.add(item);
}
});
}
......@@ -170,17 +170,21 @@ class ChatCacheDatabaseController {
}
const store = this.buildChatMessageStore(chat);
for (const item of items) {
store.add(item, item.id);
store.add(item);
}
});
}
public removeMessage(chat: number, msg: number) {
return new Promise<void>((resolve, reject) => {
const store = this.buildChatMessageStore(chat);
const d = store.delete(msg);
d.onsuccess = () => resolve();
d.onerror = () => reject();
if (this.db) {
const store = this.buildChatMessageStore(chat);
const d = store.delete(msg);
d.onsuccess = () => setTimeout(() => resolve(), 100);
d.onerror = () => reject();
} else {
resolve();
}
});
}
......
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