forked from Ivasoft/mattermost-mobile
Substitute all console.x by an appropiate log util function (#6427)
* Substitute all console.x by an appropiate log util function * Address feedback
This commit is contained in:
committed by
GitHub
parent
fe3f0cc892
commit
d2e2cf3ec1
@@ -6,6 +6,7 @@ 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 {logWarning} from '@utils/log';
|
||||
|
||||
import type {HandleInfoArgs, HandleGlobalArgs} from '@typings/database/database';
|
||||
|
||||
@@ -14,8 +15,7 @@ const {APP: {INFO, GLOBAL}} = MM_TABLES;
|
||||
export default class AppDataOperator extends BaseDataOperator {
|
||||
handleInfo = async ({info, prepareRecordsOnly = true}: HandleInfoArgs) => {
|
||||
if (!info?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "info" array has been passed to the handleInfo',
|
||||
);
|
||||
return [];
|
||||
@@ -33,8 +33,7 @@ export default class AppDataOperator extends BaseDataOperator {
|
||||
|
||||
handleGlobal = async ({globals, prepareRecordsOnly = true}: HandleGlobalArgs) => {
|
||||
if (!globals?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "globals" array has been passed to the handleGlobal',
|
||||
);
|
||||
return [];
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
retrieveRecords,
|
||||
} from '@database/operator/utils/general';
|
||||
import {OperationType} from '@typings/database/enums';
|
||||
import {logWarning} from '@utils/log';
|
||||
|
||||
import type {WriterInterface} from '@nozbe/watermelondb/Database';
|
||||
import type Model from '@nozbe/watermelondb/Model';
|
||||
@@ -130,8 +131,7 @@ export default class BaseDataOperator {
|
||||
*/
|
||||
prepareRecords = async ({tableName, createRaws, deleteRaws, updateRaws, transformer}: OperationArgs): Promise<Model[]> => {
|
||||
if (!this.database) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn('Database not defined in prepareRecords');
|
||||
logWarning('Database not defined in prepareRecords');
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -195,8 +195,7 @@ export default class BaseDataOperator {
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn('batchRecords error ', e as Error);
|
||||
logWarning('batchRecords error ', e as Error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,8 +212,7 @@ export default class BaseDataOperator {
|
||||
*/
|
||||
async handleRecords({buildKeyRecordBy, fieldName, transformer, createOrUpdateRawValues, deleteRawValues = [], tableName, prepareRecordsOnly = true}: HandleRecordsArgs): Promise<Model[]> {
|
||||
if (!createOrUpdateRawValues.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
`An empty "rawValues" array has been passed to the handleRecords method for tableName ${tableName}`,
|
||||
);
|
||||
return [];
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
transformCategoryRecord,
|
||||
} from '@database/operator/server_data_operator/transformers/category';
|
||||
import {getUniqueRawsBy} from '@database/operator/utils/general';
|
||||
import {logWarning} from '@utils/log';
|
||||
|
||||
import type {
|
||||
HandleCategoryChannelArgs,
|
||||
@@ -38,8 +39,7 @@ const CategoryHandler = (superclass: any) => class extends superclass {
|
||||
*/
|
||||
handleCategories = async ({categories, prepareRecordsOnly = true}: HandleCategoryArgs): Promise<CategoryModel[]> => {
|
||||
if (!categories?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "categories" array has been passed to the handleCategories method',
|
||||
);
|
||||
return [];
|
||||
@@ -92,8 +92,7 @@ const CategoryHandler = (superclass: any) => class extends superclass {
|
||||
*/
|
||||
handleCategoryChannels = async ({categoryChannels, prepareRecordsOnly = true}: HandleCategoryChannelArgs): Promise<CategoryModel[]> => {
|
||||
if (!categoryChannels?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "categoryChannels" array has been passed to the handleCategories method',
|
||||
);
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
} from '@database/operator/server_data_operator/transformers/channel';
|
||||
import {getUniqueRawsBy} from '@database/operator/utils/general';
|
||||
import {getIsCRTEnabled} from '@queries/servers/thread';
|
||||
import {logWarning} from '@utils/log';
|
||||
|
||||
import type {HandleChannelArgs, HandleChannelInfoArgs, HandleChannelMembershipArgs, HandleMyChannelArgs, HandleMyChannelSettingsArgs} from '@typings/database/database';
|
||||
import type ChannelModel from '@typings/database/models/servers/channel';
|
||||
@@ -52,8 +53,7 @@ const ChannelHandler = (superclass: any) => class extends superclass {
|
||||
*/
|
||||
handleChannel = async ({channels, prepareRecordsOnly = true}: HandleChannelArgs): Promise<ChannelModel[]> => {
|
||||
if (!channels?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "channels" array has been passed to the handleChannel method',
|
||||
);
|
||||
return [];
|
||||
@@ -103,8 +103,7 @@ const ChannelHandler = (superclass: any) => class extends superclass {
|
||||
*/
|
||||
handleMyChannelSettings = async ({settings, prepareRecordsOnly = true}: HandleMyChannelSettingsArgs): Promise<MyChannelSettingsModel[]> => {
|
||||
if (!settings?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "settings" array has been passed to the handleMyChannelSettings method',
|
||||
);
|
||||
|
||||
@@ -162,8 +161,7 @@ const ChannelHandler = (superclass: any) => class extends superclass {
|
||||
*/
|
||||
handleChannelInfo = async ({channelInfos, prepareRecordsOnly = true}: HandleChannelInfoArgs): Promise<ChannelInfoModel[]> => {
|
||||
if (!channelInfos?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty "channelInfos" array has been passed to the handleMyChannelSettings method',
|
||||
);
|
||||
|
||||
@@ -223,8 +221,7 @@ const ChannelHandler = (superclass: any) => class extends superclass {
|
||||
*/
|
||||
handleMyChannel = async ({channels, myChannels, isCRTEnabled, prepareRecordsOnly = true}: HandleMyChannelArgs): Promise<MyChannelModel[]> => {
|
||||
if (!myChannels?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "myChannels" array has been passed to the handleMyChannel method',
|
||||
);
|
||||
|
||||
@@ -232,8 +229,7 @@ const ChannelHandler = (superclass: any) => class extends superclass {
|
||||
}
|
||||
|
||||
if (!channels?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "channels" array has been passed to the handleMyChannel method',
|
||||
);
|
||||
|
||||
@@ -313,8 +309,7 @@ const ChannelHandler = (superclass: any) => class extends superclass {
|
||||
*/
|
||||
handleChannelMembership = async ({channelMemberships, prepareRecordsOnly = true}: HandleChannelMembershipArgs): Promise<ChannelMembershipModel[]> => {
|
||||
if (!channelMemberships?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty "channelMemberships" array has been passed to the handleChannelMembership method',
|
||||
);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import {MM_TABLES} from '@constants/database';
|
||||
import {transformGroupRecord} from '@database/operator/server_data_operator/transformers/group';
|
||||
import {getUniqueRawsBy} from '@database/operator/utils/general';
|
||||
import {logWarning} from '@utils/log';
|
||||
|
||||
import type {HandleGroupArgs} from '@typings/database/database';
|
||||
import type GroupModel from '@typings/database/models/servers/group';
|
||||
@@ -24,8 +25,7 @@ const GroupHandler = (superclass: any) => class extends superclass implements Gr
|
||||
*/
|
||||
handleGroups = async ({groups, prepareRecordsOnly = true}: HandleGroupArgs): Promise<GroupModel[]> => {
|
||||
if (!groups?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "groups" array has been passed to the handleGroups method',
|
||||
);
|
||||
return [];
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
transformSystemRecord,
|
||||
} from '@database/operator/server_data_operator/transformers/general';
|
||||
import {getUniqueRawsBy} from '@database/operator/utils/general';
|
||||
import {logWarning} from '@utils/log';
|
||||
|
||||
import type {Model} from '@nozbe/watermelondb';
|
||||
import type {HandleCustomEmojiArgs, HandleRoleArgs, HandleSystemArgs, OperationArgs} from '@typings/database/database';
|
||||
@@ -21,8 +22,7 @@ const {SERVER: {CUSTOM_EMOJI, ROLE, SYSTEM}} = MM_TABLES;
|
||||
export default class ServerDataOperatorBase extends BaseDataOperator {
|
||||
handleRole = async ({roles, prepareRecordsOnly = true}: HandleRoleArgs) => {
|
||||
if (!roles?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "roles" array has been passed to the handleRole',
|
||||
);
|
||||
return [];
|
||||
@@ -39,8 +39,7 @@ export default class ServerDataOperatorBase extends BaseDataOperator {
|
||||
|
||||
handleCustomEmojis = async ({emojis, prepareRecordsOnly = true}: HandleCustomEmojiArgs) => {
|
||||
if (!emojis?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "emojis" array has been passed to the handleCustomEmojis',
|
||||
);
|
||||
return [];
|
||||
@@ -57,8 +56,7 @@ export default class ServerDataOperatorBase extends BaseDataOperator {
|
||||
|
||||
handleSystem = async ({systems, prepareRecordsOnly = true}: HandleSystemArgs) => {
|
||||
if (!systems?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "systems" array has been passed to the handleSystem',
|
||||
);
|
||||
return [];
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
} from '@database/operator/server_data_operator/transformers/post';
|
||||
import {getUniqueRawsBy} from '@database/operator/utils/general';
|
||||
import {createPostsChain} from '@database/operator/utils/post';
|
||||
import {logWarning} from '@utils/log';
|
||||
|
||||
import type Database from '@nozbe/watermelondb/Database';
|
||||
import type Model from '@nozbe/watermelondb/Model';
|
||||
@@ -49,8 +50,7 @@ const PostHandler = (superclass: any) => class extends superclass {
|
||||
*/
|
||||
handleDraft = async ({drafts, prepareRecordsOnly = true}: HandleDraftArgs): Promise<DraftModel[]> => {
|
||||
if (!drafts?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "drafts" array has been passed to the handleDraft method',
|
||||
);
|
||||
return [];
|
||||
@@ -83,8 +83,7 @@ const PostHandler = (superclass: any) => class extends superclass {
|
||||
|
||||
// We rely on the posts array; if it is empty, we stop processing
|
||||
if (!posts?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "posts" array has been passed to the handlePosts method',
|
||||
);
|
||||
return [];
|
||||
@@ -235,8 +234,7 @@ const PostHandler = (superclass: any) => class extends superclass {
|
||||
*/
|
||||
handleFiles = async ({files, prepareRecordsOnly}: HandleFilesArgs): Promise<FileModel[]> => {
|
||||
if (!files?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "files" array has been passed to the handleFiles method',
|
||||
);
|
||||
return [];
|
||||
@@ -273,8 +271,7 @@ const PostHandler = (superclass: any) => class extends superclass {
|
||||
*/
|
||||
handlePostsInThread = async (postsMap: Record<string, Post[]>, actionType: never, prepareRecordsOnly = false): Promise<PostsInThreadModel[]> => {
|
||||
if (!postsMap || !Object.keys(postsMap).length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "postsMap" object has been passed to the handlePostsInThread method',
|
||||
);
|
||||
return [];
|
||||
@@ -304,8 +301,7 @@ const PostHandler = (superclass: any) => class extends superclass {
|
||||
const permittedActions = Object.values(ActionType.POSTS);
|
||||
|
||||
if (!posts.length || !permittedActions.includes(actionType)) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "posts" array or an non-supported actionType has been passed to the handlePostsInChannel method',
|
||||
);
|
||||
return [];
|
||||
|
||||
@@ -6,6 +6,7 @@ import {Q} from '@nozbe/watermelondb';
|
||||
import {Database} from '@constants';
|
||||
import {getPostListEdges} from '@database//operator/utils/post';
|
||||
import {transformPostsInChannelRecord} from '@database/operator/server_data_operator/transformers/post';
|
||||
import {logWarning} from '@utils/log';
|
||||
|
||||
import type PostsInChannelModel from '@typings/database/models/servers/posts_in_channel';
|
||||
|
||||
@@ -58,8 +59,7 @@ const PostsInChannelHandler = (superclass: any) => class extends superclass {
|
||||
|
||||
handleReceivedPostsInChannel = async (posts?: Post[], prepareRecordsOnly = false): Promise<PostsInChannelModel[]> => {
|
||||
if (!posts?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "posts" array has been passed to the handleReceivedPostsInChannel method',
|
||||
);
|
||||
return [];
|
||||
@@ -125,8 +125,7 @@ const PostsInChannelHandler = (superclass: any) => class extends superclass {
|
||||
|
||||
handleReceivedPostsInChannelSince = async (posts: Post[], prepareRecordsOnly = false): Promise<PostsInChannelModel[]> => {
|
||||
if (!posts?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "posts" array has been passed to the handleReceivedPostsInChannelSince method',
|
||||
);
|
||||
return [];
|
||||
@@ -176,8 +175,7 @@ const PostsInChannelHandler = (superclass: any) => class extends superclass {
|
||||
|
||||
handleReceivedPostsInChannelBefore = async (posts: Post[], prepareRecordsOnly = false): Promise<PostsInChannelModel[]> => {
|
||||
if (!posts?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "posts" array has been passed to the handleReceivedPostsInChannelBefore method',
|
||||
);
|
||||
return [];
|
||||
@@ -230,8 +228,7 @@ const PostsInChannelHandler = (superclass: any) => class extends superclass {
|
||||
|
||||
handleReceivedPostForChannel = async (posts: Post[], prepareRecordsOnly = false): Promise<PostsInChannelModel[]> => {
|
||||
if (!posts?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "posts" array has been passed to the handleReceivedPostForChannel method',
|
||||
);
|
||||
return [];
|
||||
|
||||
@@ -7,6 +7,7 @@ import {Database} from '@constants';
|
||||
import {getPostListEdges} from '@database//operator/utils/post';
|
||||
import {transformPostInThreadRecord} from '@database/operator/server_data_operator/transformers/post';
|
||||
import {getRawRecordPairs, getValidRecordsForUpdate} from '@database/operator/utils/general';
|
||||
import {logWarning} from '@utils/log';
|
||||
|
||||
import type {RecordPair} from '@typings/database/database';
|
||||
import type PostsInThreadModel from '@typings/database/models/servers/posts_in_thread';
|
||||
@@ -20,8 +21,7 @@ const {POSTS_IN_THREAD} = Database.MM_TABLES.SERVER;
|
||||
const PostsInThreadHandler = (superclass: any) => class extends superclass {
|
||||
handleReceivedPostsInThread = async (postsMap: Record<string, Post[]>, prepareRecordsOnly = false): Promise<PostsInThreadModel[]> => {
|
||||
if (!postsMap || !Object.keys(postsMap).length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "postsMap" object has been passed to the handleReceivedPostsInThread method',
|
||||
);
|
||||
return [];
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import {MM_TABLES} from '@constants/database';
|
||||
import {transformReactionRecord} from '@database/operator/server_data_operator/transformers/reaction';
|
||||
import {sanitizeReactions} from '@database/operator/utils/reaction';
|
||||
import {logWarning} from '@utils/log';
|
||||
|
||||
import type {HandleReactionsArgs} from '@typings/database/database';
|
||||
import type CustomEmojiModel from '@typings/database/models/servers/custom_emoji';
|
||||
@@ -29,8 +30,7 @@ const ReactionHandler = (superclass: any) => class extends superclass {
|
||||
const batchRecords: ReactionModel[] = [];
|
||||
|
||||
if (!postsReactions?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "postsReactions" array has been passed to the handleReactions method',
|
||||
);
|
||||
return [];
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
transformTeamSearchHistoryRecord,
|
||||
} from '@database/operator/server_data_operator/transformers/team';
|
||||
import {getUniqueRawsBy} from '@database/operator/utils/general';
|
||||
import {logWarning} from '@utils/log';
|
||||
|
||||
import type {
|
||||
HandleMyTeamArgs, HandleTeamArgs,
|
||||
@@ -54,8 +55,7 @@ const TeamHandler = (superclass: any) => class extends superclass {
|
||||
*/
|
||||
handleTeamMemberships = async ({teamMemberships, prepareRecordsOnly = true}: HandleTeamMembershipArgs): Promise<TeamMembershipModel[]> => {
|
||||
if (!teamMemberships?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "teamMemberships" array has been passed to the handleTeamMemberships method',
|
||||
);
|
||||
return [];
|
||||
@@ -111,8 +111,7 @@ const TeamHandler = (superclass: any) => class extends superclass {
|
||||
*/
|
||||
handleTeam = async ({teams, prepareRecordsOnly = true}: HandleTeamArgs): Promise<TeamModel[]> => {
|
||||
if (!teams?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "teams" array has been passed to the handleTeam method',
|
||||
);
|
||||
return [];
|
||||
@@ -162,8 +161,7 @@ const TeamHandler = (superclass: any) => class extends superclass {
|
||||
*/
|
||||
handleTeamChannelHistory = async ({teamChannelHistories, prepareRecordsOnly = true}: HandleTeamChannelHistoryArgs): Promise<TeamChannelHistoryModel[]> => {
|
||||
if (!teamChannelHistories?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "teamChannelHistories" array has been passed to the handleTeamChannelHistory method',
|
||||
);
|
||||
return [];
|
||||
@@ -190,8 +188,7 @@ const TeamHandler = (superclass: any) => class extends superclass {
|
||||
*/
|
||||
handleTeamSearchHistory = async ({teamSearchHistories, prepareRecordsOnly = true}: HandleTeamSearchHistoryArgs): Promise<TeamSearchHistoryModel[]> => {
|
||||
if (!teamSearchHistories?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "teamSearchHistories" array has been passed to the handleTeamSearchHistory method',
|
||||
);
|
||||
return [];
|
||||
@@ -219,8 +216,7 @@ const TeamHandler = (superclass: any) => class extends superclass {
|
||||
*/
|
||||
handleMyTeam = async ({myTeams, prepareRecordsOnly = true}: HandleMyTeamArgs): Promise<MyTeamModel[]> => {
|
||||
if (!myTeams?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "myTeams" array has been passed to the handleMyTeam method',
|
||||
);
|
||||
return [];
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
} from '@database/operator/server_data_operator/transformers/thread';
|
||||
import {getUniqueRawsBy} from '@database/operator/utils/general';
|
||||
import {sanitizeThreadParticipants} from '@database/operator/utils/thread';
|
||||
import {logWarning} from '@utils/log';
|
||||
|
||||
import type Database from '@nozbe/watermelondb/Database';
|
||||
import type {HandleThreadsArgs, HandleThreadParticipantsArgs} from '@typings/database/database';
|
||||
@@ -38,8 +39,7 @@ const ThreadHandler = (superclass: any) => class extends superclass {
|
||||
*/
|
||||
handleThreads = async ({threads, teamId, loadedInGlobalThreads, prepareRecordsOnly = false}: HandleThreadsArgs): Promise<Model[]> => {
|
||||
if (!threads?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "threads" array has been passed to the handleThreads method',
|
||||
);
|
||||
return [];
|
||||
|
||||
@@ -6,6 +6,7 @@ import {Q, Database} from '@nozbe/watermelondb';
|
||||
import {MM_TABLES} from '@constants/database';
|
||||
import {transformThreadInTeamRecord} from '@database/operator/server_data_operator/transformers/thread';
|
||||
import {getRawRecordPairs, getValidRecordsForUpdate} from '@database/operator/utils/general';
|
||||
import {logWarning} from '@utils/log';
|
||||
|
||||
import type {HandleThreadInTeamArgs, RecordPair} from '@typings/database/database';
|
||||
import type ThreadInTeamModel from '@typings/database/models/servers/thread_in_team';
|
||||
@@ -19,8 +20,7 @@ const {THREADS_IN_TEAM} = MM_TABLES.SERVER;
|
||||
const ThreadInTeamHandler = (superclass: any) => class extends superclass {
|
||||
handleThreadInTeam = async ({threadsMap, loadedInGlobalThreads, prepareRecordsOnly = false}: HandleThreadInTeamArgs): Promise<ThreadInTeamModel[]> => {
|
||||
if (!threadsMap || !Object.keys(threadsMap).length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "threadsMap" object has been passed to the handleReceivedPostForChannel method',
|
||||
);
|
||||
return [];
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
transformUserRecord,
|
||||
} from '@database/operator/server_data_operator/transformers/user';
|
||||
import {getUniqueRawsBy} from '@database/operator/utils/general';
|
||||
import {logWarning} from '@utils/log';
|
||||
|
||||
import type {
|
||||
HandlePreferencesArgs,
|
||||
@@ -34,8 +35,7 @@ const UserHandler = (superclass: any) => class extends superclass {
|
||||
*/
|
||||
handlePreferences = async ({preferences, prepareRecordsOnly = true, sync = false}: HandlePreferencesArgs): Promise<PreferenceModel[]> => {
|
||||
if (!preferences?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "preferences" array has been passed to the handlePreferences method',
|
||||
);
|
||||
return [];
|
||||
@@ -106,8 +106,7 @@ const UserHandler = (superclass: any) => class extends superclass {
|
||||
*/
|
||||
handleUsers = async ({users, prepareRecordsOnly = true}: HandleUsersArgs): Promise<UserModel[]> => {
|
||||
if (!users?.length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
logWarning(
|
||||
'An empty or undefined "users" array has been passed to the handleUsers method',
|
||||
);
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user