Skip to content
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

[IMPROVE] Rewrite Prune Messages as React component #19900

Merged
merged 7 commits into from
Jan 12, 2021
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
6 changes: 4 additions & 2 deletions app/discussion/client/tabBar.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { useMemo, lazy, LazyExoticComponent, FC } from 'react';
import { useMemo, lazy } from 'react';

import { addAction } from '../../../client/views/room/lib/Toolbox';
import { useSetting } from '../../../client/contexts/SettingsContext';

const template = lazy(() => import('../../../client/views/room/contextualBar/Discussions'));

addAction('discussions', () => {
const discussionEnabled = useSetting('Discussion_enabled');

Expand All @@ -11,7 +13,7 @@ addAction('discussions', () => {
id: 'discussions',
title: 'Discussions',
icon: 'discussion',
template: lazy(() => import('../../../client/views/room/contextualBar/Discussions')) as LazyExoticComponent<FC>,
template,
full: true,
order: 1,
} : null), [discussionEnabled]);
Expand Down
6 changes: 4 additions & 2 deletions app/otr/client/tabBar.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { useMemo, lazy, LazyExoticComponent, FC, useEffect } from 'react';
import { useMemo, lazy, useEffect } from 'react';

import { OTR } from './rocketchat.otr';
import { useSetting } from '../../../client/contexts/SettingsContext';
import { addAction } from '../../../client/views/room/lib/Toolbox';

const template = lazy(() => import('../../../client/views/room/contextualBar/OTR'));

addAction('otr', () => {
const enabled = useSetting('OTR_Enable');

Expand All @@ -24,7 +26,7 @@ addAction('otr', () => {
id: 'otr',
title: 'OTR',
icon: 'key',
template: lazy(() => import('../../../client/views/room/contextualBar/OTR')) as LazyExoticComponent<FC>,
template,
order: 13,
full: true,
} : null), [shouldAddAction]);
Expand Down
3 changes: 0 additions & 3 deletions app/ui-clean-history/client/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
import './lib/startup';
import './views/cleanHistory.html';
import './views/cleanHistory';
import './views/stylesheets/cleanHistory.css';
8 changes: 5 additions & 3 deletions app/ui-clean-history/client/lib/startup.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@

import { useMemo } from 'react';
import { useMemo, lazy } from 'react';

import { addAction } from '../../../../client/views/room/lib/Toolbox';
import { usePermission } from '../../../../client/contexts/AuthorizationContext';

const template = lazy(() => import('../../../../client/views/room/contextualBar/PruneMessages'));

addAction('clean-history', ({ room }) => {
const hasPermission = usePermission('clean-channel-history', room._id);
return useMemo(() => (hasPermission ? {
groups: ['channel', 'group', 'direct'],
id: 'clean-history',
anonymous: true,
full: true,
title: 'Prune_Messages',
icon: 'eraser',
template: 'cleanHistory',
template,
order: 250,
} : null), [hasPermission]);
});
158 changes: 0 additions & 158 deletions app/ui-clean-history/client/views/cleanHistory.html

This file was deleted.

Loading