Skip to content

chore: minor admin frontend cleanup #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion js/src/admin/extendAdminNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function extendAdminNav() {
extend(AdminNav.prototype, 'items', function (items: ItemList<Mithril.Children>) {
items.add(
'gdpr',
<LinkButton href={app.route('gdpr')} icon="fas fa-user-shield" title={app.translator.trans('flarum-gdpr.admin.gdpr.title')}>
<LinkButton href={app.route('gdpr')} icon="fas fa-user-shield" title={app.translator.trans('flarum-gdpr.admin.nav.gdpr_title')}>
{app.translator.trans('flarum-gdpr.admin.nav.gdpr_button')}
</LinkButton>,
48
Expand Down
15 changes: 11 additions & 4 deletions js/src/admin/extendUserListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,23 @@ import app from 'flarum/admin/app';
import { extend } from 'flarum/common/extend';
import UserListPage from 'flarum/admin/components/UserListPage';
import Button from 'flarum/common/components/Button';
import username from 'flarum/common/helpers/username';
import RequestDataExportModal from '../common/components/RequestDataExportModal';

import type User from 'flarum/common/models/User';
import type ItemList from 'flarum/common/utils/ItemList';
import type Mithril from 'mithril';

export default function extendUserListPage() {
extend(UserListPage.prototype, 'userActionItems', function (items, user) {
extend(UserListPage.prototype, 'userActionItems', function (items: ItemList<Mithril.Children>, user: User) {
if (!user.canModerateExports()) return;
items.add(
'export-data',
<Button className="Button" icon="fas fa-file-export" onclick={() => app.modal.show(RequestDataExportModal, { user: user })}>
{app.translator.trans('flarum-gdpr.admin.userlist.columns.gdpr_actions.export', { username: username(user) })}
<Button
icon="fas fa-file-export"
title={app.translator.trans('flarum-gdpr.admin.userlist.columns.user_actions.data_export.tooltip', { username: user.displayName() }, true)}
onclick={() => app.modal.show(RequestDataExportModal, { user: user })}
>
{app.translator.trans('flarum-gdpr.admin.userlist.columns.user_actions.data_export.button')}
</Button>
);
});
Expand Down
8 changes: 6 additions & 2 deletions resources/locale/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ flarum-gdpr:
However, there are some special cases, which are listed below.
nav:
gdpr_button: GDPR Integrations
gdpr_title: => flarum-gdpr.admin.gdpr_page.description

permissions:
process_erasure: Process erasure requests
process_export_for_others: Request and receive data exports for other users
Expand All @@ -46,8 +48,10 @@ flarum-gdpr:
help_text: Before deciding on which actions to use on your forum, it is vital to understand which data is integrated, and how it is handled for both anonymization and deletion. Vist the GDPR overview to understand how data is handled, and which optional extensions have registered their data to be handled by this extension.
userlist:
columns:
gdpr_actions:
export: Export data for {username}
user_actions:
data_export:
button: Export
tooltip: Export data for {username}

lib:
data:
Expand Down