本地记录范围内屏蔽(ban

This commit is contained in:
2023-10-21 20:25:08 +08:00
parent da2c1ef8c8
commit 367bc51c64
1 changed files with 8 additions and 4 deletions

View File

@ -133,7 +133,9 @@ export default class Chat {
}
async 从本地载入消息() {
const data = await values(this.store)
data.map(item => ({ timestamp: new Date(item.time).getTime(), ...item })).sort((a, b) => a.timestamp - b.timestamp).forEach(item => {
data.map(item => ({ timestamp: new Date(item.time).getTime(), ...item }))
.filter(item => !item.ban)
.sort((a, b) => a.timestamp - b.timestamp).forEach(item => {
this.添加元素(item)
})
}
@ -141,7 +143,7 @@ export default class Chat {
const data = await values(this.store)
return data.map(item => ({ timestamp: new Date(item.time).getTime(), ...item })).filter(item => {
const timestamp = new Date(item.time).getTime()
return timestamp >= start && timestamp <= end
return timestamp >= start && timestamp <= end && !item.ban
})
}
// 检查本地不存在的id,存储消息
@ -199,10 +201,12 @@ export default class Chat {
fontSize: '12px',
color: '#555'
},
textContent: '删除',
textContent: '移除',
title: '加入屏蔽列表不再被渲染',
onclick: event => {
event.target.parentNode.remove()
del(data.id, this.store)
update(data.id, item => ({ ban: true, ...item }), this.store)
//del(data.id, this.store)
}
})
]