Skip to content

Commit

Permalink
[FIX] Discussion sort option even with discussions disabled (#17963)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo authored Jun 19, 2020
1 parent 341aa61 commit 9c8bcda
Showing 1 changed file with 3 additions and 1 deletion.
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

0 comments on commit 9c8bcda

Please sign in to comment.