Skip to content
This repository has been archived by the owner on Dec 26, 2024. It is now read-only.

Commit

Permalink
fix: concat msg user distinguish
Browse files Browse the repository at this point in the history
  • Loading branch information
festoney8 committed Oct 1, 2024
1 parent 0583d21 commit 57b1b4c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Telegram Theme",
"slug": "telegram_theme",
"description": "高仿 Telegram 风格的 QQNT 主题",
"version": "4.4.6",
"version": "4.4.7",
"icon": null,
"authors": [
{
Expand Down
16 changes: 8 additions & 8 deletions src/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ const concatMsg = () => {
let msgs = msgList.querySelectorAll('.ml-item')

const msgCnt = msgs.length
const nameArr = new Array(msgCnt)
const userArr = new Array(msgCnt)
const selfArr = new Array(msgCnt)
const grayArr = new Array(msgCnt)
const timeArr = new Array(msgCnt)
Expand All @@ -244,30 +244,30 @@ const concatMsg = () => {
const id = msg.id
if (!infoCache.has(id)) {
// 用户名、是否为自己消息、是否含时间戳、是否为灰色消息(撤回or管理操作)
let name, self, time
let user, self, time
const gray = !!msg.querySelector('.gray-tip-message')
if (gray) {
name = null
user = null
self = false
time = false
} else {
name = msg.querySelector('.user-name .text-ellipsis')?.innerHTML
user = msg.querySelector('.message')?.__VUE__?.[0]?.vnode?.props['msg-record']?.senderUin
self = !!msg.querySelector('.message-container--self')
time = !!msg.querySelector('.message__timestamp')
}
nameArr[index] = name
userArr[index] = user
selfArr[index] = self
grayArr[index] = gray
timeArr[index] = time
infoCache.set(id, {
name: name,
user: user,
self: self,
gray: gray,
time: time,
})
} else {
const info = infoCache.get(id)
nameArr[index] = info.name
userArr[index] = info.user
selfArr[index] = info.self
grayArr[index] = info.gray
timeArr[index] = info.time
Expand All @@ -288,7 +288,7 @@ const concatMsg = () => {
if (grayArr[i] && i > 0) {
sepArr[i - 1] = true
}
if (nameArr[i] !== nameArr[i + 1] || selfArr[i] !== selfArr[i + 1]) {
if (userArr[i] !== userArr[i + 1] || selfArr[i] !== selfArr[i + 1]) {
sepArr[i] = true
}
}
Expand Down

0 comments on commit 57b1b4c

Please sign in to comment.