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

[FIX] Discussion sort option even with discussions disabled #17963

Merged
merged 1 commit into from
Jun 19, 2020
Merged
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
4 changes: 3 additions & 1 deletion client/components/SortList.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Icon, ToggleSwitch, RadioButton, Box, Flex, Margins } from '@rocket.cha
import { useTranslation } from '../contexts/TranslationContext';
import { useUserPreference } from '../contexts/UserContext';
import { useMethod } from '../contexts/ServerContext';
import { useSetting } from '../contexts/SettingsContext';

function SortListItem({ text, icon, input }) {
return <Flex.Container>
Expand Down Expand Up @@ -99,6 +100,7 @@ function ViewModeList() {


function GroupingList() {
const isDiscussionEnabled = useSetting('Discussion_enabled');
const sidebarShowDiscussion = useUserPreference('sidebarShowDiscussion');
const sidebarGroupByType = useUserPreference('sidebarGroupByType');
const sidebarShowFavorites = useUserPreference('sidebarShowFavorites');
Expand All @@ -121,7 +123,7 @@ function GroupingList() {
</Margins>
<ul className='rc-popover__list'>
<Margins block='x8'>
<SortListItem icon={'discussion'} text={t('Group_discussions')} input={<ToggleSwitch onChange={handleChangeShowDicussion} name='sidebarShowDiscussion' checked={sidebarShowDiscussion} />} />
{isDiscussionEnabled && <SortListItem icon={'discussion'} text={t('Group_discussions')} input={<ToggleSwitch onChange={handleChangeShowDicussion} name='sidebarShowDiscussion' checked={sidebarShowDiscussion} />} />}
<SortListItem icon={'sort-amount-down'} text={t('Group_by_Type')} input={<ToggleSwitch onChange={handleChangeGroupByType} name='sidebarGroupByType' checked={sidebarGroupByType} />} />
<SortListItem icon={'star'} text={t('Group_favorites')} input={<ToggleSwitch onChange={handleChangeShoFavorite} name='sidebarShowFavorites' checked={sidebarShowFavorites} />} />
<SortListItem icon={'eye-off'} text={t('Unread_on_top')} input={<ToggleSwitch onChange={handleChangeShowUnread} name='sidebarShowUnread' checked={sidebarShowUnread} />} />
Expand Down