1
Fork 0

Fix topic votes not being hidden on topic pages.

This commit is contained in:
Bauke 2023-07-06 20:26:08 +02:00
parent 7e30c509e2
commit ecd91563d5
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
1 changed files with 8 additions and 2 deletions

View File

@ -100,9 +100,15 @@ function hideCommentVotes(data: HideVotesData, currentUser: string): number {
*/ */
function hideTopicVotes(data: HideVotesData, currentUser: string): number { function hideTopicVotes(data: HideVotesData, currentUser: string): number {
let count = 0; let count = 0;
for (const topic of querySelectorAll<HTMLElement>(".topic")) { for (const topic of querySelectorAll<HTMLElement>(".topic", ".topic-full")) {
const postedBySelf = topic.dataset.topicPostedBy === currentUser; let topicAuthor = topic.dataset.topicPostedBy;
if (topic.classList.contains("topic-full")) {
topicAuthor =
document.querySelector(".topic-full-byline .link-user")?.textContent ??
undefined;
}
const postedBySelf = topicAuthor === currentUser;
let vote: Element | undefined; let vote: Element | undefined;
// Select the vote number from the topic if we want to hide other's topics // Select the vote number from the topic if we want to hide other's topics