Skip to content

Commit

Permalink
More reactions fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ri0n committed Jun 30, 2024
1 parent 57b9335 commit c0cd337
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/chatviewcommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,11 @@ ChatViewCommon::updateReactions(const QString &senderNickname, const QString &me
msgIt.value().total[v].append(senderNickname);
}
for (auto const &v : toRemove) {
msgIt.value().total[v].removeOne(senderNickname);
auto it = msgIt.value().total.find(v);
it->removeOne(senderNickname);
if (it->isEmpty()) {
msgIt.value().total.erase(it);
}
}
auto &total = msgIt.value().total;

Expand Down
19 changes: 14 additions & 5 deletions themes/chatview/psi/bubble/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@

function setupContextMenu() {
chatMenu.addItemProvider((event) => {
const isNick = event.target.className == "nick";
const isNick = event.target.classList.contains("nick");
let msgNode;
if (!isNick) {
msgNode = event.target;
Expand All @@ -126,10 +126,14 @@
let items;
if (isNick) {
items = [
{ text: "Info", action: ()=>{ shared.session.showInfo(nick); } },
{ text: "Open Chat", action: ()=>{ shared.session.openChat(nick); } },
{ text: "Kick", action: ()=>{ shared.session.kick(nick); } }
]
{ text: "Info", action: ()=>{ shared.session.showInfo(nick); } }
];
if (shared.isMuc) {
items = items.concat([
{ text: "Open Chat", action: ()=>{ shared.session.openChat(nick); } },
{ text: "Kick", action: ()=>{ shared.session.kick(nick); } }
])
}
} else {
items = [
{ text: "Delete", action: ()=>{ shared.session.deleteMessage(msgNode.id); } },
Expand All @@ -152,6 +156,11 @@
}
let reactions = msg.getElementsByClassName("reactions").item(0);
if (reactions) {
if (!event["reactions"].length) {
reactions.parentElement.removeChild(reactions.previousSibling);
reactions.parentElement.removeChild(reactions);
return;
}
reactions.innerHTML = "";
} else {
lineBreak = document.createElement("hr");
Expand Down
4 changes: 3 additions & 1 deletion themes/chatview/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,13 +377,15 @@ function initPsiTheme() {
"🀣",
"πŸ”₯",
"πŸ‘",
"πŸ€”",
"😱",
"😭",
"πŸ™",
"❀️",
"😘",
"πŸ₯°",
"😍",
"😊",
"😊"
]

const rs = document.createElement("div");
Expand Down

0 comments on commit c0cd337

Please sign in to comment.