工作台图标
This commit is contained in:
+17
-4
@@ -73,7 +73,7 @@ function mapMsg(raw, meId, typeu) {
|
||||
href: String((raw && raw.href) || p.href || ''),
|
||||
duration: Number((raw && raw.duration) || p.duration) || 0,
|
||||
quote: p.quote || raw.quote || null,
|
||||
read: !!(raw && (raw.read === true || raw.readAt || raw.isRead)),
|
||||
read: !!(raw && (raw.read === true || raw.read === 1 || raw.read === '1' || raw.readAt || raw.isRead === true || raw.isRead === 1)),
|
||||
readReceipt: (raw && raw.readReceipt) || p.readReceipt || null
|
||||
}
|
||||
}
|
||||
@@ -394,8 +394,14 @@ export const store = {
|
||||
return
|
||||
}
|
||||
if (typeu === ImTypeu.read) {
|
||||
const sid = String(data.sessionId || pack.to || '')
|
||||
const conv = this.findConv(sid) || this.findConv(this.dmIdOf(pack.from))
|
||||
const from = String(pack.from || data.from || '')
|
||||
const me = this.me ? String(this.me.id) : ''
|
||||
if (!from || from === me) {
|
||||
this.emit()
|
||||
return
|
||||
}
|
||||
const sid = String(data.sessionId || '') || this.dmIdOf(from)
|
||||
const conv = this.findConv(sid)
|
||||
if (conv) {
|
||||
;(conv.messages || []).forEach((m) => {
|
||||
if (m.mine && !m.recalled) m.read = true
|
||||
@@ -472,7 +478,14 @@ export const store = {
|
||||
this.activeSid = conv.id
|
||||
try {
|
||||
const rows = await api.messages(conv.id, this.token)
|
||||
const incoming = asList(rows && rows.messages ? rows.messages : rows).map((m) => mapMsg(m, this.me && this.me.id, m.typeu))
|
||||
const prev = new Map((conv.messages || []).filter((m) => m.id).map((m) => [m.id, m]))
|
||||
const incoming = asList(rows && rows.messages ? rows.messages : rows).map((m) => {
|
||||
const msg = mapMsg(m, this.me && this.me.id, m.typeu)
|
||||
const old = prev.get(msg.id)
|
||||
if (old && old.read) msg.read = true
|
||||
if (old && old.readReceipt && !msg.readReceipt) msg.readReceipt = old.readReceipt
|
||||
return msg
|
||||
})
|
||||
const seen = new Set(incoming.map((m) => m.id).filter(Boolean))
|
||||
const extras = (conv.messages || []).filter((m) => m.mine && m.id && !seen.has(m.id) && Date.now() - Number(m.time) < 120000)
|
||||
conv.messages = incoming.concat(extras)
|
||||
|
||||
Reference in New Issue
Block a user