Skip to content

Commit

Permalink
Only show subscribe buttons on actual forum threads
Browse files Browse the repository at this point in the history
Fixes #118
  • Loading branch information
bitWolfy committed Apr 2, 2020
1 parent 7bf35a8 commit 16e32e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/js/components/data/Page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,6 @@ export const PageDefintion = {
post: /^\/posts\/\d+\/?$/,
upload: /\/uploads\/new\/?/,
forum: /^\/forum_topics\/?.*/,
forumPost: /^\/forum_topics\/\d+.*/,
pool: /^\/pools\/.+/,
};
5 changes: 3 additions & 2 deletions src/js/modules/subscriptions/ForumSubscriptions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { UpdateData, UpdateDefinition, SubscriptionSettings, UpdateContent } from "./SubscriptionManager";
import { Api } from "../../components/api/Api";
import { Page } from "../../components/data/Page";
import { Page, PageDefintion } from "../../components/data/Page";
import { RE6Module, Settings } from "../../components/RE6Module";
import { Subscription } from "./Subscription";
import { ApiForumTopic } from "../../components/api/responses/ApiForum";
Expand Down Expand Up @@ -36,7 +36,8 @@ export class ForumSubscriptions extends RE6Module implements Subscription {
}

getButtonElements(): JQuery<HTMLElement> {
return $("div#c-forum-topics").first();
if (Page.matches(PageDefintion.forumPost)) return $("div#c-forum-topics").first();
else return $();
}

public createSubscribeButton(): JQuery<HTMLElement> {
Expand Down

0 comments on commit 16e32e4

Please sign in to comment.