This commit is contained in:
Shaz MJ 2022-03-23 08:43:59 +11:00
parent 368f6aa08d
commit 41d796e2f8
2 changed files with 6 additions and 4 deletions

View file

@ -89,7 +89,9 @@ const mapPrefName = (prefs: PreferenceModel[]) => of$(prefs.map((p) => p.name));
const mapChannelIds = (channels: ChannelModel[]) => of$(channels.map((c) => c.id));
const enhance = withObservables(['category'], ({category, locale, database, currentUserId}: {category: CategoryModel; locale: string; currentUserId: string} & WithDatabaseArgs) => {
type EnhanceProps = {category: CategoryModel; locale: string; currentUserId: string} & WithDatabaseArgs
const enhance = withObservables(['category'], ({category, locale, database, currentUserId}: EnhanceProps) => {
const observedCategory = category.observe();
const sortedIds = observedCategory.pipe(
switchMap((c) => getSortedIds(database, c, locale)),
@ -112,7 +114,7 @@ const enhance = withObservables(['category'], ({category, locale, database, curr
const hiddenGmIds = queryPreferencesByCategory(database, Preferences.CATEGORY_GROUP_CHANNEL_SHOW, undefined, 'false').
observe().pipe(switchMap(mapPrefName));
let limit = of$(0);
let limit = of$(Preferences.CHANNEL_SIDEBAR_LIMIT_DMS_DEFAULT);
if (category.type === 'direct_messages') {
limit = queryPreferencesByCategory(database, Preferences.CATEGORY_SIDEBAR_SETTINGS, Preferences.CHANNEL_SIDEBAR_LIMIT_DMS).
observe().pipe(
@ -122,7 +124,7 @@ const enhance = withObservables(['category'], ({category, locale, database, curr
return of$(parseInt(val[0].value, 10));
}
return of$(0);
return of$(Preferences.CHANNEL_SIDEBAR_LIMIT_DMS_DEFAULT);
},
),
);

View file

@ -11,7 +11,6 @@ const Preferences: Record<string, any> = {
CATEGORY_FAVORITE_CHANNEL: 'favorite_channel',
CATEGORY_AUTO_RESET_MANUAL_STATUS: 'auto_reset_manual_status',
CATEGORY_NOTIFICATIONS: 'notifications',
COMMENTS: 'comments',
COMMENTS_ANY: 'any',
COMMENTS_ROOT: 'root',
@ -37,6 +36,7 @@ const Preferences: Record<string, any> = {
CATEGORY_SIDEBAR_SETTINGS: 'sidebar_settings',
CHANNEL_SIDEBAR_ORGANIZATION: 'channel_sidebar_organization',
CHANNEL_SIDEBAR_LIMIT_DMS: 'limit_visible_dms_gms',
CHANNEL_SIDEBAR_LIMIT_DMS_DEFAULT: 20,
AUTOCLOSE_DMS_ENABLED: 'after_seven_days',
CATEGORY_ADVANCED_SETTINGS: 'advanced_settings',
ADVANCED_FILTER_JOIN_LEAVE: 'join_leave',