Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CHORE] logEvents for Teams #3182

Merged
merged 3 commits into from
Jun 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions app/utils/log/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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'
};
6 changes: 3 additions & 3 deletions app/views/AddExistingChannelView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}
}
Expand All @@ -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());
}
Expand Down
7 changes: 7 additions & 0 deletions app/views/RoomActionsView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -444,6 +445,7 @@ class RoomActionsView extends React.Component {
}
}
} catch (e) {
logEvent(events.RA_LEAVE_TEAM_F);
log(e);
showErrorAlert(
e.data.error
Expand Down Expand Up @@ -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;
Expand All @@ -501,6 +504,7 @@ class RoomActionsView extends React.Component {
navigation.navigate('RoomView');
}
} catch (e) {
logEvent(events.RA_CONVERT_TO_TEAM_F);
log(e);
}
}
Expand All @@ -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;
Expand All @@ -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') }));
}
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions app/views/RoomInfoEditView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -305,6 +306,7 @@ class RoomInfoEditView extends React.Component {
}
}
} catch (e) {
logEvent(events.RI_EDIT_DELETE_TEAM_F);
log(e);
showErrorAlert(
e.data.error
Expand Down
5 changes: 5 additions & 0 deletions app/views/TeamChannelsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand All @@ -314,6 +315,7 @@ class TeamChannelsView extends React.Component {
this.setState({ data: newData });
}
} catch (e) {
logEvent(events.TC_TOGGLE_AUTOJOIN_F);
log(e);
}
}
Expand All @@ -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 });
Expand All @@ -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(
Expand Down