Fix topic votes not being hidden on topic pages.
This commit is contained in:
parent
7e30c509e2
commit
ecd91563d5
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue