[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 <diegolmello@gmail.com>
This commit is contained in:
Gerzon Z 2021-06-04 14:08:37 -04:00 committed by GitHub
parent 91371e88d9
commit cf6ddf6352
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 6 deletions

View File

@ -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'
};

View File

@ -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());
}

View File

@ -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;

View File

@ -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

View File

@ -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(