[NEW] Log remaining events (#2368)

* Change NAVIGATE_TO for GO_TO to reduce event size

* Log RA JitsiMeet events and join / terminate

* Log more RoomView events

* Log slash commands and handle fail

* Log RoomActions events

* Change from GO_TO to just GO

* Log RoomInfoEdit events

* Log InviteUsers and InviteUsersEdit events

* Log AutoTranslate events

* Log NotificationPreferences events

* Log remaining routes from RoomActions

* Log RoomAction toggle block user

* Fix command event

Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
Youssef Muhamad 2020-08-05 10:15:56 -03:00 committed by GitHub
parent 0f0e2c7b5f
commit 95e2ccb846
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 191 additions and 34 deletions

View File

@ -738,6 +738,7 @@ class MessageBox extends Component {
Q.where('id', Q.like(`${ Q.sanitizeLikeString(command) }%`))
).fetch();
if (slashCommand.length > 0) {
logEvent(events.COMMAND_RUN);
try {
const messageWithoutCommand = message.replace(/([^\s]+)/, '').trim();
const [{ appId }] = slashCommand;
@ -745,6 +746,7 @@ class MessageBox extends Component {
RocketChat.runSlashCommand(command, roomId, messageWithoutCommand, triggerId, tmid || messageTmid);
replyCancel();
} catch (e) {
logEvent(events.COMMAND_RUN_F);
log(e);
}
this.clearInput();

View File

@ -5,6 +5,7 @@ import { Text } from 'react-native';
import { themes } from '../../constants/colors';
import styles from './styles';
import { logEvent, events } from '../../utils/log';
const AtMention = React.memo(({
mention, mentions, username, navToRoomInfo, style = [], useRealName, theme
@ -41,6 +42,7 @@ const AtMention = React.memo(({
const user = mentions && mentions.length && mentions.find(m => m.username === mention);
const handlePress = () => {
logEvent(events.ROOM_MENTION_GO_USER_INFO);
const navParam = {
t: 'd',
rid: user && user._id

View File

@ -1,5 +1,6 @@
import reduxStore from '../createStore';
import Navigation from '../Navigation';
import { logEvent, events } from '../../utils/log';
async function jitsiURL({ rid }) {
const { settings } = reduxStore.getState();
@ -24,7 +25,7 @@ async function jitsiURL({ rid }) {
const accessToken = await this.methodCallWrapper('jitsi:generateAccessToken', rid);
queryString = `?jwt=${ accessToken }`;
} catch {
// do nothing
logEvent(events.RA_JITSI_F);
}
}
@ -32,6 +33,7 @@ async function jitsiURL({ rid }) {
}
async function callJitsi(rid, onlyAudio = false) {
logEvent(onlyAudio ? events.RA_JITSI_AUDIO : events.RA_JITSI_VIDEO);
const url = await jitsiURL.call(this, { rid });
Navigation.navigate('JitsiMeetView', { url, onlyAudio, rid });
}

View File

@ -8,7 +8,7 @@ import Navigation from '../lib/Navigation';
import * as types from '../actions/actionsTypes';
import { removedRoom } from '../actions/room';
import RocketChat from '../lib/rocketchat';
import log from '../utils/log';
import log, { logEvent, events } from '../utils/log';
import I18n from '../i18n';
import { showErrorAlert } from '../utils/info';
@ -48,12 +48,14 @@ const handleRemovedRoom = function* handleRemovedRoom() {
};
const handleLeaveRoom = function* handleLeaveRoom({ rid, t }) {
logEvent(events.RA_LEAVE);
try {
const result = yield RocketChat.leaveRoom(rid, t);
if (result.success) {
yield handleRemovedRoom();
}
} catch (e) {
logEvent(events.RA_LEAVE_F);
if (e.data && e.data.errorType === 'error-you-are-last-owner') {
Alert.alert(I18n.t('Oops'), I18n.t(e.data.errorType));
} else {
@ -63,12 +65,14 @@ const handleLeaveRoom = function* handleLeaveRoom({ rid, t }) {
};
const handleDeleteRoom = function* handleDeleteRoom({ rid, t }) {
logEvent(events.RI_EDIT_DELETE);
try {
const result = yield RocketChat.deleteRoom(rid, t);
if (result.success) {
yield handleRemovedRoom();
}
} catch (e) {
logEvent(events.RI_EDIT_DELETE_F);
Alert.alert(I18n.t('Oops'), I18n.t('There_was_an_error_while_action', { action: I18n.t('deleting_room') }));
}
};

View File

@ -37,11 +37,11 @@ export default {
ENTER_WITH_APPLE_F: 'enter_with_apple_f',
// SIDEBAR VIEW
SIDEBAR_NAVIGATE_TO_STATUS: 'sidebar_navigate_to_status',
SIDEBAR_NAVIGATE_TO_CHATS: 'sidebar_navigate_to_chats',
SIDEBAR_NAVIGATE_TO_PROFILE: 'sidebar_navigate_to_profile',
SIDEBAR_NAVIGATE_TO_SETTINGS: 'sidebar_navigate_to_settings',
SIDEBAR_NAVIGATE_TO_ADMINPANEL: 'sidebar_navigate_to_admin_panel',
SIDEBAR_GO_STATUS: 'sidebar_go_status',
SIDEBAR_GO_CHATS: 'sidebar_go_chats',
SIDEBAR_GO_PROFILE: 'sidebar_go_profile',
SIDEBAR_GO_SETTINGS: 'sidebar_go_settings',
SIDEBAR_GO_ADMINPANEL: 'sidebar_go_admin_panel',
// STATUS VIEW
STATUS_DONE: 'status_done',
@ -57,11 +57,11 @@ export default {
RL_TOGGLE_SERVER_DROPDOWN: 'rl_toggle_server_dropdown',
RL_ADD_SERVER: 'rl_add_server',
RL_CHANGE_SERVER: 'rl_change_server',
RL_NAVIGATE_TO_NEW_MSG: 'rl_navigate_to_new_msg',
RL_GO_NEW_MSG: 'rl_go_new_msg',
RL_SEARCH: 'rl_search',
RL_NAVIGATE_TO_DIRECTORY: 'rl_navigate_to_directory',
RL_GO_DIRECTORY: 'rl_go_directory',
RL_GO_QUEUE: 'rl_go_queue',
RL_GO_TO_ROOM: 'rl_go_to_room',
RL_GO_ROOM: 'rl_go_room',
RL_FAVORITE_CHANNEL: 'rl_favorite_channel',
RL_UNFAVORITE_CHANNEL: 'rl_unfavorite_channel',
RL_TOGGLE_FAVORITE_F: 'rl_toggle_favorite_f',
@ -78,6 +78,7 @@ export default {
RL_GROUP_CHANNELS_BY_FAVORITE: 'rl_group_channels_by_favorite',
RL_GROUP_CHANNELS_BY_UNREAD: 'rl_group_channels_by_unread',
// QUEUE LIST VIEW
QL_GO_ROOM: 'ql_go_room',
// DIRECTORY VIEW
@ -122,14 +123,14 @@ export default {
// SETTINGS VIEW
SE_CONTACT_US: 'se_contact_us',
SE_CONTACT_US_F: 'se_contact_us_f',
SE_NAVIGATE_TO_LANGUAGE: 'se_navigate_to_language',
SE_GO_LANGUAGE: 'se_go_language',
SE_REVIEW_THIS_APP: 'se_review_this_app',
SE_REVIEW_THIS_APP_F: 'se_review_this_app_f',
SE_SHARE_THIS_APP: 'se_share_this_app',
SE_NAVIGATE_TO_DEFAULTBROWSER: 'se_navigate_to_default_browser',
SE_NAVIGATE_TO_THEME: 'se_navigate_to_theme',
SE_NAVIGATE_TO_SCREENLOCKCONFIG: 'se_navigate_to_screen_lock_cfg',
SE_NAVIGATE_TO_PROFILE: 'se_navigate_to_profile',
SE_GO_DEFAULTBROWSER: 'se_go_default_browser',
SE_GO_THEME: 'se_go_theme',
SE_GO_SCREENLOCKCONFIG: 'se_go_screen_lock_cfg',
SE_GO_PROFILE: 'se_go_profile',
SE_READ_LICENSE: 'se_read_license',
SE_COPY_APP_VERSION: 'se_copy_app_version',
SE_COPY_SERVER_VERSION: 'se_copy_server_version',
@ -197,5 +198,93 @@ export default {
ROOM_MSG_ACTION_REACTION: 'room_msg_action_reaction',
ROOM_MSG_ACTION_REPORT: 'room_msg_action_report',
ROOM_MSG_ACTION_REPORT_F: 'room_msg_action_report_f',
ROOM_JOIN: 'room_join'
ROOM_JOIN: 'room_join',
ROOM_GO_RA: 'room_go_ra',
ROOM_TOGGLE_FOLLOW_THREADS: 'room_toggle_follow_threads',
ROOM_GO_SEARCH: 'room_go_search',
ROOM_GO_THREADS: 'room_go_threads',
ROOM_GO_ROOM_INFO: 'room_go_room_info',
ROOM_GO_USER_INFO: 'room_go_user_info',
ROOM_MENTION_GO_USER_INFO: 'room_mention_go_user_info',
COMMAND_RUN: 'command_run',
COMMAND_RUN_F: 'command_run_f',
// ROOM ACTIONS VIEW
RA_JITSI_VIDEO: 'ra_jitsi_video',
RA_JITSI_AUDIO: 'ra_jitsi_audio',
RA_JITSI_F: 'ra_jitsi_f',
RA_GO_ROOMINFO: 'ra_go_room_info',
RA_GO_ROOMMEMBERS: 'ra_go_room_members',
RA_GO_SELECTEDUSERS: 'ra_go_selected_users',
RA_GO_INVITEUSERS: 'ra_go_invite_users',
RA_GO_MESSAGESFILES: 'ra_go_messages_files',
RA_GO_MESSAGESMENTIONS: 'ra_go_messages_mentions',
RA_GO_MESSAGESSTARRED: 'ra_go_messages_starred',
RA_GO_SEARCHMESSAGES: 'ra_go_search_messages',
RA_GO_MESSAGESPINNED: 'ra_go_messages_pinned',
RA_GO_AUTOTRANSLATE: 'ra_go_autotranslate',
RA_GO_NOTIFICATIONPREF: 'ra_go_notification_pref',
RA_GO_FORWARDLIVECHAT: 'ra_go_forward_livechat',
RA_GO_VISITORNAVIGATION: 'ra_go_visitor_navigation',
RA_SHARE: 'ra_share',
RA_LEAVE: 'ra_leave',
RA_LEAVE_F: 'ra_leave_f',
RA_TOGGLE_BLOCK_USER: 'ra_toggle_block_user',
RA_TOGGLE_BLOCK_USER_F: 'ra_toggle_block_user_f',
// ROOM INFO VIEW
RI_GO_RI_EDIT: 'ri_go_ri_edit',
RI_GO_LIVECHAT_EDIT: 'ri_go_livechat_edit',
RI_GO_ROOM_USER: 'ri_go_room_user',
// ROOM INFO EDIT VIEW
RI_EDIT_TOGGLE_ROOM_TYPE: 'ri_edit_toggle_room_type',
RI_EDIT_TOGGLE_READ_ONLY: 'ri_edit_toggle_read_only',
RI_EDIT_TOGGLE_REACTIONS: 'ri_edit_toggle_reactions',
RI_EDIT_TOGGLE_SYSTEM_MSG: 'ri_edit_toggle_system_msg',
RI_EDIT_SAVE: 'ri_edit_save',
RI_EDIT_SAVE_F: 'ri_edit_save_f',
RI_EDIT_RESET: 'ri_edit_reset',
RI_EDIT_TOGGLE_ARCHIVE: 'ri_edit_toggle_archive',
RI_EDIT_TOGGLE_ARCHIVE_F: 'ri_edit_toggle_archive_f',
RI_EDIT_DELETE: 'ri_edit_delete',
RI_EDIT_DELETE_F: 'ri_edit_delete_f',
// JITSI MEET VIEW
JM_CONFERENCE_JOIN: 'jm_conference_join',
JM_CONFERENCE_TERMINATE: 'jm_conference_terminate',
// INVITE USERS VIEW
IU_SHARE: 'iu_share',
IU_GO_IU_EDIT: 'iu_go_iu_edit',
// INVITE USERS EDIT VIEW
IU_EDIT_SET_LINK_PARAM: 'iu_edit_set_link_param',
IU_EDIT_CREATE_LINK: 'iu_edit_create_link',
// AUTO TRANSLATE VIEW
AT_TOGGLE_TRANSLATE: 'at_toggle_translate',
AT_TOGGLE_TRANSLATE_F: 'at_toggle_translate_f',
AT_SET_LANG: 'at_set_lang',
AT_SET_LANG_F: 'at_set_lang_f',
// NOTIFICATION PREFERENCES VIEW
NP_DISABLENOTIFICATIONS: 'np_disable_notification',
NP_DISABLENOTIFICATIONS_F: 'np_disable_notification_f',
NP_MUTEGROUPMENTIONS: 'np_mute_group_mentions',
NP_MUTEGROUPMENTIONS_F: 'np_mute_group_mentions_f',
NP_HIDEUNREADSTATUS: 'np_hide_unread_status',
NP_HIDEUNREADSTATUS_F: 'np_hide_unread_status_f',
NP_DESKTOPNOTIFICATIONS: 'np_desktop_notifications',
NP_DESKTOPNOTIFICATIONS_F: 'np_desktop_notifications_f',
NP_MOBILEPUSHNOTIFICATIONS: 'np_mobile_push_notifications',
NP_MOBILEPUSHNOTIFICATIONS_F: 'np_mobile_push_notifications_f',
NP_AUDIONOTIFICATIONS: 'np_audio_notifications',
NP_AUDIONOTIFICATIONS_F: 'np_audio_notifications_f',
NP_AUDIONOTIFICATIONVALUE: 'np_audio_notification_value',
NP_AUDIONOTIFICATIONVALUE_F: 'np_audio_notification_value_f',
NP_DESKTOPNOTIFICATIONDURATION: 'np_desktopnotificationduration',
NP_DESKTOPNOTIFICATIONDURATION_F: 'np_desktopnotificationduration_f',
NP_EMAILNOTIFICATIONS: 'np_email_notifications',
NP_EMAILNOTIFICATIONS_F: 'np_email_notifications_f'
};

View File

@ -15,6 +15,7 @@ import { SWITCH_TRACK_COLOR, themes } from '../../constants/colors';
import scrollPersistTaps from '../../utils/scrollPersistTaps';
import { withTheme } from '../../theme';
import SafeAreaView from '../../containers/SafeAreaView';
import { logEvent, events } from '../../utils/log';
const styles = StyleSheet.create({
contentContainerStyle: {
@ -103,6 +104,7 @@ class AutoTranslateView extends React.Component {
}
toggleAutoTranslate = async() => {
logEvent(events.AT_TOGGLE_TRANSLATE);
const { enableAutoTranslate } = this.state;
try {
await RocketChat.saveAutoTranslate({
@ -113,11 +115,13 @@ class AutoTranslateView extends React.Component {
});
this.setState({ enableAutoTranslate: !enableAutoTranslate });
} catch (error) {
logEvent(events.AT_TOGGLE_TRANSLATE_F);
console.log(error);
}
}
saveAutoTranslateLanguage = async(language) => {
logEvent(events.AT_SET_LANG);
try {
await RocketChat.saveAutoTranslate({
rid: this.rid,
@ -126,6 +130,7 @@ class AutoTranslateView extends React.Component {
});
this.setState({ selectedLanguage: language });
} catch (error) {
logEvent(events.AT_SET_LANG_F);
console.log(error);
}
}

View File

@ -18,6 +18,7 @@ import { themes } from '../../constants/colors';
import { withTheme } from '../../theme';
import Separator from '../../containers/Separator';
import SafeAreaView from '../../containers/SafeAreaView';
import { logEvent, events } from '../../utils/log';
const OPTIONS = {
days: [{
@ -72,6 +73,7 @@ class InviteUsersView extends React.Component {
}
onValueChangePicker = (key, value) => {
logEvent(events.IU_EDIT_SET_LINK_PARAM);
const { inviteLinksSetParams } = this.props;
const params = {
[key]: value
@ -80,6 +82,7 @@ class InviteUsersView extends React.Component {
}
createInviteLink = () => {
logEvent(events.IU_EDIT_CREATE_LINK);
const { createInviteLink, navigation } = this.props;
createInviteLink(this.rid);
navigation.pop();

View File

@ -18,6 +18,7 @@ import StatusBar from '../../containers/StatusBar';
import { themes } from '../../constants/colors';
import { withTheme } from '../../theme';
import SafeAreaView from '../../containers/SafeAreaView';
import { logEvent, events } from '../../utils/log';
class InviteUsersView extends React.Component {
static navigationOptions = () => ({
@ -50,6 +51,7 @@ class InviteUsersView extends React.Component {
}
share = () => {
logEvent(events.IU_SHARE);
const { invite } = this.props;
if (!invite || !invite.url) {
return;
@ -58,6 +60,7 @@ class InviteUsersView extends React.Component {
}
edit = () => {
logEvent(events.IU_GO_IU_EDIT);
const { navigation } = this.props;
navigation.navigate('InviteUsersEditView', { rid: this.rid });
}

View File

@ -8,6 +8,7 @@ import RocketChat from '../lib/rocketchat';
import { getUserSelector } from '../selectors/login';
import sharedStyles from './Styles';
import { logEvent, events } from '../utils/log';
const formatUrl = (url, baseUrl, uriSize, avatarAuthURLFragment) => (
`${ baseUrl }/avatar/${ url }?format=png&width=${ uriSize }&height=${ uriSize }${ avatarAuthURLFragment }`
@ -59,6 +60,7 @@ class JitsiMeetView extends React.Component {
}
componentWillUnmount() {
logEvent(events.JM_CONFERENCE_TERMINATE);
if (this.jitsiTimeout) {
BackgroundTimer.clearInterval(this.jitsiTimeout);
}
@ -68,6 +70,7 @@ class JitsiMeetView extends React.Component {
// Jitsi Update Timeout needs to be called every 10 seconds to make sure
// call is not ended and is available to web users.
onConferenceJoined = () => {
logEvent(events.JM_CONFERENCE_JOIN);
RocketChat.updateJitsiTimeout(this.rid).catch(e => console.log(e));
if (this.jitsiTimeout) {
BackgroundTimer.clearInterval(this.jitsiTimeout);
@ -78,6 +81,7 @@ class JitsiMeetView extends React.Component {
}
onConferenceTerminated = () => {
logEvent(events.JM_CONFERENCE_TERMINATE);
const { navigation } = this.props;
if (this.jitsiTimeout) {
BackgroundTimer.clearInterval(this.jitsiTimeout);

View File

@ -16,7 +16,7 @@ import RocketChat from '../../lib/rocketchat';
import { withTheme } from '../../theme';
import protectedFunction from '../../lib/methods/helpers/protectedFunction';
import SafeAreaView from '../../containers/SafeAreaView';
import log from '../../utils/log';
import log, { events, logEvent } from '../../utils/log';
const SectionTitle = React.memo(({ title, theme }) => (
<Text
@ -181,6 +181,7 @@ class NotificationPreferencesView extends React.Component {
}
saveNotificationSettings = async(key, value, params) => {
logEvent(events[`NP_${ key.toUpperCase() }`]);
const { room } = this.state;
const db = database.active;
@ -206,6 +207,7 @@ class NotificationPreferencesView extends React.Component {
}));
});
} catch (e) {
logEvent(events[`NP_${ key.toUpperCase() }_F`]);
log(e);
}
}

View File

@ -14,7 +14,7 @@ import sharedStyles from '../Styles';
import Avatar from '../../containers/Avatar';
import Status from '../../containers/Status';
import RocketChat from '../../lib/rocketchat';
import log from '../../utils/log';
import log, { logEvent, events } from '../../utils/log';
import RoomTypeIcon from '../../containers/RoomTypeIcon';
import I18n from '../../i18n';
import scrollPersistTaps from '../../utils/scrollPersistTaps';
@ -141,12 +141,14 @@ class RoomActionsView extends React.Component {
}
onPressTouchable = (item) => {
if (item.route) {
const { route, event, params } = item;
if (route) {
logEvent(events[`RA_GO_${ route.replace('View', '').toUpperCase() }${ params.name ? params.name.toUpperCase() : '' }`]);
const { navigation } = this.props;
navigation.navigate(item.route, item.params);
navigation.navigate(route, params);
}
if (item.event) {
return item.event();
if (event) {
return event();
}
}
@ -513,17 +515,20 @@ class RoomActionsView extends React.Component {
}
toggleBlockUser = () => {
logEvent(events.RA_TOGGLE_BLOCK_USER);
const { room } = this.state;
const { rid, blocker } = room;
const { member } = this.state;
try {
RocketChat.toggleBlockUser(rid, member._id, !blocker);
} catch (e) {
logEvent(events.RA_TOGGLE_BLOCK_USER_F);
log(e);
}
}
handleShare = () => {
logEvent(events.RA_SHARE);
const { room } = this.state;
const permalink = RocketChat.getPermalinkChannel(room);
if (!permalink) {

View File

@ -23,7 +23,7 @@ import RCTextInput from '../../containers/TextInput';
import Loading from '../../containers/Loading';
import SwitchContainer from './SwitchContainer';
import random from '../../utils/random';
import log from '../../utils/log';
import log, { logEvent, events } from '../../utils/log';
import I18n from '../../i18n';
import StatusBar from '../../containers/StatusBar';
import { themes } from '../../constants/colors';
@ -150,6 +150,7 @@ class RoomInfoEditView extends React.Component {
}
reset = () => {
logEvent(events.RI_EDIT_RESET);
this.clearErrors();
this.init(this.room);
}
@ -173,6 +174,7 @@ class RoomInfoEditView extends React.Component {
}
submit = async() => {
logEvent(events.RI_EDIT_SAVE);
Keyboard.dismiss();
const {
room, name, description, topic, announcement, t, ro, reactWhenReadOnly, joinCode, systemMessages
@ -242,6 +244,7 @@ class RoomInfoEditView extends React.Component {
await this.setState({ saving: false });
setTimeout(() => {
if (error) {
logEvent(events.RI_EDIT_SAVE_F);
showErrorAlert(I18n.t('There_was_an_error_while_action', { action: I18n.t('saving_settings') }));
} else {
EventEmitter.emit(LISTENER, { message: I18n.t('Settings_succesfully_changed') });
@ -289,8 +292,10 @@ class RoomInfoEditView extends React.Component {
style: 'destructive',
onPress: async() => {
try {
logEvent(events.RI_EDIT_TOGGLE_ARCHIVE);
await RocketChat.toggleArchiveRoom(rid, t, !archived);
} catch (e) {
logEvent(events.RI_EDIT_TOGGLE_ARCHIVE_F);
log(e);
}
}
@ -333,6 +338,26 @@ class RoomInfoEditView extends React.Component {
);
}
toggleRoomType = (value) => {
logEvent(events.RI_EDIT_TOGGLE_ROOM_TYPE);
this.setState({ t: value });
}
toggleReadOnly = (value) => {
logEvent(events.RI_EDIT_TOGGLE_READ_ONLY);
this.setState({ ro: value });
}
toggleReactions = (value) => {
logEvent(events.RI_EDIT_TOGGLE_REACTIONS);
this.setState({ reactWhenReadOnly: value });
}
toggleHideSystemMessages = (value) => {
logEvent(events.RI_EDIT_TOGGLE_SYSTEM_MSG);
this.setState(({ systemMessages }) => ({ enableSysMes: value, systemMessages: value ? systemMessages : [] }));
}
render() {
const {
name, nameError, description, topic, announcement, t, ro, reactWhenReadOnly, room, joinCode, saving, permissions, archived, enableSysMes
@ -410,7 +435,7 @@ class RoomInfoEditView extends React.Component {
leftLabelSecondary={I18n.t('Everyone_can_access_this_channel')}
rightLabelPrimary={I18n.t('Private')}
rightLabelSecondary={I18n.t('Just_invited_people_can_access_this_channel')}
onValueChange={value => this.setState({ t: value })}
onValueChange={this.toggleRoomType}
theme={theme}
testID='room-info-edit-view-t'
/>
@ -420,7 +445,7 @@ class RoomInfoEditView extends React.Component {
leftLabelSecondary={I18n.t('All_users_in_the_channel_can_write_new_messages')}
rightLabelPrimary={I18n.t('Read_Only')}
rightLabelSecondary={I18n.t('Only_authorized_users_can_write_new_messages')}
onValueChange={value => this.setState({ ro: value })}
onValueChange={this.toggleReadOnly}
disabled={!permissions[PERMISSION_SET_READONLY] || room.broadcast}
theme={theme}
testID='room-info-edit-view-ro'
@ -433,7 +458,7 @@ class RoomInfoEditView extends React.Component {
leftLabelSecondary={I18n.t('Reactions_are_disabled')}
rightLabelPrimary={I18n.t('Allow_Reactions')}
rightLabelSecondary={I18n.t('Reactions_are_enabled')}
onValueChange={value => this.setState({ reactWhenReadOnly: value })}
onValueChange={this.toggleReactions}
disabled={!permissions[PERMISSION_SET_REACT_WHEN_READONLY]}
theme={theme}
testID='room-info-edit-view-react-when-ro'
@ -455,7 +480,7 @@ class RoomInfoEditView extends React.Component {
leftLabelSecondary={enableSysMes ? I18n.t('Overwrites_the_server_configuration_and_use_room_config') : I18n.t('Uses_server_configuration')}
theme={theme}
testID='room-info-edit-switch-system-messages'
onValueChange={value => this.setState(({ systemMessages }) => ({ enableSysMes: value, systemMessages: value ? systemMessages : [] }))}
onValueChange={this.toggleHideSystemMessages}
labelContainerStyle={styles.hideSystemMessages}
leftLabelStyle={styles.systemMessagesLabel}
>

View File

@ -17,7 +17,7 @@ import RoomTypeIcon from '../../containers/RoomTypeIcon';
import I18n from '../../i18n';
import { CustomHeaderButtons, CloseModalButton } from '../../containers/HeaderButton';
import StatusBar from '../../containers/StatusBar';
import log from '../../utils/log';
import log, { logEvent, events } from '../../utils/log';
import { themes } from '../../constants/colors';
import { withTheme } from '../../theme';
import { getUserSelector } from '../../selectors/login';
@ -117,7 +117,11 @@ class RoomInfoView extends React.Component {
<CustomHeaderButtons>
<Item
iconName='edit'
onPress={() => navigation.navigate(t === 'l' ? 'LivechatEditView' : 'RoomInfoEditView', { rid, room, roomUser })}
onPress={() => {
const isLivechat = t === 'l';
logEvent(events[`RI_GO_${ isLivechat ? 'LIVECHAT' : 'RI' }_EDIT`]);
navigation.navigate(isLivechat ? 'LivechatEditView' : 'RoomInfoEditView', { rid, room, roomUser });
}}
testID='room-info-view-edit-button'
/>
</CustomHeaderButtons>
@ -246,6 +250,7 @@ class RoomInfoView extends React.Component {
})
goRoom = () => {
logEvent(events.RI_GO_ROOM_USER);
const { roomUser, room } = this.state;
const { name, username } = roomUser;
const { rooms, navigation, isMasterDetail } = this.props;

View File

@ -5,6 +5,7 @@ import { connect } from 'react-redux';
import { CustomHeaderButtons, Item } from '../../../containers/HeaderButton';
import database from '../../../lib/database';
import { getUserSelector } from '../../../selectors/login';
import { logEvent, events } from '../../../utils/log';
class RightButtonsContainer extends React.PureComponent {
static propTypes = {
@ -58,6 +59,7 @@ class RightButtonsContainer extends React.PureComponent {
}
goThreadsView = () => {
logEvent(events.ROOM_GO_THREADS);
const {
rid, t, navigation, isMasterDetail
} = this.props;
@ -69,6 +71,7 @@ class RightButtonsContainer extends React.PureComponent {
}
goSearchView = () => {
logEvent(events.ROOM_GO_SEARCH);
const {
rid, navigation, isMasterDetail
} = this.props;
@ -80,6 +83,7 @@ class RightButtonsContainer extends React.PureComponent {
}
toggleFollowThread = () => {
logEvent(events.ROOM_TOGGLE_FOLLOW_THREADS);
const { isFollowingThread } = this.state;
const { toggleFollowThread } = this.props;
if (toggleFollowThread) {

View File

@ -357,6 +357,7 @@ class RoomView extends React.Component {
}
goRoomActionsView = (screen) => {
logEvent(events.ROOM_GO_RA);
const { room, member } = this.state;
const { navigation, isMasterDetail } = this.props;
if (isMasterDetail) {
@ -750,6 +751,7 @@ class RoomView extends React.Component {
navToRoomInfo = (navParam) => {
const { navigation, user, isMasterDetail } = this.props;
logEvent(events[`ROOM_GO_${ navParam.t === 'd' ? 'USER' : 'ROOM' }_INFO`]);
if (navParam.rid === user.id) {
return;
}

View File

@ -668,7 +668,7 @@ class RoomsListView extends React.Component {
};
goDirectory = () => {
logEvent(events.RL_NAVIGATE_TO_DIRECTORY);
logEvent(events.RL_GO_DIRECTORY);
const { navigation, isMasterDetail } = this.props;
if (isMasterDetail) {
navigation.navigate('ModalStackNavigator', { screen: 'DirectoryView' });
@ -692,7 +692,7 @@ class RoomsListView extends React.Component {
};
goRoom = ({ item, isMasterDetail }) => {
logEvent(events.RL_GO_TO_ROOM);
logEvent(events.RL_GO_ROOM);
const { item: currentItem } = this.state;
const { rooms } = this.props;
if (currentItem?.rid === item.rid || rooms?.includes(item.rid)) {
@ -753,7 +753,7 @@ class RoomsListView extends React.Component {
}
goToNewMessage = () => {
logEvent(events.RL_NAVIGATE_TO_NEW_MSG);
logEvent(events.RL_GO_NEW_MSG);
const { navigation, isMasterDetail } = this.props;
if (isMasterDetail) {

View File

@ -140,7 +140,7 @@ class SettingsView extends React.Component {
}
navigateToScreen = (screen) => {
logEvent(events[`SE_NAVIGATE_TO_${ screen.replace('View', '').toUpperCase() }`]);
logEvent(events[`SE_GO_${ screen.replace('View', '').toUpperCase() }`]);
const { navigation } = this.props;
navigation.navigate(screen);
}

View File

@ -134,7 +134,7 @@ class Sidebar extends Component {
}
sidebarNavigate = (route) => {
logEvent(events[`SIDEBAR_NAVIGATE_TO_${ route.replace('StackNavigator', '').replace('View', '').toUpperCase() }`]);
logEvent(events[`SIDEBAR_GO_${ route.replace('StackNavigator', '').replace('View', '').toUpperCase() }`]);
const { navigation } = this.props;
navigation.navigate(route);
}