diff --git a/app/components/channel_list/categories/body/index.ts b/app/components/channel_list/categories/body/index.ts index 3ca076ef4..368a7f7f8 100644 --- a/app/components/channel_list/categories/body/index.ts +++ b/app/components/channel_list/categories/body/index.ts @@ -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); }, ), ); diff --git a/app/constants/preferences.ts b/app/constants/preferences.ts index c76a1d17b..ba419d49a 100644 --- a/app/constants/preferences.ts +++ b/app/constants/preferences.ts @@ -11,7 +11,6 @@ const Preferences: Record = { 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 = { 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',