Move config to its own database table (#6744)

* Move config to its own database table

* Address feedback

* Fix test

* Revert minimum version related changes
This commit is contained in:
Daniel Espino García
2022-11-11 18:20:42 +01:00
committed by GitHub
parent 887565423c
commit 1aa4188f8e
85 changed files with 562 additions and 403 deletions

View File

@@ -8,7 +8,7 @@ import {of as of$} from 'rxjs';
import {switchMap, distinctUntilChanged} from 'rxjs/operators';
import {observeChannel} from '@queries/servers/channel';
import {observeConfig} from '@queries/servers/system';
import {observeConfigBooleanValue, observeConfigIntValue} from '@queries/servers/system';
import PostInput from './post_input';
@@ -20,18 +20,9 @@ type OwnProps = {
}
const enhanced = withObservables(['channelId'], ({database, channelId}: WithDatabaseArgs & OwnProps) => {
const config = observeConfig(database);
const timeBetweenUserTypingUpdatesMilliseconds = config.pipe(
switchMap((cfg) => of$(parseInt(cfg?.TimeBetweenUserTypingUpdatesMilliseconds || '0', 10))),
);
const enableUserTypingMessage = config.pipe(
switchMap((cfg) => of$(cfg?.EnableUserTypingMessages === 'true')),
);
const maxNotificationsPerChannel = config.pipe(
switchMap((cfg) => of$(parseInt(cfg?.MaxNotificationsPerChannel || '0', 10))),
);
const timeBetweenUserTypingUpdatesMilliseconds = observeConfigIntValue(database, 'TimeBetweenUserTypingUpdatesMilliseconds');
const enableUserTypingMessage = observeConfigBooleanValue(database, 'EnableUserTypingMessages');
const maxNotificationsPerChannel = observeConfigIntValue(database, 'MaxNotificationsPerChannel');
const channel = observeChannel(database, channelId);