forked from Ivasoft/mattermost-mobile
Gekidou Minor Fixes (#6461)
* removed useless throw in comment * fix ts for useNavButtonPressed * update server db 'relationship config file' adding missing relationship between ThreadsInTeam and Thread table. we will have to update the pngs and the others as well but we can do that once we get a license to the DB Schema app * Update post.ts
This commit is contained in:
@@ -34,7 +34,6 @@ const CategoryHandler = (superclass: any) => class extends superclass {
|
||||
* @param {HandleCategoryArgs} categoriesArgs
|
||||
* @param {Category[]} categoriesArgs.categories
|
||||
* @param {boolean} categoriesArgs.prepareRecordsOnly
|
||||
* @throws DataOperatorException
|
||||
* @returns {Promise<CategoryModel[]>}
|
||||
*/
|
||||
handleCategories = async ({categories, prepareRecordsOnly = true}: HandleCategoryArgs): Promise<CategoryModel[]> => {
|
||||
@@ -51,7 +50,7 @@ const CategoryHandler = (superclass: any) => class extends superclass {
|
||||
const exists = await db.get<CategoryModel>(CATEGORY).query(
|
||||
Q.where('id', Q.oneOf(ids)),
|
||||
).fetch();
|
||||
const categoryMap = new Map<String, CategoryModel>(exists.map((c) => [c.id, c]));
|
||||
const categoryMap = new Map<string, CategoryModel>(exists.map((c) => [c.id, c]));
|
||||
const createOrUpdateRawValues = uniqueRaws.reduce((res: Category[], c) => {
|
||||
const e = categoryMap.get(c.id);
|
||||
if (!e) {
|
||||
@@ -85,9 +84,8 @@ const CategoryHandler = (superclass: any) => class extends superclass {
|
||||
/**
|
||||
* handleCategoryChannels: Handler responsible for the Create/Update operations occurring on the CategoryChannel table from the 'Server' schema
|
||||
* @param {HandleCategoryChannelArgs} categoriesArgs
|
||||
* @param {CategoryChannel[]} categoriesArgs.categorychannels
|
||||
* @param {CategoryChannel[]} categoriesArgs.categoryChannels
|
||||
* @param {boolean} categoriesArgs.prepareRecordsOnly
|
||||
* @throws DataOperatorException
|
||||
* @returns {Promise<CategoryChannelModel[]>}
|
||||
*/
|
||||
handleCategoryChannels = async ({categoryChannels, prepareRecordsOnly = true}: HandleCategoryChannelArgs): Promise<CategoryModel[]> => {
|
||||
|
||||
@@ -48,7 +48,6 @@ const ChannelHandler = (superclass: any) => class extends superclass {
|
||||
* @param {HandleChannelArgs} channelsArgs
|
||||
* @param {RawChannel[]} channelsArgs.channels
|
||||
* @param {boolean} channelsArgs.prepareRecordsOnly
|
||||
* @throws DataOperatorException
|
||||
* @returns {Promise<ChannelModel[]>}
|
||||
*/
|
||||
handleChannel = async ({channels, prepareRecordsOnly = true}: HandleChannelArgs): Promise<ChannelModel[]> => {
|
||||
@@ -98,7 +97,6 @@ const ChannelHandler = (superclass: any) => class extends superclass {
|
||||
* @param {HandleMyChannelSettingsArgs} settingsArgs
|
||||
* @param {RawMyChannelSettings[]} settingsArgs.settings
|
||||
* @param {boolean} settingsArgs.prepareRecordsOnly
|
||||
* @throws DataOperatorException
|
||||
* @returns {Promise<MyChannelSettingsModel[]>}
|
||||
*/
|
||||
handleMyChannelSettings = async ({settings, prepareRecordsOnly = true}: HandleMyChannelSettingsArgs): Promise<MyChannelSettingsModel[]> => {
|
||||
@@ -156,7 +154,6 @@ const ChannelHandler = (superclass: any) => class extends superclass {
|
||||
* @param {HandleChannelInfoArgs} channelInfosArgs
|
||||
* @param {RawChannelInfo[]} channelInfosArgs.channelInfos
|
||||
* @param {boolean} channelInfosArgs.prepareRecordsOnly
|
||||
* @throws DataOperatorException
|
||||
* @returns {Promise<ChannelInfoModel[]>}
|
||||
*/
|
||||
handleChannelInfo = async ({channelInfos, prepareRecordsOnly = true}: HandleChannelInfoArgs): Promise<ChannelInfoModel[]> => {
|
||||
@@ -216,7 +213,6 @@ const ChannelHandler = (superclass: any) => class extends superclass {
|
||||
* @param {HandleMyChannelArgs} myChannelsArgs
|
||||
* @param {RawMyChannel[]} myChannelsArgs.myChannels
|
||||
* @param {boolean} myChannelsArgs.prepareRecordsOnly
|
||||
* @throws DataOperatorException
|
||||
* @returns {Promise<MyChannelModel[]>}
|
||||
*/
|
||||
handleMyChannel = async ({channels, myChannels, isCRTEnabled, prepareRecordsOnly = true}: HandleMyChannelArgs): Promise<MyChannelModel[]> => {
|
||||
@@ -304,7 +300,6 @@ const ChannelHandler = (superclass: any) => class extends superclass {
|
||||
* @param {HandleChannelMembershipArgs} channelMembershipsArgs
|
||||
* @param {ChannelMembership[]} channelMembershipsArgs.channelMemberships
|
||||
* @param {boolean} channelMembershipsArgs.prepareRecordsOnly
|
||||
* @throws DataOperatorException
|
||||
* @returns {Promise<ChannelMembershipModel[]>}
|
||||
*/
|
||||
handleChannelMembership = async ({channelMemberships, prepareRecordsOnly = true}: HandleChannelMembershipArgs): Promise<ChannelMembershipModel[]> => {
|
||||
|
||||
@@ -25,7 +25,6 @@ const GroupHandler = (superclass: any) => class extends superclass implements Gr
|
||||
* @param {HandleGroupArgs} groupsArgs
|
||||
* @param {Group[]} groupsArgs.groups
|
||||
* @param {boolean} groupsArgs.prepareRecordsOnly
|
||||
* @throws DataOperatorException
|
||||
* @returns {Promise<GroupModel[]>}
|
||||
*/
|
||||
handleGroups = async ({groups, prepareRecordsOnly = true}: HandleGroupArgs): Promise<GroupModel[]> => {
|
||||
|
||||
@@ -31,6 +31,8 @@ const {
|
||||
POST,
|
||||
} = MM_TABLES.SERVER;
|
||||
|
||||
type PostActionType = keyof typeof ActionType.POSTS;
|
||||
|
||||
export interface PostHandlerMix {
|
||||
handleDraft: ({drafts, prepareRecordsOnly}: HandleDraftArgs) => Promise<DraftModel[]>;
|
||||
handleFiles: ({files, prepareRecordsOnly}: HandleFilesArgs) => Promise<FileModel[]>;
|
||||
@@ -45,7 +47,6 @@ const PostHandler = (superclass: any) => class extends superclass {
|
||||
* @param {HandleDraftArgs} draftsArgs
|
||||
* @param {RawDraft[]} draftsArgs.drafts
|
||||
* @param {boolean} draftsArgs.prepareRecordsOnly
|
||||
* @throws DataOperatorException
|
||||
* @returns {Promise<DraftModel[]>}
|
||||
*/
|
||||
handleDraft = async ({drafts, prepareRecordsOnly = true}: HandleDraftArgs): Promise<DraftModel[]> => {
|
||||
@@ -266,10 +267,12 @@ const PostHandler = (superclass: any) => class extends superclass {
|
||||
|
||||
/**
|
||||
* handlePostsInThread: Handler responsible for the Create/Update operations occurring on the PostsInThread table from the 'Server' schema
|
||||
* @param {PostsInThread[]} rootPosts
|
||||
* @param {Record<string, Post[]>} postsMap
|
||||
* @param {PostActionType} actionType
|
||||
* @param {boolean} prepareRecordsOnly
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
handlePostsInThread = async (postsMap: Record<string, Post[]>, actionType: never, prepareRecordsOnly = false): Promise<PostsInThreadModel[]> => {
|
||||
handlePostsInThread = async (postsMap: Record<string, Post[]>, actionType: PostActionType, prepareRecordsOnly = false): Promise<PostsInThreadModel[]> => {
|
||||
if (!postsMap || !Object.keys(postsMap).length) {
|
||||
logWarning(
|
||||
'An empty or undefined "postsMap" object has been passed to the handlePostsInThread method',
|
||||
@@ -292,9 +295,11 @@ const PostHandler = (superclass: any) => class extends superclass {
|
||||
/**
|
||||
* handlePostsInChannel: Handler responsible for the Create/Update operations occurring on the PostsInChannel table from the 'Server' schema
|
||||
* @param {Post[]} posts
|
||||
* @param {PostActionType} actionType
|
||||
* @param {boolean} prepareRecordsOnly
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
handlePostsInChannel = async (posts: Post[], actionType: never, prepareRecordsOnly = false): Promise<PostsInChannelModel[]> => {
|
||||
handlePostsInChannel = async (posts: Post[], actionType: PostActionType, prepareRecordsOnly = false): Promise<PostsInChannelModel[]> => {
|
||||
// At this point, the parameter 'posts' is already a chain of posts. Now, we have to figure out how to plug it
|
||||
// into existing chains in the PostsInChannel table
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ const ReactionHandler = (superclass: any) => class extends superclass {
|
||||
* @param {ReactionsPerPost[]} handleReactions.postsReactions
|
||||
* @param {boolean} handleReactions.prepareRecordsOnly
|
||||
* @param {boolean} handleReactions.skipSync
|
||||
* @throws DataOperatorException
|
||||
* @returns {Promise<Array<(ReactionModel | CustomEmojiModel)>>}
|
||||
*/
|
||||
handleReactions = async ({postsReactions, prepareRecordsOnly, skipSync}: HandleReactionsArgs): Promise<ReactionModel[]> => {
|
||||
|
||||
@@ -50,7 +50,6 @@ const TeamHandler = (superclass: any) => class extends superclass {
|
||||
* @param {HandleTeamMembershipArgs} teamMembershipsArgs
|
||||
* @param {TeamMembership[]} teamMembershipsArgs.teamMemberships
|
||||
* @param {boolean} teamMembershipsArgs.prepareRecordsOnly
|
||||
* @throws DataOperatorException
|
||||
* @returns {Promise<TeamMembershipModel[]>}
|
||||
*/
|
||||
handleTeamMemberships = async ({teamMemberships, prepareRecordsOnly = true}: HandleTeamMembershipArgs): Promise<TeamMembershipModel[]> => {
|
||||
@@ -106,7 +105,6 @@ const TeamHandler = (superclass: any) => class extends superclass {
|
||||
* @param {HandleTeamArgs} teamsArgs
|
||||
* @param {Team[]} teamsArgs.teams
|
||||
* @param {boolean} teamsArgs.prepareRecordsOnly
|
||||
* @throws DataOperatorException
|
||||
* @returns {Promise<TeamModel[]>}
|
||||
*/
|
||||
handleTeam = async ({teams, prepareRecordsOnly = true}: HandleTeamArgs): Promise<TeamModel[]> => {
|
||||
@@ -156,7 +154,6 @@ const TeamHandler = (superclass: any) => class extends superclass {
|
||||
* @param {HandleTeamChannelHistoryArgs} teamChannelHistoriesArgs
|
||||
* @param {TeamChannelHistory[]} teamChannelHistoriesArgs.teamChannelHistories
|
||||
* @param {boolean} teamChannelHistoriesArgs.prepareRecordsOnly
|
||||
* @throws DataOperatorException
|
||||
* @returns {Promise<TeamChannelHistoryModel[]>}
|
||||
*/
|
||||
handleTeamChannelHistory = async ({teamChannelHistories, prepareRecordsOnly = true}: HandleTeamChannelHistoryArgs): Promise<TeamChannelHistoryModel[]> => {
|
||||
@@ -183,7 +180,6 @@ const TeamHandler = (superclass: any) => class extends superclass {
|
||||
* @param {HandleTeamSearchHistoryArgs} teamSearchHistoriesArgs
|
||||
* @param {TeamSearchHistory[]} teamSearchHistoriesArgs.teamSearchHistories
|
||||
* @param {boolean} teamSearchHistoriesArgs.prepareRecordsOnly
|
||||
* @throws DataOperatorException
|
||||
* @returns {Promise<TeamSearchHistoryModel[]>}
|
||||
*/
|
||||
handleTeamSearchHistory = async ({teamSearchHistories, prepareRecordsOnly = true}: HandleTeamSearchHistoryArgs): Promise<TeamSearchHistoryModel[]> => {
|
||||
@@ -211,7 +207,6 @@ const TeamHandler = (superclass: any) => class extends superclass {
|
||||
* @param {HandleMyTeamArgs} myTeamsArgs
|
||||
* @param {MyTeam[]} myTeamsArgs.myTeams
|
||||
* @param {boolean} myTeamsArgs.prepareRecordsOnly
|
||||
* @throws DataOperatorException
|
||||
* @returns {Promise<MyTeamModel[]>}
|
||||
*/
|
||||
handleMyTeam = async ({myTeams, prepareRecordsOnly = true}: HandleMyTeamArgs): Promise<MyTeamModel[]> => {
|
||||
|
||||
@@ -137,7 +137,6 @@ const ThreadHandler = (superclass: any) => class extends superclass {
|
||||
* @param {ParticipantsPerThread[]} handleThreadParticipants.threadsParticipants
|
||||
* @param {boolean} handleThreadParticipants.prepareRecordsOnly
|
||||
* @param {boolean} handleThreadParticipants.skipSync
|
||||
* @throws DataOperatorException
|
||||
* @returns {Promise<Array<ThreadParticipantModel>>}
|
||||
*/
|
||||
handleThreadParticipants = async ({threadsParticipants, prepareRecordsOnly, skipSync = false}: HandleThreadParticipantsArgs): Promise<ThreadParticipantModel[]> => {
|
||||
|
||||
@@ -30,7 +30,6 @@ const UserHandler = (superclass: any) => class extends superclass {
|
||||
* @param {HandlePreferencesArgs} preferencesArgs
|
||||
* @param {PreferenceType[]} preferencesArgs.preferences
|
||||
* @param {boolean} preferencesArgs.prepareRecordsOnly
|
||||
* @throws DataOperatorException
|
||||
* @returns {Promise<PreferenceModel[]>}
|
||||
*/
|
||||
handlePreferences = async ({preferences, prepareRecordsOnly = true, sync = false}: HandlePreferencesArgs): Promise<PreferenceModel[]> => {
|
||||
@@ -101,7 +100,6 @@ const UserHandler = (superclass: any) => class extends superclass {
|
||||
* @param {HandleUsersArgs} usersArgs
|
||||
* @param {UserProfile[]} usersArgs.users
|
||||
* @param {boolean} usersArgs.prepareRecordsOnly
|
||||
* @throws DataOperatorException
|
||||
* @returns {Promise<UserModel[]>}
|
||||
*/
|
||||
handleUsers = async ({users, prepareRecordsOnly = true}: HandleUsersArgs): Promise<UserModel[]> => {
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
import {DependencyList, EffectCallback, useEffect} from 'react';
|
||||
import {Navigation} from 'react-native-navigation';
|
||||
|
||||
const useNavButtonPressed = (navButtonId: string, componentId: string, callback: EffectCallback | any, deps?: DependencyList) => {
|
||||
type Callback = EffectCallback | (() => Promise<void>);
|
||||
const useNavButtonPressed = (navButtonId: string, componentId: string, callback: Callback, deps?: DependencyList) => {
|
||||
useEffect(() => {
|
||||
const unsubscribe = Navigation.events().registerComponentListener({
|
||||
navigationButtonPressed: ({buttonId}: { buttonId: string }) => {
|
||||
|
||||
@@ -271,7 +271,7 @@ ThreadsInTeam
|
||||
id PK string # auto-generated
|
||||
loaded_in_global_threads boolean
|
||||
team_id string INDEX FK >- Team.id
|
||||
thread_id string INDEX
|
||||
thread_id string INDEX FK >- Thread.id
|
||||
|
||||
|
||||
ThreadParticipant # who is participating in this conversation
|
||||
|
||||
Reference in New Issue
Block a user