|
1 | 1 | import app from 'flarum/forum/app'; |
2 | 2 | import { extend } from 'flarum/common/extend'; |
3 | 3 | import DiscussionListState from 'flarum/forum/states/DiscussionListState'; |
4 | | -import Separator from 'flarum/common/components/Separator'; |
5 | | -import ItemList from 'flarum/common/utils/ItemList'; |
6 | | -import type Mithril from 'mithril'; |
7 | | -import UserDirectoryPage from 'ext:fof/user-directory/forum/components/UserDirectoryPage'; |
8 | | -import CheckableButton from 'ext:fof/user-directory/forum/components/CheckableButton'; |
9 | 4 | import addFollowingPageOption from 'ext:fof/follow-tags/common/utils/addFollowingPageOption'; |
10 | 5 | import { getDefaultFollowingFiltering } from 'ext:fof/follow-tags/forum/utils/getDefaultFollowingFiltering'; |
11 | 6 |
|
@@ -37,49 +32,4 @@ export default function () { |
37 | 32 | } |
38 | 33 | } |
39 | 34 | ); |
40 | | - |
41 | | - if ('fof-user-directory' in flarum.extensions) { |
42 | | - // Initialize the filter state from URL parameters |
43 | | - extend(UserDirectoryPage.prototype, 'oninit', function (this: any) { |
44 | | - const q = m.route.param('q') || ''; |
45 | | - if (q.includes('is:followeduser')) { |
46 | | - if (!this.enabledSpecialGroupFilters) this.enabledSpecialGroupFilters = {}; |
47 | | - this.enabledSpecialGroupFilters['ianm-follow-users'] = 'is:followeduser'; |
48 | | - } |
49 | | - }); |
50 | | - |
51 | | - extend( |
52 | | - UserDirectoryPage.prototype, |
53 | | - 'groupItems', |
54 | | - function ( |
55 | | - this: typeof UserDirectoryPage.prototype & { enabledSpecialGroupFilters?: Record<string, string> }, |
56 | | - items: ItemList<Mithril.Children> |
57 | | - ) { |
58 | | - items.add( |
59 | | - 'follow-users', |
60 | | - <CheckableButton |
61 | | - className="GroupFilterButton" |
62 | | - icon="fas fa-user-friends" |
63 | | - checked={this.enabledSpecialGroupFilters?.['ianm-follow-users'] === 'is:followeduser'} |
64 | | - onclick={() => { |
65 | | - const id = 'ianm-follow-users'; |
66 | | - if (!this.enabledSpecialGroupFilters) this.enabledSpecialGroupFilters = {}; |
67 | | - if (this.enabledSpecialGroupFilters[id] === 'is:followeduser') { |
68 | | - this.enabledSpecialGroupFilters[id] = ''; |
69 | | - } else { |
70 | | - this.enabledSpecialGroupFilters[id] = 'is:followeduser'; |
71 | | - } |
72 | | - |
73 | | - this.changeParams(this.params().sort); |
74 | | - }} |
75 | | - > |
76 | | - {app.translator.trans('ianm-follow-users.forum.filter.following')} |
77 | | - </CheckableButton>, |
78 | | - 65 |
79 | | - ); |
80 | | - |
81 | | - items.add('separator', <Separator />, 50); |
82 | | - } |
83 | | - ); |
84 | | - } |
85 | 35 | } |
0 commit comments