forked from Ivasoft/mattermost-mobile
[Gekidou MM-39728] - Websocket Events - Channels (#6038)
* wip checkin * wip checkin because my system is messed up again * correct the add user and remove user from channel functions. THe user and channel ids sometimes come from the broudcast field, not the data object * remove old comments * remove old comments * remove old comments * add back in unarchive handler. handleChannelUpdateEvent will also update the deleteAt value for a channel, but does not get called when unarchive from the channel view, only through the system console. * nit remove empty line * wip * wip * remove handleChannelConvertedEvent * remove handleChannelDirectAddedEvent * wip * wip * wip * Fix websockets events * Address feedback * Ensure categories and some refactoring * Self review fixes * Fix category creation bug * Address feedback and minor improvements * Address feedback * Fix lint Co-authored-by: Daniel Espino García <larkox@gmail.com>
This commit is contained in:
@@ -113,7 +113,7 @@ const ChannelHandler = (superclass: any) => class extends superclass {
|
||||
}
|
||||
|
||||
const createOrUpdateRawValues = getUniqueRawsBy({
|
||||
raws: channelInfos,
|
||||
raws: channelInfos as ChannelInfo[],
|
||||
key: 'id',
|
||||
});
|
||||
|
||||
|
||||
@@ -109,17 +109,17 @@ export const transformMyChannelSettingsRecord = ({action, database, value}: Tran
|
||||
* @returns {Promise<ChannelInfoModel>}
|
||||
*/
|
||||
export const transformChannelInfoRecord = ({action, database, value}: TransformerArgs): Promise<ChannelInfoModel> => {
|
||||
const raw = value.raw as ChannelInfo;
|
||||
const raw = value.raw as Partial<ChannelInfo>;
|
||||
const record = value.record as ChannelInfoModel;
|
||||
const isCreateAction = action === OperationType.CREATE;
|
||||
|
||||
const fieldsMapper = (channelInfo: ChannelInfoModel) => {
|
||||
channelInfo._raw.id = isCreateAction ? (raw.id || channelInfo.id) : record.id;
|
||||
channelInfo.guestCount = raw.guest_count;
|
||||
channelInfo.header = raw.header;
|
||||
channelInfo.memberCount = raw.member_count;
|
||||
channelInfo.pinnedPostCount = raw.pinned_post_count;
|
||||
channelInfo.purpose = raw.purpose;
|
||||
channelInfo.guestCount = raw.guest_count ?? channelInfo.guestCount ?? 0;
|
||||
channelInfo.header = raw.header ?? channelInfo.header ?? '';
|
||||
channelInfo.memberCount = raw.member_count ?? channelInfo.memberCount ?? 0;
|
||||
channelInfo.pinnedPostCount = raw.pinned_post_count ?? channelInfo.pinnedPostCount ?? 0;
|
||||
channelInfo.purpose = raw.purpose ?? channelInfo.purpose ?? '';
|
||||
};
|
||||
|
||||
return prepareBaseRecord({
|
||||
|
||||
Reference in New Issue
Block a user