-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: extend
UserListPage
with new Button
- Loading branch information
1 parent
645d207
commit 175e43e
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import app from 'flarum/admin/app'; | ||
import { extend } from 'flarum/common/extend'; | ||
import UserListPage from 'flarum/admin/components/UserListPage'; | ||
import LoginAsUserButton from '../common/components/LoginAsUserButton'; | ||
|
||
import type ItemList from 'flarum/common/utils/ItemList'; | ||
import type User from 'flarum/common/models/User'; | ||
|
||
import type Mithril from 'mithril'; | ||
export default function extendUserListPage() { | ||
extend(UserListPage.prototype, 'userActionItems', function (items: ItemList<Mithril.Children>, user: User) { | ||
const forumBaseUrl = app.forum.attribute('baseUrl'); | ||
|
||
items.add('impersonate', <LoginAsUserButton user={user} redirectTo={`${forumBaseUrl}/u/${user.slug()}`} />); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters