* Fix search bar style * MM-42983 Align mention badge on channel list item * MM-42985 polish channel intro UI * MM-42984 update fonts on 'Show' bottom sheet * MM-42982 Increase tap area of back button on channel view * Set StatusBar style based on theme sidebarBg * Reconnect other WS after 20 seconds insted of 5 * Only fetch missing profiles for DM/GMs * Database prepare records optimization * Do not use fallbackUsername for storing GM/DM in the database * fix filter for fetching missing dm/gm * remove use of indexOf inside another loop * remove use of includes inside another loop * remove use of find inside another loop * Add missing translations * disable Flipper on iOS * Remove Flipper code from AppDelegate * feedback review * trim DM display name to make sure is not empty * fixing missing direct channels display name * UI/UX feedback * fix WS channel viewed and mark as unread * Remove duplicate emojis from reaction bar
48 lines
1.9 KiB
TypeScript
48 lines
1.9 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {MM_TABLES} from '@constants/database';
|
|
import DataOperatorException from '@database/exceptions/data_operator_exception';
|
|
import {buildAppInfoKey} from '@database/operator/app_data_operator/comparator';
|
|
import {transformInfoRecord, transformGlobalRecord} from '@database/operator/app_data_operator/transformers';
|
|
import BaseDataOperator from '@database/operator/base_data_operator';
|
|
import {getUniqueRawsBy} from '@database/operator/utils/general';
|
|
|
|
import type {HandleInfoArgs, HandleGlobalArgs} from '@typings/database/database';
|
|
|
|
const {APP: {INFO, GLOBAL}} = MM_TABLES;
|
|
|
|
export default class AppDataOperator extends BaseDataOperator {
|
|
handleInfo = ({info, prepareRecordsOnly = true}: HandleInfoArgs) => {
|
|
if (!info.length) {
|
|
throw new DataOperatorException(
|
|
'An empty "values" array has been passed to the handleInfo',
|
|
);
|
|
}
|
|
|
|
return this.handleRecords({
|
|
fieldName: 'version_number',
|
|
buildKeyRecordBy: buildAppInfoKey,
|
|
transformer: transformInfoRecord,
|
|
prepareRecordsOnly,
|
|
createOrUpdateRawValues: getUniqueRawsBy({raws: info, key: 'version_number'}),
|
|
tableName: INFO,
|
|
});
|
|
};
|
|
|
|
handleGlobal = async ({global, prepareRecordsOnly = true}: HandleGlobalArgs) => {
|
|
if (!global.length) {
|
|
throw new DataOperatorException(
|
|
'An empty "values" array has been passed to the handleGlobal',
|
|
);
|
|
}
|
|
|
|
return this.handleRecords({
|
|
fieldName: 'id',
|
|
transformer: transformGlobalRecord,
|
|
prepareRecordsOnly,
|
|
createOrUpdateRawValues: getUniqueRawsBy({raws: global, key: 'id'}),
|
|
tableName: GLOBAL,
|
|
});
|
|
};
|
|
}
|