From cf6ddf63528424535c516a26a2c2b770379b4c22 Mon Sep 17 00:00:00 2001 From: Gerzon Z Date: Fri, 4 Jun 2021 14:08:37 -0400 Subject: [PATCH] [CHORE] Add logEvents for Teams (#3182) * added events for team channels view and add existing channel view * add logevents for room actions view and room info edit view Co-authored-by: Diego Mello --- app/utils/log/events.js | 19 ++++++++++++++++--- app/views/AddExistingChannelView.js | 6 +++--- app/views/RoomActionsView/index.js | 7 +++++++ app/views/RoomInfoEditView/index.js | 2 ++ app/views/TeamChannelsView.js | 5 +++++ 5 files changed, 33 insertions(+), 6 deletions(-) diff --git a/app/utils/log/events.js b/app/utils/log/events.js index a6d2eaa8..a183735b 100644 --- a/app/utils/log/events.js +++ b/app/utils/log/events.js @@ -100,8 +100,8 @@ export default { SELECTED_USERS_CREATE_GROUP_F: 'selected_users_create_group_f', // ADD EXISTING CHANNEL VIEW - EXISTING_CHANNEL_ADD_CHANNEL: 'existing_channel_add_channel', - EXISTING_CHANNEL_REMOVE_CHANNEL: 'existing_channel_remove_channel', + AEC_ADD_CHANNEL: 'aec_add_channel', + AEC_REMOVE_CHANNEL: 'aec_remove_channel', // CREATE CHANNEL VIEW CR_CREATE: 'cr_create', @@ -255,6 +255,13 @@ export default { RA_TOGGLE_BLOCK_USER_F: 'ra_toggle_block_user_f', RA_TOGGLE_ENCRYPTED: 'ra_toggle_encrypted', RA_TOGGLE_ENCRYPTED_F: 'ra_toggle_encrypted_f', + RA_LEAVE_TEAM: 'ra_leave_team', + RA_LEAVE_TEAM_F: 'ra_leave_team_f', + RA_CONVERT_TO_TEAM: 'ra_convert_to_team', + RA_CONVERT_TO_TEAM_F: 'ra_convert_to_team_f', + RA_MOVE_TO_TEAM: 'ra_move_to_team', + RA_MOVE_TO_TEAM_F: 'ra_move_to_team_f', + RA_SEARCH_TEAM: 'ra_search_team', // ROOM INFO VIEW RI_GO_RI_EDIT: 'ri_go_ri_edit', @@ -274,6 +281,8 @@ export default { RI_EDIT_TOGGLE_ARCHIVE_F: 'ri_edit_toggle_archive_f', RI_EDIT_DELETE: 'ri_edit_delete', RI_EDIT_DELETE_F: 'ri_edit_delete_f', + RI_EDIT_DELETE_TEAM: 'ri_edit_delete_team', + RI_EDIT_DELETE_TEAM_F: 'ri_edit_delete_team_f', // JITSI MEET VIEW JM_CONFERENCE_JOIN: 'jm_conference_join', @@ -327,5 +336,9 @@ export default { TC_SEARCH: 'tc_search', TC_CANCEL_SEARCH: 'tc_cancel_search', TC_GO_ACTIONS: 'tc_go_actions', - TC_GO_ROOM: 'tc_go_room' + TC_GO_ROOM: 'tc_go_room', + TC_DELETE_ROOM: 'tc_delete_room', + TC_DELETE_ROOM_F: 'tc_delete_room_f', + TC_TOGGLE_AUTOJOIN: 'tc_toggle_autojoin', + TC_TOGGLE_AUTOJOIN_F: 'tc_toggle_autojoin_f' }; diff --git a/app/views/AddExistingChannelView.js b/app/views/AddExistingChannelView.js index e7a590a5..0edced4b 100644 --- a/app/views/AddExistingChannelView.js +++ b/app/views/AddExistingChannelView.js @@ -126,8 +126,8 @@ class AddExistingChannelView extends React.Component { goRoom({ item: result, isMasterDetail }); } } catch (e) { - showErrorAlert(I18n.t(e.data.error), I18n.t('Add_Existing_Channel'), () => {}); logEvent(events.CT_ADD_ROOM_TO_TEAM_F); + showErrorAlert(I18n.t(e.data.error), I18n.t('Add_Existing_Channel'), () => {}); this.setState({ loading: false }); } } @@ -151,10 +151,10 @@ class AddExistingChannelView extends React.Component { animateNextTransition(); if (!this.isChecked(rid)) { - logEvent(events.EXISTING_CHANNEL_ADD_CHANNEL); + logEvent(events.AEC_ADD_CHANNEL); this.setState({ selected: [...selected, rid] }, () => this.setHeader()); } else { - logEvent(events.EXISTING_CHANNEL_REMOVE_CHANNEL); + logEvent(events.AEC_REMOVE_CHANNEL); const filterSelected = selected.filter(el => el !== rid); this.setState({ selected: filterSelected }, () => this.setHeader()); } diff --git a/app/views/RoomActionsView/index.js b/app/views/RoomActionsView/index.js index 74dc308f..0748cf78 100644 --- a/app/views/RoomActionsView/index.js +++ b/app/views/RoomActionsView/index.js @@ -431,6 +431,7 @@ class RoomActionsView extends React.Component { } handleLeaveTeam = async(selected) => { + logEvent(events.RA_LEAVE_TEAM); try { const { room } = this.state; const { navigation, isMasterDetail } = this.props; @@ -444,6 +445,7 @@ class RoomActionsView extends React.Component { } } } catch (e) { + logEvent(events.RA_LEAVE_TEAM_F); log(e); showErrorAlert( e.data.error @@ -492,6 +494,7 @@ class RoomActionsView extends React.Component { } handleConvertToTeam = async() => { + logEvent(events.RA_CONVERT_TO_TEAM); try { const { room } = this.state; const { navigation } = this.props; @@ -501,6 +504,7 @@ class RoomActionsView extends React.Component { navigation.navigate('RoomView'); } } catch (e) { + logEvent(events.RA_CONVERT_TO_TEAM_F); log(e); } } @@ -515,6 +519,7 @@ class RoomActionsView extends React.Component { } handleMoveToTeam = async(selected) => { + logEvent(events.RA_MOVE_TO_TEAM); try { const { room } = this.state; const { navigation } = this.props; @@ -523,6 +528,7 @@ class RoomActionsView extends React.Component { navigation.navigate('RoomView'); } } catch (e) { + logEvent(events.RA_MOVE_TO_TEAM_F); log(e); showErrorAlert(I18n.t('There_was_an_error_while_action', { action: I18n.t('moving_channel_to_team') })); } @@ -569,6 +575,7 @@ class RoomActionsView extends React.Component { } searchTeam = async(onChangeText) => { + logEvent(events.RA_SEARCH_TEAM); try { const { addTeamChannelPermission, createTeamPermission } = this.props; const QUERY_SIZE = 50; diff --git a/app/views/RoomInfoEditView/index.js b/app/views/RoomInfoEditView/index.js index 90d8b28f..8905e5ee 100644 --- a/app/views/RoomInfoEditView/index.js +++ b/app/views/RoomInfoEditView/index.js @@ -293,6 +293,7 @@ class RoomInfoEditView extends React.Component { } handleDeleteTeam = async(selected) => { + logEvent(events.RI_EDIT_DELETE_TEAM); const { navigation, isMasterDetail } = this.props; const { room } = this.state; try { @@ -305,6 +306,7 @@ class RoomInfoEditView extends React.Component { } } } catch (e) { + logEvent(events.RI_EDIT_DELETE_TEAM_F); log(e); showErrorAlert( e.data.error diff --git a/app/views/TeamChannelsView.js b/app/views/TeamChannelsView.js index cee7fe13..82e4ecdc 100644 --- a/app/views/TeamChannelsView.js +++ b/app/views/TeamChannelsView.js @@ -301,6 +301,7 @@ class TeamChannelsView extends React.Component { }, 1000, true); toggleAutoJoin = async(item) => { + logEvent(events.TC_TOGGLE_AUTOJOIN); try { const { data } = this.state; const result = await RocketChat.updateTeamRoom({ roomId: item._id, isDefault: !item.teamDefault }); @@ -314,6 +315,7 @@ class TeamChannelsView extends React.Component { this.setState({ data: newData }); } } catch (e) { + logEvent(events.TC_TOGGLE_AUTOJOIN_F); log(e); } } @@ -338,6 +340,7 @@ class TeamChannelsView extends React.Component { } removeRoom = async(item) => { + logEvent(events.TC_DELETE_ROOM); try { const { data } = this.state; const result = await RocketChat.removeTeamRoom({ roomId: item._id, teamId: this.team.teamId }); @@ -346,11 +349,13 @@ class TeamChannelsView extends React.Component { this.setState({ data: newData }); } } catch (e) { + logEvent(events.TC_DELETE_ROOM_F); log(e); } } delete = (item) => { + logEvent(events.TC_DELETE_ROOM); const { deleteRoom } = this.props; Alert.alert(