Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat.ReactNative into detoxRunner
This commit is contained in:
commit
095f39d857
|
@ -58119,6 +58119,7 @@ exports[`Storyshots Room Item Tag 1`] = `
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
testID="auto-join-tag"
|
||||||
>
|
>
|
||||||
Auto-join
|
Auto-join
|
||||||
</Text>
|
</Text>
|
||||||
|
@ -59020,6 +59021,7 @@ exports[`Storyshots Room Item Tag 1`] = `
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
testID="auto-join-tag"
|
||||||
>
|
>
|
||||||
Auto-join
|
Auto-join
|
||||||
</Text>
|
</Text>
|
||||||
|
|
|
@ -193,5 +193,8 @@ export default {
|
||||||
},
|
},
|
||||||
Allow_Save_Media_to_Gallery: {
|
Allow_Save_Media_to_Gallery: {
|
||||||
type: 'valueAsBoolean'
|
type: 'valueAsBoolean'
|
||||||
|
},
|
||||||
|
Accounts_AllowInvisibleStatusOption: {
|
||||||
|
type: 'valueAsString'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,6 +18,7 @@ export const Item = React.memo(({ item, hide, theme }) => {
|
||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
style={[styles.item, { backgroundColor: themes[theme].focusedBackground }]}
|
style={[styles.item, { backgroundColor: themes[theme].focusedBackground }]}
|
||||||
theme={theme}
|
theme={theme}
|
||||||
|
testID={item.testID}
|
||||||
>
|
>
|
||||||
<CustomIcon name={item.icon} size={20} color={item.danger ? themes[theme].dangerColor : themes[theme].bodyText} />
|
<CustomIcon name={item.icon} size={20} color={item.danger ? themes[theme].dangerColor : themes[theme].bodyText} />
|
||||||
<View style={styles.titleContainer}>
|
<View style={styles.titleContainer}>
|
||||||
|
@ -42,7 +43,8 @@ Item.propTypes = {
|
||||||
icon: PropTypes.string,
|
icon: PropTypes.string,
|
||||||
danger: PropTypes.bool,
|
danger: PropTypes.bool,
|
||||||
onPress: PropTypes.func,
|
onPress: PropTypes.func,
|
||||||
right: PropTypes.func
|
right: PropTypes.func,
|
||||||
|
testID: PropTypes.string
|
||||||
}),
|
}),
|
||||||
hide: PropTypes.func,
|
hide: PropTypes.func,
|
||||||
theme: PropTypes.string
|
theme: PropTypes.string
|
||||||
|
|
|
@ -18,13 +18,15 @@ const ListIcon = React.memo(({
|
||||||
theme,
|
theme,
|
||||||
name,
|
name,
|
||||||
color,
|
color,
|
||||||
style
|
style,
|
||||||
|
testID
|
||||||
}) => (
|
}) => (
|
||||||
<View style={[styles.icon, style]}>
|
<View style={[styles.icon, style]}>
|
||||||
<CustomIcon
|
<CustomIcon
|
||||||
name={name}
|
name={name}
|
||||||
color={color ?? themes[theme].auxiliaryText}
|
color={color ?? themes[theme].auxiliaryText}
|
||||||
size={ICON_SIZE}
|
size={ICON_SIZE}
|
||||||
|
testID={testID}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
));
|
));
|
||||||
|
@ -33,7 +35,8 @@ ListIcon.propTypes = {
|
||||||
theme: PropTypes.string,
|
theme: PropTypes.string,
|
||||||
name: PropTypes.string,
|
name: PropTypes.string,
|
||||||
color: PropTypes.string,
|
color: PropTypes.string,
|
||||||
style: PropTypes.object
|
style: PropTypes.object,
|
||||||
|
testID: PropTypes.string
|
||||||
};
|
};
|
||||||
|
|
||||||
ListIcon.displayName = 'List.Icon';
|
ListIcon.displayName = 'List.Icon';
|
||||||
|
|
|
@ -32,7 +32,7 @@ class RoomHeaderContainer extends Component {
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps) {
|
shouldComponentUpdate(nextProps) {
|
||||||
const {
|
const {
|
||||||
type, title, subtitle, status, statusText, connecting, connected, onPress, usersTyping, width, height
|
type, title, subtitle, status, statusText, connecting, connected, onPress, usersTyping, width, height, teamMain
|
||||||
} = this.props;
|
} = this.props;
|
||||||
if (nextProps.type !== type) {
|
if (nextProps.type !== type) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -67,6 +67,9 @@ class RoomHeaderContainer extends Component {
|
||||||
if (nextProps.onPress !== onPress) {
|
if (nextProps.onPress !== onPress) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (nextProps.teamMain !== teamMain) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
"error-delete-protected-role": "Cannot delete a protected role",
|
"error-delete-protected-role": "Cannot delete a protected role",
|
||||||
"error-department-not-found": "Department not found",
|
"error-department-not-found": "Department not found",
|
||||||
"error-direct-message-file-upload-not-allowed": "File sharing not allowed in direct messages",
|
"error-direct-message-file-upload-not-allowed": "File sharing not allowed in direct messages",
|
||||||
"error-duplicate-channel-name": "A channel with name {{channel_name}} exists",
|
"error-duplicate-channel-name": "A channel with name {{room_name}} exists",
|
||||||
"error-email-domain-blacklisted": "The email domain is blacklisted",
|
"error-email-domain-blacklisted": "The email domain is blacklisted",
|
||||||
"error-email-send-failed": "Error trying to send email: {{message}}",
|
"error-email-send-failed": "Error trying to send email: {{message}}",
|
||||||
"error-save-image": "Error while saving image",
|
"error-save-image": "Error while saving image",
|
||||||
|
@ -79,6 +79,7 @@
|
||||||
"error-user-registration-disabled": "User registration is disabled",
|
"error-user-registration-disabled": "User registration is disabled",
|
||||||
"error-user-registration-secret": "User registration is only allowed via Secret URL",
|
"error-user-registration-secret": "User registration is only allowed via Secret URL",
|
||||||
"error-you-are-last-owner": "You are the last owner. Please set new owner before leaving the room.",
|
"error-you-are-last-owner": "You are the last owner. Please set new owner before leaving the room.",
|
||||||
|
"error-status-not-allowed": "Invisible status is disabled",
|
||||||
"Actions": "Actions",
|
"Actions": "Actions",
|
||||||
"activity": "activity",
|
"activity": "activity",
|
||||||
"Activity": "Activity",
|
"Activity": "Activity",
|
||||||
|
@ -182,6 +183,7 @@
|
||||||
"delete": "delete",
|
"delete": "delete",
|
||||||
"Delete": "Delete",
|
"Delete": "Delete",
|
||||||
"DELETE": "DELETE",
|
"DELETE": "DELETE",
|
||||||
|
"move": "move",
|
||||||
"deleting_room": "deleting room",
|
"deleting_room": "deleting room",
|
||||||
"description": "description",
|
"description": "description",
|
||||||
"Description": "Description",
|
"Description": "Description",
|
||||||
|
@ -331,6 +333,7 @@
|
||||||
"My_servers": "My servers",
|
"My_servers": "My servers",
|
||||||
"N_people_reacted": "{{n}} people reacted",
|
"N_people_reacted": "{{n}} people reacted",
|
||||||
"N_users": "{{n}} users",
|
"N_users": "{{n}} users",
|
||||||
|
"N_channels": "{{n}} channels",
|
||||||
"name": "name",
|
"name": "name",
|
||||||
"Name": "Name",
|
"Name": "Name",
|
||||||
"Navigation_history": "Navigation history",
|
"Navigation_history": "Navigation history",
|
||||||
|
@ -731,6 +734,7 @@
|
||||||
"invalid-room": "Invalid room",
|
"invalid-room": "Invalid room",
|
||||||
"You_are_leaving_the_team": "You are leaving the team '{{team}}'",
|
"You_are_leaving_the_team": "You are leaving the team '{{team}}'",
|
||||||
"Leave_Team": "Leave Team",
|
"Leave_Team": "Leave Team",
|
||||||
|
"Select_Team": "Select Team",
|
||||||
"Select_Team_Channels": "Select the Team's channels you would like to leave.",
|
"Select_Team_Channels": "Select the Team's channels you would like to leave.",
|
||||||
"Cannot_leave": "Cannot leave",
|
"Cannot_leave": "Cannot leave",
|
||||||
"Cannot_remove": "Cannot remove",
|
"Cannot_remove": "Cannot remove",
|
||||||
|
@ -746,8 +750,15 @@
|
||||||
"Remove_Member": "Remove Member",
|
"Remove_Member": "Remove Member",
|
||||||
"leaving_team": "leaving team",
|
"leaving_team": "leaving team",
|
||||||
"removing_team": "removing from team",
|
"removing_team": "removing from team",
|
||||||
|
"moving_channel_to_team": "moving channel to team",
|
||||||
"deleting_team": "deleting team",
|
"deleting_team": "deleting team",
|
||||||
"member-does-not-exist": "Member does not exist",
|
"member-does-not-exist": "Member does not exist",
|
||||||
|
"Convert": "Convert",
|
||||||
|
"Convert_to_Team": "Convert to Team",
|
||||||
|
"Convert_to_Team_Warning": "This can't be undone. Once you convert a channel to a team, you can not turn it back to a channel.",
|
||||||
|
"Move_to_Team": "Move to Team",
|
||||||
|
"Move_Channel_Paragraph": "Moving a channel inside a team means that this channel will be added in the team’s context, however, all channel’s members, which are not members of the respective team, will still have access to this channel, but will not be added as team’s members. \n\nAll channel’s management will still be made by the owners of this channel.\n\nTeam’s members and even team’s owners, if not a member of this channel, can not have access to the channel’s content. \n\nPlease notice that the Team’s owner will be able remove members from the Channel.",
|
||||||
|
"Move_to_Team_Warning": "After reading the previous intructions about this behavior, do you still want to move this channel to the selected team?",
|
||||||
"Load_More": "Load More",
|
"Load_More": "Load More",
|
||||||
"Load_Newer": "Load Newer",
|
"Load_Newer": "Load Newer",
|
||||||
"Load_Older": "Load Older"
|
"Load_Older": "Load Older"
|
||||||
|
|
|
@ -75,6 +75,7 @@
|
||||||
"error-user-registration-disabled": "O registro do usuário está desativado",
|
"error-user-registration-disabled": "O registro do usuário está desativado",
|
||||||
"error-user-registration-secret": "O registro de usuário é permitido somente via URL secreta",
|
"error-user-registration-secret": "O registro de usuário é permitido somente via URL secreta",
|
||||||
"error-you-are-last-owner": "Você é o último proprietário da sala. Por favor defina um novo proprietário antes de sair.",
|
"error-you-are-last-owner": "Você é o último proprietário da sala. Por favor defina um novo proprietário antes de sair.",
|
||||||
|
"error-status-not-allowed": "O status invisível está desativado",
|
||||||
"Actions": "Ações",
|
"Actions": "Ações",
|
||||||
"activity": "atividade",
|
"activity": "atividade",
|
||||||
"Activity": "Atividade",
|
"Activity": "Atividade",
|
||||||
|
|
|
@ -17,6 +17,7 @@ const PERMISSIONS = [
|
||||||
'archive-room',
|
'archive-room',
|
||||||
'auto-translate',
|
'auto-translate',
|
||||||
'create-invite-links',
|
'create-invite-links',
|
||||||
|
'create-team',
|
||||||
'delete-c',
|
'delete-c',
|
||||||
'delete-message',
|
'delete-message',
|
||||||
'delete-p',
|
'delete-p',
|
||||||
|
|
|
@ -798,6 +798,24 @@ const RocketChat = {
|
||||||
// RC 3.13.0
|
// RC 3.13.0
|
||||||
return this.sdk.get('teams.listRoomsOfUser', { teamId, userId });
|
return this.sdk.get('teams.listRoomsOfUser', { teamId, userId });
|
||||||
},
|
},
|
||||||
|
getTeamInfo({ teamId }) {
|
||||||
|
// RC 3.13.0
|
||||||
|
return this.sdk.get('teams.info', { teamId });
|
||||||
|
},
|
||||||
|
convertChannelToTeam({ rid, name, type }) {
|
||||||
|
const params = {
|
||||||
|
...(type === 'c'
|
||||||
|
? {
|
||||||
|
channelId: rid,
|
||||||
|
channelName: name
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
roomId: rid,
|
||||||
|
roomName: name
|
||||||
|
})
|
||||||
|
};
|
||||||
|
return this.sdk.post(type === 'c' ? 'channels.convertToTeam' : 'groups.convertToTeam', params);
|
||||||
|
},
|
||||||
joinRoom(roomId, joinCode, type) {
|
joinRoom(roomId, joinCode, type) {
|
||||||
// TODO: join code
|
// TODO: join code
|
||||||
// RC 0.48.0
|
// RC 0.48.0
|
||||||
|
|
|
@ -18,7 +18,7 @@ const DirectoryItemLabel = React.memo(({ text, theme }) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const DirectoryItem = ({
|
const DirectoryItem = ({
|
||||||
title, description, avatar, onPress, testID, style, rightLabel, type, rid, theme
|
title, description, avatar, onPress, testID, style, rightLabel, type, rid, theme, teamMain
|
||||||
}) => (
|
}) => (
|
||||||
<Touch
|
<Touch
|
||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
|
@ -36,7 +36,7 @@ const DirectoryItem = ({
|
||||||
/>
|
/>
|
||||||
<View style={styles.directoryItemTextContainer}>
|
<View style={styles.directoryItemTextContainer}>
|
||||||
<View style={styles.directoryItemTextTitle}>
|
<View style={styles.directoryItemTextTitle}>
|
||||||
<RoomTypeIcon type={type} theme={theme} />
|
<RoomTypeIcon type={type} teamMain={teamMain} theme={theme} />
|
||||||
<Text style={[styles.directoryItemName, { color: themes[theme].titleText }]} numberOfLines={1}>{title}</Text>
|
<Text style={[styles.directoryItemName, { color: themes[theme].titleText }]} numberOfLines={1}>{title}</Text>
|
||||||
</View>
|
</View>
|
||||||
{ description ? <Text style={[styles.directoryItemUsername, { color: themes[theme].auxiliaryText }]} numberOfLines={1}>{description}</Text> : null }
|
{ description ? <Text style={[styles.directoryItemUsername, { color: themes[theme].auxiliaryText }]} numberOfLines={1}>{description}</Text> : null }
|
||||||
|
@ -56,7 +56,8 @@ DirectoryItem.propTypes = {
|
||||||
style: PropTypes.any,
|
style: PropTypes.any,
|
||||||
rightLabel: PropTypes.string,
|
rightLabel: PropTypes.string,
|
||||||
rid: PropTypes.string,
|
rid: PropTypes.string,
|
||||||
theme: PropTypes.string
|
theme: PropTypes.string,
|
||||||
|
teamMain: PropTypes.bool
|
||||||
};
|
};
|
||||||
|
|
||||||
DirectoryItemLabel.propTypes = {
|
DirectoryItemLabel.propTypes = {
|
||||||
|
|
|
@ -94,7 +94,7 @@ const RoomItem = ({
|
||||||
alert={alert}
|
alert={alert}
|
||||||
/>
|
/>
|
||||||
{
|
{
|
||||||
autoJoin ? <Tag name={I18n.t('Auto-join')} /> : null
|
autoJoin ? <Tag testID='auto-join-tag' name={I18n.t('Auto-join')} /> : null
|
||||||
}
|
}
|
||||||
<UpdatedAt
|
<UpdatedAt
|
||||||
date={date}
|
date={date}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { themes } from '../../constants/colors';
|
||||||
import { useTheme } from '../../theme';
|
import { useTheme } from '../../theme';
|
||||||
import styles from './styles';
|
import styles from './styles';
|
||||||
|
|
||||||
const Tag = React.memo(({ name }) => {
|
const Tag = React.memo(({ name, testID }) => {
|
||||||
const { theme } = useTheme();
|
const { theme } = useTheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -16,6 +16,7 @@ const Tag = React.memo(({ name }) => {
|
||||||
styles.tagText, { color: themes[theme].infoText }
|
styles.tagText, { color: themes[theme].infoText }
|
||||||
]}
|
]}
|
||||||
numberOfLines={1}
|
numberOfLines={1}
|
||||||
|
testID={testID}
|
||||||
>
|
>
|
||||||
{name}
|
{name}
|
||||||
</Text>
|
</Text>
|
||||||
|
@ -24,7 +25,8 @@ const Tag = React.memo(({ name }) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Tag.propTypes = {
|
Tag.propTypes = {
|
||||||
name: PropTypes.string
|
name: PropTypes.string,
|
||||||
|
testID: PropTypes.string
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Tag;
|
export default Tag;
|
||||||
|
|
|
@ -100,8 +100,8 @@ export default {
|
||||||
SELECTED_USERS_CREATE_GROUP_F: 'selected_users_create_group_f',
|
SELECTED_USERS_CREATE_GROUP_F: 'selected_users_create_group_f',
|
||||||
|
|
||||||
// ADD EXISTING CHANNEL VIEW
|
// ADD EXISTING CHANNEL VIEW
|
||||||
EXISTING_CHANNEL_ADD_CHANNEL: 'existing_channel_add_channel',
|
AEC_ADD_CHANNEL: 'aec_add_channel',
|
||||||
EXISTING_CHANNEL_REMOVE_CHANNEL: 'existing_channel_remove_channel',
|
AEC_REMOVE_CHANNEL: 'aec_remove_channel',
|
||||||
|
|
||||||
// CREATE CHANNEL VIEW
|
// CREATE CHANNEL VIEW
|
||||||
CR_CREATE: 'cr_create',
|
CR_CREATE: 'cr_create',
|
||||||
|
@ -255,6 +255,13 @@ export default {
|
||||||
RA_TOGGLE_BLOCK_USER_F: 'ra_toggle_block_user_f',
|
RA_TOGGLE_BLOCK_USER_F: 'ra_toggle_block_user_f',
|
||||||
RA_TOGGLE_ENCRYPTED: 'ra_toggle_encrypted',
|
RA_TOGGLE_ENCRYPTED: 'ra_toggle_encrypted',
|
||||||
RA_TOGGLE_ENCRYPTED_F: 'ra_toggle_encrypted_f',
|
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
|
// ROOM INFO VIEW
|
||||||
RI_GO_RI_EDIT: 'ri_go_ri_edit',
|
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_TOGGLE_ARCHIVE_F: 'ri_edit_toggle_archive_f',
|
||||||
RI_EDIT_DELETE: 'ri_edit_delete',
|
RI_EDIT_DELETE: 'ri_edit_delete',
|
||||||
RI_EDIT_DELETE_F: 'ri_edit_delete_f',
|
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
|
// JITSI MEET VIEW
|
||||||
JM_CONFERENCE_JOIN: 'jm_conference_join',
|
JM_CONFERENCE_JOIN: 'jm_conference_join',
|
||||||
|
@ -327,5 +336,9 @@ export default {
|
||||||
TC_SEARCH: 'tc_search',
|
TC_SEARCH: 'tc_search',
|
||||||
TC_CANCEL_SEARCH: 'tc_cancel_search',
|
TC_CANCEL_SEARCH: 'tc_cancel_search',
|
||||||
TC_GO_ACTIONS: 'tc_go_actions',
|
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'
|
||||||
};
|
};
|
||||||
|
|
|
@ -51,7 +51,7 @@ const AddChannelTeamView = ({
|
||||||
<List.Item
|
<List.Item
|
||||||
title='Add_Existing'
|
title='Add_Existing'
|
||||||
onPress={() => navigation.navigate('AddExistingChannelView', { teamId, teamChannels })}
|
onPress={() => navigation.navigate('AddExistingChannelView', { teamId, teamChannels })}
|
||||||
testID='add-channel-team-view-create-channel'
|
testID='add-channel-team-view-add-existing'
|
||||||
left={() => <List.Icon name='channel-public' />}
|
left={() => <List.Icon name='channel-public' />}
|
||||||
right={() => <List.Icon name='chevron-right' />}
|
right={() => <List.Icon name='chevron-right' />}
|
||||||
theme={theme}
|
theme={theme}
|
||||||
|
|
|
@ -61,7 +61,7 @@ class AddExistingChannelView extends React.Component {
|
||||||
|
|
||||||
options.headerRight = () => selected.length > 0 && (
|
options.headerRight = () => selected.length > 0 && (
|
||||||
<HeaderButton.Container>
|
<HeaderButton.Container>
|
||||||
<HeaderButton.Item title={I18n.t('Create')} onPress={this.submit} testID='add-existing-channel-view-submit' />
|
<HeaderButton.Item title={I18n.t('Next')} onPress={this.submit} testID='add-existing-channel-view-submit' />
|
||||||
</HeaderButton.Container>
|
</HeaderButton.Container>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -126,8 +126,8 @@ class AddExistingChannelView extends React.Component {
|
||||||
goRoom({ item: result, isMasterDetail });
|
goRoom({ item: result, isMasterDetail });
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showErrorAlert(I18n.t(e.data.error), I18n.t('Add_Existing_Channel'), () => {});
|
|
||||||
logEvent(events.CT_ADD_ROOM_TO_TEAM_F);
|
logEvent(events.CT_ADD_ROOM_TO_TEAM_F);
|
||||||
|
showErrorAlert(I18n.t(e.data.error), I18n.t('Add_Existing_Channel'), () => {});
|
||||||
this.setState({ loading: false });
|
this.setState({ loading: false });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,10 +151,10 @@ class AddExistingChannelView extends React.Component {
|
||||||
|
|
||||||
animateNextTransition();
|
animateNextTransition();
|
||||||
if (!this.isChecked(rid)) {
|
if (!this.isChecked(rid)) {
|
||||||
logEvent(events.EXISTING_CHANNEL_ADD_CHANNEL);
|
logEvent(events.AEC_ADD_CHANNEL);
|
||||||
this.setState({ selected: [...selected, rid] }, () => this.setHeader());
|
this.setState({ selected: [...selected, rid] }, () => this.setHeader());
|
||||||
} else {
|
} else {
|
||||||
logEvent(events.EXISTING_CHANNEL_REMOVE_CHANNEL);
|
logEvent(events.AEC_REMOVE_CHANNEL);
|
||||||
const filterSelected = selected.filter(el => el !== rid);
|
const filterSelected = selected.filter(el => el !== rid);
|
||||||
this.setState({ selected: filterSelected }, () => this.setHeader());
|
this.setState({ selected: filterSelected }, () => this.setHeader());
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ class AddExistingChannelView extends React.Component {
|
||||||
title={RocketChat.getRoomTitle(item)}
|
title={RocketChat.getRoomTitle(item)}
|
||||||
translateTitle={false}
|
translateTitle={false}
|
||||||
onPress={() => this.toggleChannel(item.rid)}
|
onPress={() => this.toggleChannel(item.rid)}
|
||||||
testID='add-existing-channel-view-item'
|
testID={`add-existing-channel-view-item-${ item.name }`}
|
||||||
left={() => <List.Icon name={icon} />}
|
left={() => <List.Icon name={icon} />}
|
||||||
right={() => (isChecked ? <List.Icon name='check' /> : null)}
|
right={() => (isChecked ? <List.Icon name='check' /> : null)}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -334,7 +334,7 @@ class CreateChannelView extends React.Component {
|
||||||
keyboardVerticalOffset={128}
|
keyboardVerticalOffset={128}
|
||||||
>
|
>
|
||||||
<StatusBar />
|
<StatusBar />
|
||||||
<SafeAreaView testID={isTeam ? 'create-team-view' : 'create-channel-view'}>
|
<SafeAreaView testID='create-channel-view'>
|
||||||
<ScrollView {...scrollPersistTaps}>
|
<ScrollView {...scrollPersistTaps}>
|
||||||
<View style={[sharedStyles.separatorVertical, { borderColor: themes[theme].separatorColor }]}>
|
<View style={[sharedStyles.separatorVertical, { borderColor: themes[theme].separatorColor }]}>
|
||||||
<TextInput
|
<TextInput
|
||||||
|
@ -345,7 +345,7 @@ class CreateChannelView extends React.Component {
|
||||||
onChangeText={this.onChangeText}
|
onChangeText={this.onChangeText}
|
||||||
placeholder={isTeam ? I18n.t('Team_Name') : I18n.t('Channel_Name')}
|
placeholder={isTeam ? I18n.t('Team_Name') : I18n.t('Channel_Name')}
|
||||||
returnKeyType='done'
|
returnKeyType='done'
|
||||||
testID={isTeam ? 'create-team-name' : 'create-channel-name'}
|
testID='create-channel-name'
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
autoCapitalize='none'
|
autoCapitalize='none'
|
||||||
theme={theme}
|
theme={theme}
|
||||||
|
|
|
@ -64,6 +64,11 @@ export default class DirectoryOptions extends PureComponent {
|
||||||
icon = 'channel-public';
|
icon = 'channel-public';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (itemType === 'teams') {
|
||||||
|
text = 'Teams';
|
||||||
|
icon = 'teams';
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Touch
|
<Touch
|
||||||
onPress={() => changeType(itemType)}
|
onPress={() => changeType(itemType)}
|
||||||
|
@ -106,6 +111,7 @@ export default class DirectoryOptions extends PureComponent {
|
||||||
</Touch>
|
</Touch>
|
||||||
{this.renderItem('channels')}
|
{this.renderItem('channels')}
|
||||||
{this.renderItem('users')}
|
{this.renderItem('users')}
|
||||||
|
{this.renderItem('teams')}
|
||||||
{isFederationEnabled
|
{isFederationEnabled
|
||||||
? (
|
? (
|
||||||
<>
|
<>
|
||||||
|
|
|
@ -121,6 +121,8 @@ class DirectoryView extends React.Component {
|
||||||
logEvent(events.DIRECTORY_SEARCH_USERS);
|
logEvent(events.DIRECTORY_SEARCH_USERS);
|
||||||
} else if (type === 'channels') {
|
} else if (type === 'channels') {
|
||||||
logEvent(events.DIRECTORY_SEARCH_CHANNELS);
|
logEvent(events.DIRECTORY_SEARCH_CHANNELS);
|
||||||
|
} else if (type === 'teams') {
|
||||||
|
logEvent(events.DIRECTORY_SEARCH_TEAMS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,17 +151,34 @@ class DirectoryView extends React.Component {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
this.goRoom({ rid: result.room._id, name: item.username, t: 'd' });
|
this.goRoom({ rid: result.room._id, name: item.username, t: 'd' });
|
||||||
}
|
}
|
||||||
} else {
|
} else if (['p', 'c'].includes(item.t) && !item.teamMain) {
|
||||||
const { room } = await RocketChat.getRoomInfo(item._id);
|
const { room } = await RocketChat.getRoomInfo(item._id);
|
||||||
this.goRoom({
|
this.goRoom({
|
||||||
rid: item._id, name: item.name, joinCodeRequired: room.joinCodeRequired, t: 'c', search: true
|
rid: item._id, name: item.name, joinCodeRequired: room.joinCodeRequired, t: 'c', search: true
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
this.goRoom({
|
||||||
|
rid: item._id, name: item.name, t: item.t, search: true, teamMain: item.teamMain, teamId: item.teamId
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderHeader = () => {
|
renderHeader = () => {
|
||||||
const { type } = this.state;
|
const { type } = this.state;
|
||||||
const { theme } = this.props;
|
const { theme } = this.props;
|
||||||
|
let text = 'Users';
|
||||||
|
let icon = 'user';
|
||||||
|
|
||||||
|
if (type === 'channels') {
|
||||||
|
text = 'Channels';
|
||||||
|
icon = 'channel-public';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === 'teams') {
|
||||||
|
text = 'Teams';
|
||||||
|
icon = 'teams';
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<SearchBox
|
<SearchBox
|
||||||
|
@ -174,8 +193,8 @@ class DirectoryView extends React.Component {
|
||||||
theme={theme}
|
theme={theme}
|
||||||
>
|
>
|
||||||
<View style={[sharedStyles.separatorVertical, styles.toggleDropdownContainer, { borderColor: themes[theme].separatorColor }]}>
|
<View style={[sharedStyles.separatorVertical, styles.toggleDropdownContainer, { borderColor: themes[theme].separatorColor }]}>
|
||||||
<CustomIcon style={[styles.toggleDropdownIcon, { color: themes[theme].tintColor }]} size={20} name={type === 'users' ? 'user' : 'channel-public'} />
|
<CustomIcon style={[styles.toggleDropdownIcon, { color: themes[theme].tintColor }]} size={20} name={icon} />
|
||||||
<Text style={[styles.toggleDropdownText, { color: themes[theme].tintColor }]}>{type === 'users' ? I18n.t('Users') : I18n.t('Channels')}</Text>
|
<Text style={[styles.toggleDropdownText, { color: themes[theme].tintColor }]}>{I18n.t(text)}</Text>
|
||||||
<CustomIcon name='chevron-down' size={20} style={[styles.toggleDropdownArrow, { color: themes[theme].auxiliaryTintColor }]} />
|
<CustomIcon name='chevron-down' size={20} style={[styles.toggleDropdownArrow, { color: themes[theme].auxiliaryTintColor }]} />
|
||||||
</View>
|
</View>
|
||||||
</Touch>
|
</Touch>
|
||||||
|
@ -217,12 +236,25 @@ class DirectoryView extends React.Component {
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type === 'teams') {
|
||||||
|
return (
|
||||||
|
<DirectoryItem
|
||||||
|
avatar={item.name}
|
||||||
|
description={item.name}
|
||||||
|
rightLabel={I18n.t('N_channels', { n: item.roomsCount })}
|
||||||
|
type={item.t}
|
||||||
|
teamMain={item.teamMain}
|
||||||
|
{...commonProps}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<DirectoryItem
|
<DirectoryItem
|
||||||
avatar={item.name}
|
avatar={item.name}
|
||||||
description={item.topic}
|
description={item.topic}
|
||||||
rightLabel={I18n.t('N_users', { n: item.usersCount })}
|
rightLabel={I18n.t('N_users', { n: item.usersCount })}
|
||||||
type='c'
|
type={item.t}
|
||||||
{...commonProps}
|
{...commonProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
@ -5,8 +5,9 @@ import {
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import isEmpty from 'lodash/isEmpty';
|
import isEmpty from 'lodash/isEmpty';
|
||||||
import { compareServerVersion, methods } from '../../lib/utils';
|
import { Q } from '@nozbe/watermelondb';
|
||||||
|
|
||||||
|
import { compareServerVersion, methods } from '../../lib/utils';
|
||||||
import Touch from '../../utils/touch';
|
import Touch from '../../utils/touch';
|
||||||
import { setLoading as setLoadingAction } from '../../actions/selectedUsers';
|
import { setLoading as setLoadingAction } from '../../actions/selectedUsers';
|
||||||
import { leaveRoom as leaveRoomAction, closeRoom as closeRoomAction } from '../../actions/room';
|
import { leaveRoom as leaveRoomAction, closeRoom as closeRoomAction } from '../../actions/room';
|
||||||
|
@ -61,7 +62,9 @@ class RoomActionsView extends React.Component {
|
||||||
editRoomPermission: PropTypes.array,
|
editRoomPermission: PropTypes.array,
|
||||||
toggleRoomE2EEncryptionPermission: PropTypes.array,
|
toggleRoomE2EEncryptionPermission: PropTypes.array,
|
||||||
viewBroadcastMemberListPermission: PropTypes.array,
|
viewBroadcastMemberListPermission: PropTypes.array,
|
||||||
transferLivechatGuestPermission: PropTypes.array
|
transferLivechatGuestPermission: PropTypes.array,
|
||||||
|
createTeamPermission: PropTypes.array,
|
||||||
|
addTeamChannelPermission: PropTypes.array
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -83,7 +86,9 @@ class RoomActionsView extends React.Component {
|
||||||
canForwardGuest: false,
|
canForwardGuest: false,
|
||||||
canReturnQueue: false,
|
canReturnQueue: false,
|
||||||
canEdit: false,
|
canEdit: false,
|
||||||
canToggleEncryption: false
|
canToggleEncryption: false,
|
||||||
|
canCreateTeam: false,
|
||||||
|
canAddChannelToTeam: false
|
||||||
};
|
};
|
||||||
if (room && room.observe && room.rid) {
|
if (room && room.observe && room.rid) {
|
||||||
this.roomObservable = room.observe();
|
this.roomObservable = room.observe();
|
||||||
|
@ -132,9 +137,11 @@ class RoomActionsView extends React.Component {
|
||||||
const canEdit = await this.canEdit();
|
const canEdit = await this.canEdit();
|
||||||
const canToggleEncryption = await this.canToggleEncryption();
|
const canToggleEncryption = await this.canToggleEncryption();
|
||||||
const canViewMembers = await this.canViewMembers();
|
const canViewMembers = await this.canViewMembers();
|
||||||
|
const canCreateTeam = await this.canCreateTeam();
|
||||||
|
const canAddChannelToTeam = await this.canAddChannelToTeam();
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
canAutoTranslate, canAddUser, canInviteUser, canEdit, canToggleEncryption, canViewMembers
|
canAutoTranslate, canAddUser, canInviteUser, canEdit, canToggleEncryption, canViewMembers, canCreateTeam, canAddChannelToTeam
|
||||||
});
|
});
|
||||||
|
|
||||||
// livechat permissions
|
// livechat permissions
|
||||||
|
@ -210,6 +217,26 @@ class RoomActionsView extends React.Component {
|
||||||
return canEdit;
|
return canEdit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
canCreateTeam = async() => {
|
||||||
|
const { room } = this.state;
|
||||||
|
const { createTeamPermission } = this.props;
|
||||||
|
const { rid } = room;
|
||||||
|
const permissions = await RocketChat.hasPermission([createTeamPermission], rid);
|
||||||
|
|
||||||
|
const canCreateTeam = permissions[0];
|
||||||
|
return canCreateTeam;
|
||||||
|
}
|
||||||
|
|
||||||
|
canAddChannelToTeam = async() => {
|
||||||
|
const { room } = this.state;
|
||||||
|
const { addTeamChannelPermission } = this.props;
|
||||||
|
const { rid } = room;
|
||||||
|
const permissions = await RocketChat.hasPermission([addTeamChannelPermission], rid);
|
||||||
|
|
||||||
|
const canAddChannelToTeam = permissions[0];
|
||||||
|
return canAddChannelToTeam;
|
||||||
|
}
|
||||||
|
|
||||||
canToggleEncryption = async() => {
|
canToggleEncryption = async() => {
|
||||||
const { room } = this.state;
|
const { room } = this.state;
|
||||||
const { toggleRoomE2EEncryptionPermission } = this.props;
|
const { toggleRoomE2EEncryptionPermission } = this.props;
|
||||||
|
@ -404,6 +431,7 @@ class RoomActionsView extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleLeaveTeam = async(selected) => {
|
handleLeaveTeam = async(selected) => {
|
||||||
|
logEvent(events.RA_LEAVE_TEAM);
|
||||||
try {
|
try {
|
||||||
const { room } = this.state;
|
const { room } = this.state;
|
||||||
const { navigation, isMasterDetail } = this.props;
|
const { navigation, isMasterDetail } = this.props;
|
||||||
|
@ -417,6 +445,7 @@ class RoomActionsView extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
logEvent(events.RA_LEAVE_TEAM_F);
|
||||||
log(e);
|
log(e);
|
||||||
showErrorAlert(
|
showErrorAlert(
|
||||||
e.data.error
|
e.data.error
|
||||||
|
@ -432,11 +461,16 @@ class RoomActionsView extends React.Component {
|
||||||
const { navigation } = this.props;
|
const { navigation } = this.props;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await RocketChat.teamListRoomsOfUser({ teamId: room.teamId, userId: room.u._id });
|
const db = database.active;
|
||||||
|
const subCollection = db.get('subscriptions');
|
||||||
|
const rooms = await subCollection.query(
|
||||||
|
Q.where('team_id', Q.eq(room.teamId)),
|
||||||
|
Q.where('team_main', Q.notEq(true))
|
||||||
|
);
|
||||||
|
|
||||||
if (result.rooms?.length) {
|
if (rooms.length) {
|
||||||
const teamChannels = result.rooms.map(r => ({
|
const teamChannels = rooms.map(r => ({
|
||||||
rid: r._id,
|
rid: r.id,
|
||||||
name: r.name,
|
name: r.name,
|
||||||
teamId: r.teamId,
|
teamId: r.teamId,
|
||||||
alert: r.isLastOwner
|
alert: r.isLastOwner
|
||||||
|
@ -464,6 +498,120 @@ class RoomActionsView extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleConvertToTeam = async() => {
|
||||||
|
logEvent(events.RA_CONVERT_TO_TEAM);
|
||||||
|
try {
|
||||||
|
const { room } = this.state;
|
||||||
|
const { navigation } = this.props;
|
||||||
|
const result = await RocketChat.convertChannelToTeam({ rid: room.rid, name: room.name, type: room.t });
|
||||||
|
|
||||||
|
if (result.success) {
|
||||||
|
navigation.navigate('RoomView');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
logEvent(events.RA_CONVERT_TO_TEAM_F);
|
||||||
|
log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
convertToTeam = () => {
|
||||||
|
showConfirmationAlert({
|
||||||
|
title: I18n.t('Confirmation'),
|
||||||
|
message: I18n.t('Convert_to_Team_Warning'),
|
||||||
|
confirmationText: I18n.t('Convert'),
|
||||||
|
onPress: () => this.handleConvertToTeam()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
handleMoveToTeam = async(selected) => {
|
||||||
|
logEvent(events.RA_MOVE_TO_TEAM);
|
||||||
|
try {
|
||||||
|
const { room } = this.state;
|
||||||
|
const { navigation } = this.props;
|
||||||
|
const result = await RocketChat.addRoomsToTeam({ teamId: selected?.[0], rooms: [room.rid] });
|
||||||
|
if (result.success) {
|
||||||
|
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') }));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
moveToTeam = async() => {
|
||||||
|
try {
|
||||||
|
const { navigation } = this.props;
|
||||||
|
const db = database.active;
|
||||||
|
const subCollection = db.get('subscriptions');
|
||||||
|
const teamRooms = await subCollection.query(
|
||||||
|
Q.where('team_main', Q.notEq(null))
|
||||||
|
);
|
||||||
|
|
||||||
|
if (teamRooms.length) {
|
||||||
|
const data = teamRooms.map(team => ({
|
||||||
|
rid: team.teamId,
|
||||||
|
t: team.t,
|
||||||
|
name: team.name
|
||||||
|
}));
|
||||||
|
navigation.navigate('SelectListView', {
|
||||||
|
title: 'Move_to_Team',
|
||||||
|
infoText: 'Move_Channel_Paragraph',
|
||||||
|
nextAction: () => {
|
||||||
|
navigation.push('SelectListView', {
|
||||||
|
title: 'Select_Team',
|
||||||
|
data,
|
||||||
|
isRadio: true,
|
||||||
|
isSearch: true,
|
||||||
|
onSearch: onChangeText => this.searchTeam(onChangeText),
|
||||||
|
nextAction: selected => showConfirmationAlert({
|
||||||
|
title: I18n.t('Confirmation'),
|
||||||
|
message: I18n.t('Move_to_Team_Warning'),
|
||||||
|
confirmationText: I18n.t('Yes_action_it', { action: I18n.t('move') }),
|
||||||
|
onPress: () => this.handleMoveToTeam(selected)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
searchTeam = async(onChangeText) => {
|
||||||
|
logEvent(events.RA_SEARCH_TEAM);
|
||||||
|
try {
|
||||||
|
const { addTeamChannelPermission, createTeamPermission } = this.props;
|
||||||
|
const QUERY_SIZE = 50;
|
||||||
|
const db = database.active;
|
||||||
|
const teams = await db.collections
|
||||||
|
.get('subscriptions')
|
||||||
|
.query(
|
||||||
|
Q.where('team_main', Q.notEq(null)),
|
||||||
|
Q.where('name', Q.like(`%${ onChangeText }%`)),
|
||||||
|
Q.experimentalTake(QUERY_SIZE),
|
||||||
|
Q.experimentalSortBy('room_updated_at', Q.desc)
|
||||||
|
);
|
||||||
|
|
||||||
|
const asyncFilter = async(teamArray) => {
|
||||||
|
const results = await Promise.all(teamArray.map(async(team) => {
|
||||||
|
const permissions = await RocketChat.hasPermission([addTeamChannelPermission, createTeamPermission], team.rid);
|
||||||
|
if (!permissions[0]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}));
|
||||||
|
|
||||||
|
return teamArray.filter((_v, index) => results[index]);
|
||||||
|
};
|
||||||
|
const teamsFiltered = await asyncFilter(teams);
|
||||||
|
return teamsFiltered;
|
||||||
|
} catch (e) {
|
||||||
|
log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
renderRoomInfo = () => {
|
renderRoomInfo = () => {
|
||||||
const { room, member } = this.state;
|
const { room, member } = this.state;
|
||||||
const {
|
const {
|
||||||
|
@ -538,7 +686,7 @@ class RoomActionsView extends React.Component {
|
||||||
renderJitsi = () => {
|
renderJitsi = () => {
|
||||||
const { room } = this.state;
|
const { room } = this.state;
|
||||||
const { jitsiEnabled } = this.props;
|
const { jitsiEnabled } = this.props;
|
||||||
if (!jitsiEnabled) {
|
if (!jitsiEnabled || room.teamMain) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
@ -635,6 +783,50 @@ class RoomActionsView extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
teamChannelActions = (t, room) => {
|
||||||
|
const { canEdit, canCreateTeam, canAddChannelToTeam } = this.state;
|
||||||
|
const canConvertToTeam = canEdit && canCreateTeam && !room.teamMain;
|
||||||
|
const canMoveToTeam = canEdit && canAddChannelToTeam && !room.teamId;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{['c', 'p'].includes(t) && canConvertToTeam
|
||||||
|
? (
|
||||||
|
<>
|
||||||
|
<List.Item
|
||||||
|
title='Convert_to_Team'
|
||||||
|
onPress={() => this.onPressTouchable({
|
||||||
|
event: this.convertToTeam
|
||||||
|
})}
|
||||||
|
testID='room-actions-convert-to-team'
|
||||||
|
left={() => <List.Icon name='teams' />}
|
||||||
|
showActionIndicator
|
||||||
|
/>
|
||||||
|
<List.Separator />
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
: null}
|
||||||
|
|
||||||
|
{['c', 'p'].includes(t) && canMoveToTeam
|
||||||
|
? (
|
||||||
|
<>
|
||||||
|
<List.Item
|
||||||
|
title='Move_to_Team'
|
||||||
|
onPress={() => this.onPressTouchable({
|
||||||
|
event: this.moveToTeam
|
||||||
|
})}
|
||||||
|
testID='room-actions-move-to-team'
|
||||||
|
left={() => <List.Icon name='channel-move-to-team' />}
|
||||||
|
showActionIndicator
|
||||||
|
/>
|
||||||
|
<List.Separator />
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
: null}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
room, membersCount, canViewMembers, canAddUser, canInviteUser, joined, canAutoTranslate, canForwardGuest, canReturnQueue
|
room, membersCount, canViewMembers, canAddUser, canInviteUser, joined, canAutoTranslate, canForwardGuest, canReturnQueue
|
||||||
|
@ -836,6 +1028,8 @@ class RoomActionsView extends React.Component {
|
||||||
)
|
)
|
||||||
: null}
|
: null}
|
||||||
|
|
||||||
|
{ this.teamChannelActions(t, room) }
|
||||||
|
|
||||||
{['l'].includes(t) && !this.isOmnichannelPreview
|
{['l'].includes(t) && !this.isOmnichannelPreview
|
||||||
? (
|
? (
|
||||||
<>
|
<>
|
||||||
|
@ -922,7 +1116,9 @@ const mapStateToProps = state => ({
|
||||||
editRoomPermission: state.permissions['edit-room'],
|
editRoomPermission: state.permissions['edit-room'],
|
||||||
toggleRoomE2EEncryptionPermission: state.permissions['toggle-room-e2e-encryption'],
|
toggleRoomE2EEncryptionPermission: state.permissions['toggle-room-e2e-encryption'],
|
||||||
viewBroadcastMemberListPermission: state.permissions['view-broadcast-member-list'],
|
viewBroadcastMemberListPermission: state.permissions['view-broadcast-member-list'],
|
||||||
transferLivechatGuestPermission: state.permissions['transfer-livechat-guest']
|
transferLivechatGuestPermission: state.permissions['transfer-livechat-guest'],
|
||||||
|
createTeamPermission: state.permissions['create-team'],
|
||||||
|
addTeamChannelPermission: state.permissions['add-team-channel']
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => ({
|
const mapDispatchToProps = dispatch => ({
|
||||||
|
|
|
@ -293,6 +293,7 @@ class RoomInfoEditView extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleDeleteTeam = async(selected) => {
|
handleDeleteTeam = async(selected) => {
|
||||||
|
logEvent(events.RI_EDIT_DELETE_TEAM);
|
||||||
const { navigation, isMasterDetail } = this.props;
|
const { navigation, isMasterDetail } = this.props;
|
||||||
const { room } = this.state;
|
const { room } = this.state;
|
||||||
try {
|
try {
|
||||||
|
@ -305,6 +306,7 @@ class RoomInfoEditView extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
logEvent(events.RI_EDIT_DELETE_TEAM_F);
|
||||||
log(e);
|
log(e);
|
||||||
showErrorAlert(
|
showErrorAlert(
|
||||||
e.data.error
|
e.data.error
|
||||||
|
|
|
@ -265,7 +265,8 @@ class RoomMembersView extends React.Component {
|
||||||
options.push({
|
options.push({
|
||||||
icon: 'ignore',
|
icon: 'ignore',
|
||||||
title: I18n.t(isIgnored ? 'Unignore' : 'Ignore'),
|
title: I18n.t(isIgnored ? 'Unignore' : 'Ignore'),
|
||||||
onPress: () => this.handleIgnore(selectedUser, !isIgnored)
|
onPress: () => this.handleIgnore(selectedUser, !isIgnored),
|
||||||
|
testID: 'action-sheet-ignore-user'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,7 +285,8 @@ class RoomMembersView extends React.Component {
|
||||||
confirmationText: I18n.t(userIsMuted ? 'Unmute' : 'Mute'),
|
confirmationText: I18n.t(userIsMuted ? 'Unmute' : 'Mute'),
|
||||||
onPress: () => this.handleMute(selectedUser)
|
onPress: () => this.handleMute(selectedUser)
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
testID: 'action-sheet-mute-user'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,7 +298,8 @@ class RoomMembersView extends React.Component {
|
||||||
icon: 'shield-check',
|
icon: 'shield-check',
|
||||||
title: I18n.t('Owner'),
|
title: I18n.t('Owner'),
|
||||||
onPress: () => this.handleOwner(selectedUser, !isOwner),
|
onPress: () => this.handleOwner(selectedUser, !isOwner),
|
||||||
right: () => <CustomIcon name={isOwner ? 'checkbox-checked' : 'checkbox-unchecked'} size={20} color={isOwner ? themes[theme].tintActive : themes[theme].auxiliaryTintColor} />
|
right: () => <CustomIcon testID={isOwner ? 'action-sheet-set-owner-checked' : 'action-sheet-set-owner-unchecked'} name={isOwner ? 'checkbox-checked' : 'checkbox-unchecked'} size={20} color={isOwner ? themes[theme].tintActive : themes[theme].auxiliaryTintColor} />,
|
||||||
|
testID: 'action-sheet-set-owner'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +311,8 @@ class RoomMembersView extends React.Component {
|
||||||
icon: 'shield-alt',
|
icon: 'shield-alt',
|
||||||
title: I18n.t('Leader'),
|
title: I18n.t('Leader'),
|
||||||
onPress: () => this.handleLeader(selectedUser, !isLeader),
|
onPress: () => this.handleLeader(selectedUser, !isLeader),
|
||||||
right: () => <CustomIcon name={isLeader ? 'checkbox-checked' : 'checkbox-unchecked'} size={20} color={isLeader ? themes[theme].tintActive : themes[theme].auxiliaryTintColor} />
|
right: () => <CustomIcon testID={isLeader ? 'action-sheet-set-leader-checked' : 'action-sheet-set-leader-unchecked'} name={isLeader ? 'checkbox-checked' : 'checkbox-unchecked'} size={20} color={isLeader ? themes[theme].tintActive : themes[theme].auxiliaryTintColor} />,
|
||||||
|
testID: 'action-sheet-set-leader'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,7 +324,8 @@ class RoomMembersView extends React.Component {
|
||||||
icon: 'shield',
|
icon: 'shield',
|
||||||
title: I18n.t('Moderator'),
|
title: I18n.t('Moderator'),
|
||||||
onPress: () => this.handleModerator(selectedUser, !isModerator),
|
onPress: () => this.handleModerator(selectedUser, !isModerator),
|
||||||
right: () => <CustomIcon name={isModerator ? 'checkbox-checked' : 'checkbox-unchecked'} size={20} color={isModerator ? themes[theme].tintActive : themes[theme].auxiliaryTintColor} />
|
right: () => <CustomIcon testID={isModerator ? 'action-sheet-set-moderator-checked' : 'action-sheet-set-moderator-unchecked'} name={isModerator ? 'checkbox-checked' : 'checkbox-unchecked'} size={20} color={isModerator ? themes[theme].tintActive : themes[theme].auxiliaryTintColor} />,
|
||||||
|
testID: 'action-sheet-set-moderator'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,7 +335,8 @@ class RoomMembersView extends React.Component {
|
||||||
icon: 'logout',
|
icon: 'logout',
|
||||||
danger: true,
|
danger: true,
|
||||||
title: I18n.t('Remove_from_Team'),
|
title: I18n.t('Remove_from_Team'),
|
||||||
onPress: () => this.handleRemoveFromTeam(selectedUser)
|
onPress: () => this.handleRemoveFromTeam(selectedUser),
|
||||||
|
testID: 'action-sheet-remove-from-team'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,7 +352,8 @@ class RoomMembersView extends React.Component {
|
||||||
confirmationText: I18n.t('Yes_remove_user'),
|
confirmationText: I18n.t('Yes_remove_user'),
|
||||||
onPress: () => this.handleRemoveUserFromRoom(selectedUser)
|
onPress: () => this.handleRemoveUserFromRoom(selectedUser)
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
testID: 'action-sheet-remove-from-room'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,10 @@ class RightButtonsContainer extends Component {
|
||||||
const {
|
const {
|
||||||
isFollowingThread, tunread, tunreadUser, tunreadGroup
|
isFollowingThread, tunread, tunreadUser, tunreadGroup
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
const { teamId } = this.props;
|
||||||
|
if (nextProps.teamId !== teamId) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (nextState.isFollowingThread !== isFollowingThread) {
|
if (nextState.isFollowingThread !== isFollowingThread) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ const stateAttrsUpdate = [
|
||||||
'member',
|
'member',
|
||||||
'showingBlockingLoader'
|
'showingBlockingLoader'
|
||||||
];
|
];
|
||||||
const roomAttrsUpdate = ['f', 'ro', 'blocked', 'blocker', 'archived', 'tunread', 'muted', 'ignored', 'jitsiTimeout', 'announcement', 'sysMes', 'topic', 'name', 'fname', 'roles', 'bannerClosed', 'visitor', 'joinCodeRequired'];
|
const roomAttrsUpdate = ['f', 'ro', 'blocked', 'blocker', 'archived', 'tunread', 'muted', 'ignored', 'jitsiTimeout', 'announcement', 'sysMes', 'topic', 'name', 'fname', 'roles', 'bannerClosed', 'visitor', 'joinCodeRequired', 'teamMain', 'teamId'];
|
||||||
|
|
||||||
class RoomView extends React.Component {
|
class RoomView extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
@ -254,7 +254,10 @@ class RoomView extends React.Component {
|
||||||
this.setHeader();
|
this.setHeader();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (((roomUpdate.fname !== prevState.roomUpdate.fname) || (roomUpdate.name !== prevState.roomUpdate.name)) && !this.tmid) {
|
if ((roomUpdate.teamMain !== prevState.roomUpdate.teamMain) || (roomUpdate.teamId !== prevState.roomUpdate.teamId)) {
|
||||||
|
this.setHeader();
|
||||||
|
}
|
||||||
|
if (((roomUpdate.fname !== prevState.roomUpdate.fname) || (roomUpdate.name !== prevState.roomUpdate.name) || (roomUpdate.teamMain !== prevState.roomUpdate.teamMain) || (roomUpdate.teamId !== prevState.roomUpdate.teamId)) && !this.tmid) {
|
||||||
this.setHeader();
|
this.setHeader();
|
||||||
}
|
}
|
||||||
if (insets.left !== prevProps.insets.left || insets.right !== prevProps.insets.right) {
|
if (insets.left !== prevProps.insets.left || insets.right !== prevProps.insets.right) {
|
||||||
|
|
|
@ -4,7 +4,9 @@ import {
|
||||||
View, StyleSheet, FlatList, Text
|
View, StyleSheet, FlatList, Text
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
import { RadioButton } from 'react-native-ui-lib';
|
||||||
|
|
||||||
|
import log from '../utils/log';
|
||||||
import * as List from '../containers/List';
|
import * as List from '../containers/List';
|
||||||
import sharedStyles from './Styles';
|
import sharedStyles from './Styles';
|
||||||
import I18n from '../i18n';
|
import I18n from '../i18n';
|
||||||
|
@ -14,6 +16,9 @@ import { themes } from '../constants/colors';
|
||||||
import { withTheme } from '../theme';
|
import { withTheme } from '../theme';
|
||||||
import SafeAreaView from '../containers/SafeAreaView';
|
import SafeAreaView from '../containers/SafeAreaView';
|
||||||
import { animateNextTransition } from '../utils/layoutAnimation';
|
import { animateNextTransition } from '../utils/layoutAnimation';
|
||||||
|
import { ICON_SIZE } from '../containers/List/constants';
|
||||||
|
import SearchBox from '../containers/SearchBox';
|
||||||
|
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
buttonText: {
|
buttonText: {
|
||||||
|
@ -38,8 +43,13 @@ class SelectListView extends React.Component {
|
||||||
this.infoText = props.route?.params?.infoText;
|
this.infoText = props.route?.params?.infoText;
|
||||||
this.nextAction = props.route?.params?.nextAction;
|
this.nextAction = props.route?.params?.nextAction;
|
||||||
this.showAlert = props.route?.params?.showAlert;
|
this.showAlert = props.route?.params?.showAlert;
|
||||||
|
this.isSearch = props.route?.params?.isSearch;
|
||||||
|
this.onSearch = props.route?.params?.onSearch;
|
||||||
|
this.isRadio = props.route?.params?.isRadio;
|
||||||
this.state = {
|
this.state = {
|
||||||
data,
|
data,
|
||||||
|
dataFiltered: [],
|
||||||
|
isSearching: false,
|
||||||
selected: []
|
selected: []
|
||||||
};
|
};
|
||||||
this.setHeader();
|
this.setHeader();
|
||||||
|
@ -75,6 +85,25 @@ class SelectListView extends React.Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderSearch = () => {
|
||||||
|
const { theme } = this.props;
|
||||||
|
return (
|
||||||
|
<View style={{ backgroundColor: themes[theme].auxiliaryBackground }}>
|
||||||
|
<SearchBox onChangeText={text => this.search(text)} testID='select-list-view-search' onCancelPress={() => this.setState({ isSearching: false })} />
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
search = async(text) => {
|
||||||
|
try {
|
||||||
|
this.setState({ isSearching: true });
|
||||||
|
const result = await this.onSearch(text);
|
||||||
|
this.setState({ dataFiltered: result });
|
||||||
|
} catch (e) {
|
||||||
|
log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
isChecked = (rid) => {
|
isChecked = (rid) => {
|
||||||
const { selected } = this.state;
|
const { selected } = this.state;
|
||||||
return selected.includes(rid);
|
return selected.includes(rid);
|
||||||
|
@ -84,7 +113,11 @@ class SelectListView extends React.Component {
|
||||||
const { selected } = this.state;
|
const { selected } = this.state;
|
||||||
|
|
||||||
animateNextTransition();
|
animateNextTransition();
|
||||||
|
if (this.isRadio) {
|
||||||
if (!this.isChecked(rid)) {
|
if (!this.isChecked(rid)) {
|
||||||
|
this.setState({ selected: [rid] }, () => this.setHeader());
|
||||||
|
}
|
||||||
|
} else if (!this.isChecked(rid)) {
|
||||||
this.setState({ selected: [...selected, rid] }, () => this.setHeader());
|
this.setState({ selected: [...selected, rid] }, () => this.setHeader());
|
||||||
} else {
|
} else {
|
||||||
const filterSelected = selected.filter(el => el !== rid);
|
const filterSelected = selected.filter(el => el !== rid);
|
||||||
|
@ -94,9 +127,16 @@ class SelectListView extends React.Component {
|
||||||
|
|
||||||
renderItem = ({ item }) => {
|
renderItem = ({ item }) => {
|
||||||
const { theme } = this.props;
|
const { theme } = this.props;
|
||||||
const icon = item.t === 'p' ? 'channel-private' : 'channel-public';
|
const { selected } = this.state;
|
||||||
|
|
||||||
|
const channelIcon = item.t === 'p' ? 'channel-private' : 'channel-public';
|
||||||
|
const teamIcon = item.t === 'p' ? 'teams-private' : 'teams';
|
||||||
|
const icon = item.teamMain ? teamIcon : channelIcon;
|
||||||
const checked = this.isChecked(item.rid) ? 'check' : null;
|
const checked = this.isChecked(item.rid) ? 'check' : null;
|
||||||
|
|
||||||
|
const showRadio = () => <RadioButton testID={selected ? `radio-button-selected-${ item.name }` : `radio-button-unselected-${ item.name }`} selected={selected.includes(item.rid)} color={themes[theme].actionTintColor} size={ICON_SIZE} />;
|
||||||
|
const showCheck = () => <List.Icon testID={checked ? `${ item.name }-checked` : `${ item.name }-unchecked`} name={checked} color={themes[theme].actionTintColor} />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<List.Separator />
|
<List.Separator />
|
||||||
|
@ -107,25 +147,24 @@ class SelectListView extends React.Component {
|
||||||
onPress={() => (item.alert ? this.showAlert() : this.toggleItem(item.rid))}
|
onPress={() => (item.alert ? this.showAlert() : this.toggleItem(item.rid))}
|
||||||
alert={item.alert}
|
alert={item.alert}
|
||||||
left={() => <List.Icon name={icon} color={themes[theme].controlText} />}
|
left={() => <List.Icon name={icon} color={themes[theme].controlText} />}
|
||||||
right={() => (checked ? <List.Icon name={checked} color={themes[theme].actionTintColor} /> : null)}
|
right={() => (this.isRadio ? showRadio() : showCheck())}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { data } = this.state;
|
const { data, isSearching, dataFiltered } = this.state;
|
||||||
const { theme } = this.props;
|
const { theme } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView testID='select-list-view'>
|
<SafeAreaView testID='select-list-view'>
|
||||||
<StatusBar />
|
<StatusBar />
|
||||||
<FlatList
|
<FlatList
|
||||||
data={data}
|
data={!isSearching ? data : dataFiltered}
|
||||||
extraData={this.state}
|
extraData={this.state}
|
||||||
keyExtractor={item => item.rid}
|
keyExtractor={item => item.rid}
|
||||||
renderItem={this.renderItem}
|
renderItem={this.renderItem}
|
||||||
ListHeaderComponent={this.renderInfoText}
|
ListHeaderComponent={this.isSearch ? this.renderSearch : this.renderInfoText}
|
||||||
contentContainerStyle={{ backgroundColor: themes[theme].backgroundColor }}
|
contentContainerStyle={{ backgroundColor: themes[theme].backgroundColor }}
|
||||||
keyboardShouldPersistTaps='always'
|
keyboardShouldPersistTaps='always'
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -8,6 +8,7 @@ import * as List from '../containers/List';
|
||||||
import Status from '../containers/Status/Status';
|
import Status from '../containers/Status/Status';
|
||||||
import TextInput from '../containers/TextInput';
|
import TextInput from '../containers/TextInput';
|
||||||
import EventEmitter from '../utils/events';
|
import EventEmitter from '../utils/events';
|
||||||
|
import { showErrorAlert } from '../utils/info';
|
||||||
import Loading from '../containers/Loading';
|
import Loading from '../containers/Loading';
|
||||||
import RocketChat from '../lib/rocketchat';
|
import RocketChat from '../lib/rocketchat';
|
||||||
import log, { logEvent, events } from '../utils/log';
|
import log, { logEvent, events } from '../utils/log';
|
||||||
|
@ -58,7 +59,8 @@ class StatusView extends React.Component {
|
||||||
theme: PropTypes.string,
|
theme: PropTypes.string,
|
||||||
navigation: PropTypes.object,
|
navigation: PropTypes.object,
|
||||||
isMasterDetail: PropTypes.bool,
|
isMasterDetail: PropTypes.bool,
|
||||||
setUser: PropTypes.func
|
setUser: PropTypes.func,
|
||||||
|
Accounts_AllowInvisibleStatusOption: PropTypes.bool
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -168,6 +170,7 @@ class StatusView extends React.Component {
|
||||||
setUser({ status: item.id });
|
setUser({ status: item.id });
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
showErrorAlert(I18n.t(e.data.errorType));
|
||||||
logEvent(events.SET_STATUS_FAIL);
|
logEvent(events.SET_STATUS_FAIL);
|
||||||
log(e);
|
log(e);
|
||||||
}
|
}
|
||||||
|
@ -181,10 +184,14 @@ class StatusView extends React.Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { loading } = this.state;
|
const { loading } = this.state;
|
||||||
|
const { Accounts_AllowInvisibleStatusOption } = this.props;
|
||||||
|
|
||||||
|
const status = Accounts_AllowInvisibleStatusOption ? STATUS : STATUS.filter(s => s.id !== 'offline');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView testID='status-view'>
|
<SafeAreaView testID='status-view'>
|
||||||
<FlatList
|
<FlatList
|
||||||
data={STATUS}
|
data={status}
|
||||||
keyExtractor={item => item.id}
|
keyExtractor={item => item.id}
|
||||||
renderItem={this.renderItem}
|
renderItem={this.renderItem}
|
||||||
ListHeaderComponent={this.renderHeader}
|
ListHeaderComponent={this.renderHeader}
|
||||||
|
@ -199,7 +206,8 @@ class StatusView extends React.Component {
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
user: getUserSelector(state),
|
user: getUserSelector(state),
|
||||||
isMasterDetail: state.app.isMasterDetail
|
isMasterDetail: state.app.isMasterDetail,
|
||||||
|
Accounts_AllowInvisibleStatusOption: state.settings.Accounts_AllowInvisibleStatusOption ?? true
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => ({
|
const mapDispatchToProps = dispatch => ({
|
||||||
|
|
|
@ -217,9 +217,9 @@ class TeamChannelsView extends React.Component {
|
||||||
options.headerRight = () => (
|
options.headerRight = () => (
|
||||||
<HeaderButton.Container>
|
<HeaderButton.Container>
|
||||||
{ showCreate
|
{ showCreate
|
||||||
? <HeaderButton.Item iconName='create' onPress={() => navigation.navigate('AddChannelTeamView', { teamId: this.teamId, teamChannels: data })} />
|
? <HeaderButton.Item iconName='create' testID='team-channels-view-create' onPress={() => navigation.navigate('AddChannelTeamView', { teamId: this.teamId, teamChannels: data })} />
|
||||||
: null}
|
: null}
|
||||||
<HeaderButton.Item iconName='search' onPress={this.onSearchPress} />
|
<HeaderButton.Item iconName='search' testID='team-channels-view-search' onPress={this.onSearchPress} />
|
||||||
</HeaderButton.Container>
|
</HeaderButton.Container>
|
||||||
);
|
);
|
||||||
navigation.setOptions(options);
|
navigation.setOptions(options);
|
||||||
|
@ -282,25 +282,25 @@ class TeamChannelsView extends React.Component {
|
||||||
logEvent(events.TC_GO_ROOM);
|
logEvent(events.TC_GO_ROOM);
|
||||||
const { navigation, isMasterDetail } = this.props;
|
const { navigation, isMasterDetail } = this.props;
|
||||||
try {
|
try {
|
||||||
let params = {};
|
|
||||||
if (item.rid) {
|
|
||||||
params = item;
|
|
||||||
} else {
|
|
||||||
const { room } = await RocketChat.getRoomInfo(item._id);
|
const { room } = await RocketChat.getRoomInfo(item._id);
|
||||||
params = {
|
const params = {
|
||||||
rid: item._id, name: RocketChat.getRoomTitle(room), joinCodeRequired: room.joinCodeRequired, t: room.t, teamId: room.teamId
|
rid: item._id, name: RocketChat.getRoomTitle(room), joinCodeRequired: room.joinCodeRequired, t: room.t, teamId: room.teamId
|
||||||
};
|
};
|
||||||
}
|
|
||||||
if (isMasterDetail) {
|
if (isMasterDetail) {
|
||||||
navigation.pop();
|
navigation.pop();
|
||||||
}
|
}
|
||||||
goRoom({ item: params, isMasterDetail, navigationMethod: navigation.push });
|
goRoom({ item: params, isMasterDetail, navigationMethod: navigation.push });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// do nothing
|
if (e.data.error === 'not-allowed') {
|
||||||
|
showErrorAlert(I18n.t('error-not-allowed'));
|
||||||
|
} else {
|
||||||
|
showErrorAlert(e.data.error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, 1000, true);
|
}, 1000, true);
|
||||||
|
|
||||||
toggleAutoJoin = async(item) => {
|
toggleAutoJoin = async(item) => {
|
||||||
|
logEvent(events.TC_TOGGLE_AUTOJOIN);
|
||||||
try {
|
try {
|
||||||
const { data } = this.state;
|
const { data } = this.state;
|
||||||
const result = await RocketChat.updateTeamRoom({ roomId: item._id, isDefault: !item.teamDefault });
|
const result = await RocketChat.updateTeamRoom({ roomId: item._id, isDefault: !item.teamDefault });
|
||||||
|
@ -314,6 +314,7 @@ class TeamChannelsView extends React.Component {
|
||||||
this.setState({ data: newData });
|
this.setState({ data: newData });
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
logEvent(events.TC_TOGGLE_AUTOJOIN_F);
|
||||||
log(e);
|
log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -338,6 +339,7 @@ class TeamChannelsView extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
removeRoom = async(item) => {
|
removeRoom = async(item) => {
|
||||||
|
logEvent(events.TC_DELETE_ROOM);
|
||||||
try {
|
try {
|
||||||
const { data } = this.state;
|
const { data } = this.state;
|
||||||
const result = await RocketChat.removeTeamRoom({ roomId: item._id, teamId: this.team.teamId });
|
const result = await RocketChat.removeTeamRoom({ roomId: item._id, teamId: this.team.teamId });
|
||||||
|
@ -346,11 +348,13 @@ class TeamChannelsView extends React.Component {
|
||||||
this.setState({ data: newData });
|
this.setState({ data: newData });
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
logEvent(events.TC_DELETE_ROOM_F);
|
||||||
log(e);
|
log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete = (item) => {
|
delete = (item) => {
|
||||||
|
logEvent(events.TC_DELETE_ROOM);
|
||||||
const { deleteRoom } = this.props;
|
const { deleteRoom } = this.props;
|
||||||
|
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
|
@ -388,7 +392,8 @@ class TeamChannelsView extends React.Component {
|
||||||
title: I18n.t('Auto-join'),
|
title: I18n.t('Auto-join'),
|
||||||
icon: item.t === 'p' ? 'channel-private' : 'channel-public',
|
icon: item.t === 'p' ? 'channel-private' : 'channel-public',
|
||||||
onPress: () => this.toggleAutoJoin(item),
|
onPress: () => this.toggleAutoJoin(item),
|
||||||
right: () => <CustomIcon name={autoJoinIcon} size={20} color={autoJoinIconColor} />
|
right: () => <CustomIcon testID={isAutoJoinChecked ? 'auto-join-checked' : 'auto-join-unchecked'} name={autoJoinIcon} size={20} color={autoJoinIconColor} />,
|
||||||
|
testID: 'action-sheet-auto-join'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,7 +403,8 @@ class TeamChannelsView extends React.Component {
|
||||||
title: I18n.t('Remove_from_Team'),
|
title: I18n.t('Remove_from_Team'),
|
||||||
icon: 'close',
|
icon: 'close',
|
||||||
danger: true,
|
danger: true,
|
||||||
onPress: () => this.remove(item)
|
onPress: () => this.remove(item),
|
||||||
|
testID: 'action-sheet-remove-from-team'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,7 +414,8 @@ class TeamChannelsView extends React.Component {
|
||||||
title: I18n.t('Delete'),
|
title: I18n.t('Delete'),
|
||||||
icon: 'delete',
|
icon: 'delete',
|
||||||
danger: true,
|
danger: true,
|
||||||
onPress: () => this.delete(item)
|
onPress: () => this.delete(item),
|
||||||
|
testID: 'action-sheet-delete'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,11 @@ const data = {
|
||||||
name: `detox-private-${ value }`
|
name: `detox-private-${ value }`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
teams: {
|
||||||
|
private: {
|
||||||
|
name: `detox-team-${ value }`
|
||||||
|
}
|
||||||
|
},
|
||||||
registeringUser: {
|
registeringUser: {
|
||||||
username: `newuser${ value }`,
|
username: `newuser${ value }`,
|
||||||
password: `password${ value }`,
|
password: `password${ value }`,
|
||||||
|
@ -57,6 +62,11 @@ const data = {
|
||||||
password: `passwordthree${ value }`,
|
password: `passwordthree${ value }`,
|
||||||
email: `mobile+registeringthree${ value }@rocket.chat`
|
email: `mobile+registeringthree${ value }@rocket.chat`
|
||||||
},
|
},
|
||||||
|
registeringUser4: {
|
||||||
|
username: `newuserfour${ value }`,
|
||||||
|
password: `passwordfour${ value }`,
|
||||||
|
email: `mobile+registeringfour${ value }@rocket.chat`
|
||||||
|
},
|
||||||
random: value
|
random: value
|
||||||
}
|
}
|
||||||
module.exports = data;
|
module.exports = data;
|
||||||
|
|
|
@ -42,6 +42,11 @@ const data = {
|
||||||
name: `detox-private-${ value }`
|
name: `detox-private-${ value }`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
teams: {
|
||||||
|
private: {
|
||||||
|
name: `detox-team-${ value }`
|
||||||
|
}
|
||||||
|
},
|
||||||
registeringUser: {
|
registeringUser: {
|
||||||
username: `newuser${ value }`,
|
username: `newuser${ value }`,
|
||||||
password: `password${ value }`,
|
password: `password${ value }`,
|
||||||
|
@ -57,6 +62,11 @@ const data = {
|
||||||
password: `passwordthree${ value }`,
|
password: `passwordthree${ value }`,
|
||||||
email: `mobile+registeringthree${ value }@rocket.chat`
|
email: `mobile+registeringthree${ value }@rocket.chat`
|
||||||
},
|
},
|
||||||
|
registeringUser4: {
|
||||||
|
username: `newuserfour${ value }`,
|
||||||
|
password: `passwordfour${ value }`,
|
||||||
|
email: `mobile+registeringfour${ value }@rocket.chat`
|
||||||
|
},
|
||||||
random: value
|
random: value
|
||||||
}
|
}
|
||||||
module.exports = data;
|
module.exports = data;
|
||||||
|
|
|
@ -70,7 +70,7 @@ async function starMessage(message){
|
||||||
await expect(element(by.id('action-sheet'))).toExist();
|
await expect(element(by.id('action-sheet'))).toExist();
|
||||||
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
||||||
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
||||||
await element(by.label('Star')).tap();
|
await element(by.label('Star')).atIndex(0).tap();
|
||||||
await waitFor(element(by.id('action-sheet'))).not.toExist().withTimeout(5000);
|
await waitFor(element(by.id('action-sheet'))).not.toExist().withTimeout(5000);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ async function pinMessage(message){
|
||||||
await expect(element(by.id('action-sheet'))).toExist();
|
await expect(element(by.id('action-sheet'))).toExist();
|
||||||
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
||||||
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
||||||
await element(by.label('Pin')).tap();
|
await element(by.label('Pin')).atIndex(0).tap();
|
||||||
await waitFor(element(by.id('action-sheet'))).not.toExist().withTimeout(5000);
|
await waitFor(element(by.id('action-sheet'))).not.toExist().withTimeout(5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,10 +103,6 @@ describe('Join public room', () => {
|
||||||
await expect(element(by.id('room-actions-starred'))).toBeVisible();
|
await expect(element(by.id('room-actions-starred'))).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
// it('should have search', async() => {
|
|
||||||
// await expect(element(by.id('room-actions-search'))).toBeVisible();
|
|
||||||
// });
|
|
||||||
|
|
||||||
it('should have share', async() => {
|
it('should have share', async() => {
|
||||||
await expect(element(by.id('room-actions-share'))).toBeVisible();
|
await expect(element(by.id('room-actions-share'))).toBeVisible();
|
||||||
});
|
});
|
||||||
|
@ -155,7 +151,6 @@ describe('Join public room', () => {
|
||||||
await expect(element(by.id('room-actions-files'))).toBeVisible();
|
await expect(element(by.id('room-actions-files'))).toBeVisible();
|
||||||
await expect(element(by.id('room-actions-mentioned'))).toBeVisible();
|
await expect(element(by.id('room-actions-mentioned'))).toBeVisible();
|
||||||
await expect(element(by.id('room-actions-starred'))).toBeVisible();
|
await expect(element(by.id('room-actions-starred'))).toBeVisible();
|
||||||
// await expect(element(by.id('room-actions-search'))).toBeVisible();
|
|
||||||
await element(by.type(scrollViewType)).atIndex(1).swipe('down');
|
await element(by.type(scrollViewType)).atIndex(1).swipe('down');
|
||||||
await expect(element(by.id('room-actions-share'))).toBeVisible();
|
await expect(element(by.id('room-actions-share'))).toBeVisible();
|
||||||
await expect(element(by.id('room-actions-pinned'))).toBeVisible();
|
await expect(element(by.id('room-actions-pinned'))).toBeVisible();
|
||||||
|
|
|
@ -32,16 +32,24 @@ describe('Join room from directory', () => {
|
||||||
await navigateToRoom(data.channels.detoxpublic.name);
|
await navigateToRoom(data.channels.detoxpublic.name);
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should back and tap directory', async() => {
|
it('should search user and navigate', async() => {
|
||||||
await tapBack();
|
await tapBack();
|
||||||
await element(by.id('rooms-list-view-directory')).tap();
|
await element(by.id('rooms-list-view-directory')).tap();
|
||||||
})
|
await waitFor(element(by.id('directory-view'))).toExist().withTimeout(2000);
|
||||||
|
|
||||||
it('should search user and navigate', async() => {
|
|
||||||
await element(by.id('directory-view-dropdown')).tap();
|
await element(by.id('directory-view-dropdown')).tap();
|
||||||
await element(by.label('Users')).tap();
|
await element(by.label('Users')).tap();
|
||||||
await element(by.label('Search by')).tap();
|
await element(by.label('Search by')).tap();
|
||||||
await navigateToRoom(data.users.alternate.username);
|
await navigateToRoom(data.users.alternate.username);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should search user and navigate', async() => {
|
||||||
|
await tapBack();
|
||||||
|
await element(by.id('rooms-list-view-directory')).tap();
|
||||||
|
await waitFor(element(by.id('directory-view'))).toExist().withTimeout(2000);
|
||||||
|
await element(by.id('directory-view-dropdown')).tap();
|
||||||
|
await element(by.label('Teams')).tap();
|
||||||
|
await element(by.label('Search by')).tap();
|
||||||
|
await navigateToRoom(data.teams.private.name);
|
||||||
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -168,7 +168,7 @@ describe('Room screen', () => {
|
||||||
await expect(element(by.id('action-sheet'))).toExist();
|
await expect(element(by.id('action-sheet'))).toExist();
|
||||||
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
||||||
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
||||||
await element(by.label('Permalink')).tap();
|
await element(by.label('Permalink')).atIndex(0).tap();
|
||||||
|
|
||||||
// TODO: test clipboard
|
// TODO: test clipboard
|
||||||
});
|
});
|
||||||
|
@ -178,7 +178,7 @@ describe('Room screen', () => {
|
||||||
await expect(element(by.id('action-sheet'))).toExist();
|
await expect(element(by.id('action-sheet'))).toExist();
|
||||||
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
||||||
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
||||||
await element(by.label('Copy')).tap();
|
await element(by.label('Copy')).atIndex(0).tap();
|
||||||
|
|
||||||
// TODO: test clipboard
|
// TODO: test clipboard
|
||||||
});
|
});
|
||||||
|
@ -191,7 +191,7 @@ describe('Room screen', () => {
|
||||||
await expect(element(by.id('action-sheet'))).toExist();
|
await expect(element(by.id('action-sheet'))).toExist();
|
||||||
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
||||||
await element(by.id('action-sheet-handle')).swipe('up', 'slow', 0.5);
|
await element(by.id('action-sheet-handle')).swipe('up', 'slow', 0.5);
|
||||||
await waitFor(element(by.label('Unstar'))).toBeVisible().withTimeout(6000);
|
await waitFor(element(by.label('Unstar')).atIndex(0)).toBeVisible().withTimeout(6000);
|
||||||
await element(by.id('action-sheet-handle')).swipe('down', 'fast', 0.8);
|
await element(by.id('action-sheet-handle')).swipe('down', 'fast', 0.8);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ describe('Room screen', () => {
|
||||||
await expect(element(by.id('action-sheet'))).toExist();
|
await expect(element(by.id('action-sheet'))).toExist();
|
||||||
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
||||||
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
||||||
await element(by.label('Edit')).tap();
|
await element(by.label('Edit')).atIndex(0).tap();
|
||||||
await element(by.id('messagebox-input')).typeText('ed');
|
await element(by.id('messagebox-input')).typeText('ed');
|
||||||
await element(by.id('messagebox-send-message')).tap();
|
await element(by.id('messagebox-send-message')).tap();
|
||||||
await waitFor(element(by.label(`${ data.random }edited (edited)`)).atIndex(0)).toExist().withTimeout(60000);
|
await waitFor(element(by.label(`${ data.random }edited (edited)`)).atIndex(0)).toExist().withTimeout(60000);
|
||||||
|
@ -255,7 +255,7 @@ describe('Room screen', () => {
|
||||||
await expect(element(by.id('action-sheet'))).toExist();
|
await expect(element(by.id('action-sheet'))).toExist();
|
||||||
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
||||||
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
||||||
await element(by.label('Quote')).tap();
|
await element(by.label('Quote')).atIndex(0).tap();
|
||||||
await element(by.id('messagebox-input')).typeText(`${ data.random }quoted`);
|
await element(by.id('messagebox-input')).typeText(`${ data.random }quoted`);
|
||||||
await element(by.id('messagebox-send-message')).tap();
|
await element(by.id('messagebox-send-message')).tap();
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ describe('Room screen', () => {
|
||||||
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
||||||
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
||||||
await waitFor(element(by.label('Delete'))).toExist().withTimeout(1000);
|
await waitFor(element(by.label('Delete'))).toExist().withTimeout(1000);
|
||||||
await element(by.label('Delete')).tap();
|
await element(by.label('Delete')).atIndex(0).tap();
|
||||||
|
|
||||||
const deleteAlertMessage = 'You will not be able to recover this message!';
|
const deleteAlertMessage = 'You will not be able to recover this message!';
|
||||||
await waitFor(element(by.text(deleteAlertMessage)).atIndex(0)).toExist().withTimeout(10000);
|
await waitFor(element(by.text(deleteAlertMessage)).atIndex(0)).toExist().withTimeout(10000);
|
||||||
|
|
|
@ -77,10 +77,6 @@ describe('Room actions screen', () => {
|
||||||
await expect(element(by.id('room-actions-starred'))).toExist();
|
await expect(element(by.id('room-actions-starred'))).toExist();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have search', async() => {
|
|
||||||
await expect(element(by.id('room-actions-search'))).toExist();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have share', async() => {
|
it('should have share', async() => {
|
||||||
await waitFor(element(by.id('room-actions-share'))).toExist();
|
await waitFor(element(by.id('room-actions-share'))).toExist();
|
||||||
await expect(element(by.id('room-actions-share'))).toExist();
|
await expect(element(by.id('room-actions-share'))).toExist();
|
||||||
|
@ -147,10 +143,6 @@ describe('Room actions screen', () => {
|
||||||
await expect(element(by.id('room-actions-starred'))).toExist();
|
await expect(element(by.id('room-actions-starred'))).toExist();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have search', async() => {
|
|
||||||
await expect(element(by.id('room-actions-search'))).toExist();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have share', async() => {
|
it('should have share', async() => {
|
||||||
await waitFor(element(by.id('room-actions-share'))).toExist();
|
await waitFor(element(by.id('room-actions-share'))).toExist();
|
||||||
await expect(element(by.id('room-actions-share'))).toExist();
|
await expect(element(by.id('room-actions-share'))).toExist();
|
||||||
|
@ -229,7 +221,7 @@ describe('Room actions screen', () => {
|
||||||
await element(by.label(`${ data.random }messageToStar`)).atIndex(0).longPress();
|
await element(by.label(`${ data.random }messageToStar`)).atIndex(0).longPress();
|
||||||
await expect(element(by.id('action-sheet'))).toExist();
|
await expect(element(by.id('action-sheet'))).toExist();
|
||||||
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
||||||
await element(by.label('Unstar')).tap();
|
await element(by.label('Unstar')).atIndex(0).tap();
|
||||||
|
|
||||||
await waitFor(element(by.label(`${ data.random }messageToStar`).withAncestor(by.id('starred-messages-view')))).toBeNotVisible().withTimeout(60000);
|
await waitFor(element(by.label(`${ data.random }messageToStar`).withAncestor(by.id('starred-messages-view')))).toBeNotVisible().withTimeout(60000);
|
||||||
await backToActions();
|
await backToActions();
|
||||||
|
@ -256,29 +248,29 @@ describe('Room actions screen', () => {
|
||||||
|
|
||||||
await expect(element(by.id('action-sheet'))).toExist();
|
await expect(element(by.id('action-sheet'))).toExist();
|
||||||
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
||||||
await element(by.label('Unpin')).tap();
|
await element(by.label('Unpin')).atIndex(0).tap();
|
||||||
|
|
||||||
await waitFor(element(by.label(`${ data.random }messageToPin`).withAncestor(by.id('pinned-messages-view')))).not.toExist().withTimeout(6000);
|
await waitFor(element(by.label(`${ data.random }messageToPin`).withAncestor(by.id('pinned-messages-view')))).not.toExist().withTimeout(6000);
|
||||||
await backToActions();
|
await backToActions();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should search and find a message', async() => {
|
// it('should search and find a message', async() => {
|
||||||
|
|
||||||
//Go back to room and send a message
|
// //Go back to room and send a message
|
||||||
await tapBack();
|
// await tapBack();
|
||||||
await mockMessage('messageToFind');
|
// await mockMessage('messageToFind');
|
||||||
|
|
||||||
//Back into Room Actions
|
// //Back into Room Actions
|
||||||
await element(by.id('room-header')).tap();
|
// await element(by.id('room-header')).tap();
|
||||||
await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(5000);
|
// await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(5000);
|
||||||
|
|
||||||
await element(by.id('room-actions-search')).tap();
|
// await element(by.id('room-actions-search')).tap();
|
||||||
await waitFor(element(by.id('search-messages-view'))).toExist().withTimeout(2000);
|
// await waitFor(element(by.id('search-messages-view'))).toExist().withTimeout(2000);
|
||||||
await expect(element(by.id('search-message-view-input'))).toExist();
|
// await expect(element(by.id('search-message-view-input'))).toExist();
|
||||||
await element(by.id('search-message-view-input')).replaceText(`/${ data.random }messageToFind/`);
|
// await element(by.id('search-message-view-input')).replaceText(`/${ data.random }messageToFind/`);
|
||||||
await waitFor(element(by.label(`${ data.random }messageToFind`).withAncestor(by.id('search-messages-view')))).toExist().withTimeout(60000);
|
// await waitFor(element(by.label(`${ data.random }messageToFind`).withAncestor(by.id('search-messages-view')))).toExist().withTimeout(60000);
|
||||||
await backToActions();
|
// await backToActions();
|
||||||
});
|
// });
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Notification', async() => {
|
describe('Notification', async() => {
|
||||||
|
@ -419,46 +411,46 @@ describe('Room actions screen', () => {
|
||||||
|
|
||||||
it('should set/remove as owner', async() => {
|
it('should set/remove as owner', async() => {
|
||||||
await openActionSheet(user.username);
|
await openActionSheet(user.username);
|
||||||
await element(by.label('Set as owner')).tap();
|
await element(by.id('action-sheet-set-owner')).tap();
|
||||||
await waitForToast();
|
await waitForToast();
|
||||||
|
|
||||||
await openActionSheet(user.username);
|
await openActionSheet(user.username);
|
||||||
await element(by.label('Remove as owner')).tap();
|
await waitFor(element(by.id('action-sheet-set-owner-checked'))).toBeVisible().withTimeout(6000);
|
||||||
|
await element(by.id('action-sheet-set-owner')).tap();
|
||||||
await waitForToast();
|
await waitForToast();
|
||||||
|
|
||||||
await openActionSheet(user.username);
|
await openActionSheet(user.username);
|
||||||
// Tests if Remove as owner worked
|
await waitFor(element(by.id('action-sheet-set-owner-unchecked'))).toBeVisible().withTimeout(60000);
|
||||||
await waitFor(element(by.label('Set as owner'))).toExist().withTimeout(5000);
|
|
||||||
await closeActionSheet();
|
await closeActionSheet();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set/remove as leader', async() => {
|
it('should set/remove as leader', async() => {
|
||||||
await openActionSheet(user.username);
|
await openActionSheet(user.username);
|
||||||
await element(by.label('Set as leader')).tap();
|
await element(by.id('action-sheet-set-leader')).tap();
|
||||||
await waitForToast();
|
await waitForToast();
|
||||||
|
|
||||||
await openActionSheet(user.username);
|
await openActionSheet(user.username);
|
||||||
await element(by.label('Remove as leader')).tap();
|
await waitFor(element(by.id('action-sheet-set-leader-checked'))).toBeVisible().withTimeout(6000);
|
||||||
|
await element(by.id('action-sheet-set-leader')).tap();
|
||||||
await waitForToast();
|
await waitForToast();
|
||||||
|
|
||||||
await openActionSheet(user.username);
|
await openActionSheet(user.username);
|
||||||
// Tests if Remove as leader worked
|
await waitFor(element(by.id('action-sheet-set-owner-unchecked'))).toBeVisible().withTimeout(60000);
|
||||||
await waitFor(element(by.label('Set as leader'))).toExist().withTimeout(5000);
|
|
||||||
await closeActionSheet();
|
await closeActionSheet();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set/remove as moderator', async() => {
|
it('should set/remove as moderator', async() => {
|
||||||
await openActionSheet(user.username);
|
await openActionSheet(user.username);
|
||||||
await element(by.label('Set as moderator')).tap();
|
await element(by.id('action-sheet-set-moderator')).tap();
|
||||||
await waitForToast();
|
await waitForToast();
|
||||||
|
|
||||||
await openActionSheet(user.username);
|
await openActionSheet(user.username);
|
||||||
await element(by.label('Remove as moderator')).tap();
|
await waitFor(element(by.id('action-sheet-set-moderator-checked'))).toBeVisible().withTimeout(6000);
|
||||||
|
await element(by.id('action-sheet-set-moderator')).tap();
|
||||||
await waitForToast();
|
await waitForToast();
|
||||||
|
|
||||||
await openActionSheet(user.username);
|
await openActionSheet(user.username);
|
||||||
// Tests if Remove as moderator worked
|
await waitFor(element(by.id('action-sheet-set-moderator-unchecked'))).toBeVisible().withTimeout(60000);
|
||||||
await waitFor(element(by.label('Set as moderator'))).toExist().withTimeout(5000);
|
|
||||||
await closeActionSheet();
|
await closeActionSheet();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -102,10 +102,6 @@ describe('Discussion', () => {
|
||||||
await expect(element(by.id('room-actions-starred'))).toBeVisible();
|
await expect(element(by.id('room-actions-starred'))).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have search', async() => {
|
|
||||||
await expect(element(by.id('room-actions-search'))).toBeVisible();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have share', async() => {
|
it('should have share', async() => {
|
||||||
await element(by.type('android.widget.ScrollView')).atIndex(1).swipe('up');
|
await element(by.type('android.widget.ScrollView')).atIndex(1).swipe('up');
|
||||||
await expect(element(by.id('room-actions-share'))).toBeVisible();
|
await expect(element(by.id('room-actions-share'))).toBeVisible();
|
||||||
|
|
|
@ -2,9 +2,9 @@ const {
|
||||||
device, expect, element, by, waitFor
|
device, expect, element, by, waitFor
|
||||||
} = require('detox');
|
} = require('detox');
|
||||||
const data = require('../../data');
|
const data = require('../../data');
|
||||||
const { tapBack, sleep, navigateToLogin, login, tryTapping } = require('../../helpers/app');
|
const { navigateToLogin, login } = require('../../helpers/app');
|
||||||
|
|
||||||
|
|
||||||
|
const teamName = `team-${ data.random }`;
|
||||||
|
|
||||||
describe('Create team screen', () => {
|
describe('Create team screen', () => {
|
||||||
before(async() => {
|
before(async() => {
|
||||||
|
@ -18,38 +18,18 @@ describe('Create team screen', () => {
|
||||||
await element(by.id('rooms-list-view-create-channel')).tap();
|
await element(by.id('rooms-list-view-create-channel')).tap();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Render', async() => {
|
|
||||||
it('should have team button', async() => {
|
it('should have team button', async() => {
|
||||||
await waitFor(element(by.id('new-message-view-create-channel'))).toBeVisible().withTimeout(2000);
|
await waitFor(element(by.id('new-message-view-create-team'))).toBeVisible().withTimeout(2000);
|
||||||
});
|
});
|
||||||
})
|
|
||||||
|
|
||||||
describe('Usage', async() => {
|
|
||||||
it('should navigate to select users', async() => {
|
it('should navigate to select users', async() => {
|
||||||
await element(by.id('new-message-view-create-channel')).tap();
|
await element(by.id('new-message-view-create-team')).tap();
|
||||||
await waitFor(element(by.id('select-users-view'))).toExist().withTimeout(5000);
|
await waitFor(element(by.id('select-users-view'))).toExist().withTimeout(5000);
|
||||||
});
|
});
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Select Users', async() => {
|
describe('Select Users', async() => {
|
||||||
it('should search users', async() => {
|
it('should nav to create team', async() => {
|
||||||
await element(by.id('select-users-view-search')).replaceText('rocket.cat');
|
|
||||||
await waitFor(element(by.id(`select-users-view-item-rocket.cat`))).toBeVisible().withTimeout(10000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should select/unselect user', async() => {
|
|
||||||
// Spotlight issues
|
|
||||||
await element(by.id('select-users-view-item-rocket.cat')).tap();
|
|
||||||
await waitFor(element(by.id('selected-user-rocket.cat'))).toBeVisible().withTimeout(10000);
|
|
||||||
await element(by.id('selected-user-rocket.cat')).tap();
|
|
||||||
await waitFor(element(by.id('selected-user-rocket.cat'))).toBeNotVisible().withTimeout(10000);
|
|
||||||
// Spotlight issues
|
|
||||||
await element(by.id('select-users-view-item-rocket.cat')).tap();
|
|
||||||
await waitFor(element(by.id('selected-user-rocket.cat'))).toBeVisible().withTimeout(10000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create team', async() => {
|
|
||||||
await element(by.id('selected-users-view-submit')).tap();
|
await element(by.id('selected-users-view-submit')).tap();
|
||||||
await waitFor(element(by.id('create-channel-view'))).toExist().withTimeout(10000);
|
await waitFor(element(by.id('create-channel-view'))).toExist().withTimeout(10000);
|
||||||
});
|
});
|
||||||
|
@ -64,19 +44,33 @@ describe('Create team screen', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create private team', async() => {
|
it('should create private team', async() => {
|
||||||
const room = `private${ data.random }`;
|
|
||||||
await element(by.id('create-channel-name')).replaceText('');
|
await element(by.id('create-channel-name')).replaceText('');
|
||||||
await element(by.id('create-channel-name')).typeText(room);
|
await element(by.id('create-channel-name')).typeText(teamName);
|
||||||
await element(by.id('create-channel-submit')).tap();
|
await element(by.id('create-channel-submit')).tap();
|
||||||
await waitFor(element(by.id('room-view'))).toExist().withTimeout(20000);
|
await waitFor(element(by.id('room-view'))).toExist().withTimeout(20000);
|
||||||
await expect(element(by.id('room-view'))).toExist();
|
await expect(element(by.id('room-view'))).toExist();
|
||||||
await waitFor(element(by.id(`room-view-title-${ room }`))).toExist().withTimeout(6000);
|
await waitFor(element(by.id(`room-view-title-${ teamName }`))).toExist().withTimeout(6000);
|
||||||
await expect(element(by.id(`room-view-title-${ room }`))).toExist();
|
await expect(element(by.id(`room-view-title-${ teamName }`))).toExist();
|
||||||
await tapBack();
|
|
||||||
await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(10000);
|
|
||||||
await waitFor(element(by.id(`rooms-list-view-item-${ room }`))).toExist().withTimeout(6000);
|
|
||||||
await expect(element(by.id(`rooms-list-view-item-${ room }`))).toExist();
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Delete Team', async() => {
|
||||||
|
it('should navigate to room info edit view', async() => {
|
||||||
|
await element(by.id('room-header')).tap();
|
||||||
|
await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(5000);
|
||||||
|
await element(by.id('room-actions-info')).tap();
|
||||||
|
await waitFor(element(by.id('room-info-view'))).toExist().withTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should delete team', async() => {
|
||||||
|
await element(by.id('room-info-view-edit-button')).tap();
|
||||||
|
await element(by.id('room-info-edit-view-list')).swipe('up', 'fast', 0.5);
|
||||||
|
await element(by.id('room-info-edit-view-delete')).tap();
|
||||||
|
await waitFor(element(by.text('Yes, delete it!'))).toExist().withTimeout(5000);
|
||||||
|
await element(by.text('Yes, delete it!')).tap();
|
||||||
|
await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(10000);
|
||||||
|
await waitFor(element(by.id(`rooms-list-view-item-${ teamName }`))).toBeNotVisible().withTimeout(60000);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,296 @@
|
||||||
|
const {
|
||||||
|
device, expect, element, by, waitFor
|
||||||
|
} = require('detox');
|
||||||
|
const data = require('../../data');
|
||||||
|
const { navigateToLogin, login, tapBack, sleep, searchRoom } = require('../../helpers/app');
|
||||||
|
|
||||||
|
async function navigateToRoom(roomName) {
|
||||||
|
await searchRoom(`${ roomName }`);
|
||||||
|
await element(by.id(`rooms-list-view-item-${ roomName }`)).tap();
|
||||||
|
await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(5000);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function openActionSheet(username) {
|
||||||
|
await waitFor(element(by.id(`room-members-view-item-${ username }`))).toExist().withTimeout(5000);
|
||||||
|
await element(by.id(`room-members-view-item-${ username }`)).tap();
|
||||||
|
await sleep(300);
|
||||||
|
await expect(element(by.id('action-sheet'))).toExist();
|
||||||
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function navigateToRoomActions() {
|
||||||
|
await waitFor(element(by.id('room-view'))).toExist().withTimeout(2000);
|
||||||
|
await element(by.id('room-header')).tap();
|
||||||
|
await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(5000);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function backToActions() {
|
||||||
|
await tapBack();
|
||||||
|
await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(2000);
|
||||||
|
}
|
||||||
|
async function closeActionSheet() {
|
||||||
|
await element(by.id('action-sheet-handle')).swipe('down', 'fast', 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function waitForToast() {
|
||||||
|
await sleep(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Team', () => {
|
||||||
|
const team = data.teams.private.name;
|
||||||
|
const user = data.users.alternate;
|
||||||
|
const room = `private${ data.random }`;
|
||||||
|
const existingRoom = data.groups.private.name;
|
||||||
|
|
||||||
|
before(async() => {
|
||||||
|
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
|
||||||
|
await navigateToLogin();
|
||||||
|
await login(data.users.regular.username, data.users.regular.password);
|
||||||
|
await navigateToRoom(team);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Team Room', async() => {
|
||||||
|
describe('Team Header', async() => {
|
||||||
|
it('should have actions button ', async() => {
|
||||||
|
await expect(element(by.id('room-header'))).toExist();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have team channels button ', async() => {
|
||||||
|
await expect(element(by.id('room-view-header-team-channels'))).toExist();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have threads button ', async() => {
|
||||||
|
await expect(element(by.id('room-view-header-threads'))).toExist();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
it('should have threads button ', async() => {
|
||||||
|
await expect(element(by.id('room-view-search'))).toExist();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Team Header Usage', async() => {
|
||||||
|
it('should navigate to team channels view', async() => {
|
||||||
|
await element(by.id('room-view-header-team-channels')).tap();
|
||||||
|
await waitFor(element(by.id('team-channels-view'))).toExist().withTimeout(5000);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('Team Channels Header', async() => {
|
||||||
|
it('should have actions button ', async() => {
|
||||||
|
await expect(element(by.id('room-header'))).toExist();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have team channels button ', async() => {
|
||||||
|
await expect(element(by.id('team-channels-view-create'))).toExist();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have threads button ', async() => {
|
||||||
|
await expect(element(by.id('team-channels-view-search'))).toExist();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Team Channels Header Usage', async() => {
|
||||||
|
it('should navigate to add team channels view', async() => {
|
||||||
|
await element(by.id('team-channels-view-create')).tap();
|
||||||
|
await waitFor(element(by.id('add-channel-team-view'))).toExist().withTimeout(5000);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have create new button', async() => {
|
||||||
|
await waitFor(element(by.id('add-channel-team-view-create-channel'))).toExist().withTimeout(5000);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add existing button', async() => {
|
||||||
|
await waitFor(element(by.id('add-channel-team-view-add-existing'))).toExist().withTimeout(5000);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('Channels', async() => {
|
||||||
|
it('should create new channel for team', async() => {
|
||||||
|
|
||||||
|
await element(by.id('add-channel-team-view-create-channel')).tap();
|
||||||
|
|
||||||
|
await element(by.id('select-users-view-search')).replaceText('rocket.cat');
|
||||||
|
await element(by.id('select-users-view-item-rocket.cat')).tap();
|
||||||
|
await waitFor(element(by.id('selected-user-rocket.cat'))).toBeVisible().withTimeout(10000);
|
||||||
|
await element(by.id('selected-users-view-submit')).tap();
|
||||||
|
|
||||||
|
await waitFor(element(by.id('create-channel-view'))).toExist().withTimeout(10000);
|
||||||
|
await element(by.id('create-channel-name')).replaceText('');
|
||||||
|
await element(by.id('create-channel-name')).typeText(room);
|
||||||
|
await element(by.id('create-channel-submit')).tap();
|
||||||
|
|
||||||
|
await waitFor(element(by.id('room-view'))).toExist().withTimeout(20000);
|
||||||
|
await expect(element(by.id('room-view'))).toExist();
|
||||||
|
await expect(element(by.id('room-view-header-team-channels'))).toExist();
|
||||||
|
await element(by.id('room-view-header-team-channels')).tap();
|
||||||
|
|
||||||
|
await waitFor(element(by.id('team-channels-view'))).toExist().withTimeout(5000);
|
||||||
|
await waitFor(element(by.id(`rooms-list-view-item-${ room }`))).toExist().withTimeout(6000);
|
||||||
|
await expect(element(by.id(`rooms-list-view-item-${ room }`))).toExist();
|
||||||
|
await element(by.id(`rooms-list-view-item-${ room }`)).tap();
|
||||||
|
await waitFor(element(by.id(`room-view-title-${ room }`))).toExist().withTimeout(60000);
|
||||||
|
await expect(element(by.id(`room-view-title-${ room }`))).toExist();
|
||||||
|
await expect(element(by.id('room-view-header-team-channels'))).toExist();
|
||||||
|
await expect(element(by.id('room-view-header-threads'))).toExist();
|
||||||
|
await expect(element(by.id('room-view-search'))).toExist();
|
||||||
|
await tapBack();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add existing channel to team', async() => {
|
||||||
|
|
||||||
|
await element(by.id('team-channels-view-create')).tap();
|
||||||
|
await waitFor(element(by.id('add-channel-team-view'))).toExist().withTimeout(5000);
|
||||||
|
|
||||||
|
await element(by.id('add-channel-team-view-add-existing')).tap();
|
||||||
|
await waitFor(element(by.id('add-existing-channel-view'))).toExist().withTimeout(60000)
|
||||||
|
await expect(element(by.id(`add-existing-channel-view-item-${ existingRoom }`))).toExist();
|
||||||
|
await element(by.id(`add-existing-channel-view-item-${ existingRoom }`)).tap();
|
||||||
|
await waitFor(element(by.id('add-existing-channel-view-submit'))).toExist().withTimeout(6000);
|
||||||
|
await element(by.id('add-existing-channel-view-submit')).tap();
|
||||||
|
|
||||||
|
await waitFor(element(by.id('room-view'))).toExist().withTimeout(20000);
|
||||||
|
await expect(element(by.id('room-view'))).toExist();
|
||||||
|
await expect(element(by.id('room-view-header-team-channels'))).toExist();
|
||||||
|
await element(by.id('room-view-header-team-channels')).tap();
|
||||||
|
|
||||||
|
await waitFor(element(by.id(`rooms-list-view-item-${ existingRoom }`))).toExist().withTimeout(10000);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should activate/deactivate auto-join to channel', async() => {
|
||||||
|
await element(by.id(`rooms-list-view-item-${ existingRoom }`)).atIndex(0).longPress();
|
||||||
|
|
||||||
|
await waitFor(element(by.id('action-sheet-auto-join'))).toBeVisible().withTimeout(5000);
|
||||||
|
await waitFor(element(by.id('auto-join-unchecked'))).toBeVisible().withTimeout(5000);
|
||||||
|
await waitFor(element(by.id('action-sheet-remove-from-team'))).toBeVisible().withTimeout(5000);
|
||||||
|
await waitFor(element(by.id('action-sheet-delete'))).toBeVisible().withTimeout(5000);
|
||||||
|
|
||||||
|
await element(by.id('auto-join-unchecked')).tap();
|
||||||
|
await waitFor(element(by.id('auto-join-tag'))).toBeVisible().withTimeout(5000);
|
||||||
|
await element(by.id(`rooms-list-view-item-${ existingRoom }`)).atIndex(0).longPress();
|
||||||
|
|
||||||
|
await waitFor(element(by.id('auto-join-checked'))).toBeVisible().withTimeout(5000);
|
||||||
|
await element(by.id('auto-join-checked')).tap();
|
||||||
|
await waitFor(element(by.id('auto-join-tag'))).toBeNotVisible().withTimeout(5000);
|
||||||
|
await waitFor(element(by.id(`rooms-list-view-item-${ existingRoom }`))).toExist().withTimeout(6000);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('Team actions', () => {
|
||||||
|
before(async() => {
|
||||||
|
await tapBack();
|
||||||
|
await navigateToRoomActions();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add users to the team', async() => {
|
||||||
|
await waitFor(element(by.id('room-actions-add-user'))).toExist().withTimeout(10000);
|
||||||
|
await element(by.id('room-actions-add-user')).tap();
|
||||||
|
|
||||||
|
const rocketCat = 'rocket.cat';
|
||||||
|
await element(by.id('select-users-view-search')).replaceText('rocket.cat');
|
||||||
|
await waitFor(element(by.id(`select-users-view-item-${ rocketCat }`))).toExist().withTimeout(10000);
|
||||||
|
await element(by.id(`select-users-view-item-${ rocketCat }`)).tap();
|
||||||
|
await waitFor(element(by.id(`selected-user-${ rocketCat }`))).toExist().withTimeout(5000);
|
||||||
|
|
||||||
|
await waitFor(element(by.id('select-users-view-search'))).toExist().withTimeout(4000);
|
||||||
|
await element(by.id('select-users-view-search')).tap();
|
||||||
|
await element(by.id('select-users-view-search')).replaceText(user.username);
|
||||||
|
await waitFor(element(by.id(`select-users-view-item-${ user.username }`))).toExist().withTimeout(10000);
|
||||||
|
await element(by.id(`select-users-view-item-${ user.username }`)).tap();
|
||||||
|
await waitFor(element(by.id(`selected-user-${ user.username }`))).toExist().withTimeout(5000);
|
||||||
|
|
||||||
|
await element(by.id('selected-users-view-submit')).tap();
|
||||||
|
await sleep(300);
|
||||||
|
await waitFor(element(by.id('room-actions-members'))).toExist().withTimeout(10000);
|
||||||
|
await element(by.id('room-actions-members')).tap();
|
||||||
|
await element(by.id('room-members-view-toggle-status')).tap();
|
||||||
|
await waitFor(element(by.id(`room-members-view-item-${ user.username }`))).toExist().withTimeout(60000);
|
||||||
|
await backToActions();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should try to leave to leave team and raise alert', async() => {
|
||||||
|
await element(by.id('room-actions-scrollview')).scrollTo('bottom');
|
||||||
|
await waitFor(element(by.id('room-actions-leave-channel'))).toExist().withTimeout(2000);
|
||||||
|
await element(by.id('room-actions-leave-channel')).tap();
|
||||||
|
|
||||||
|
await waitFor(element(by.id('select-list-view'))).toExist().withTimeout(2000);
|
||||||
|
await waitFor(element(by.id(`select-list-view-item-${room}`))).toExist().withTimeout(2000);
|
||||||
|
await waitFor(element(by.id(`select-list-view-item-${existingRoom}`))).toExist().withTimeout(2000);
|
||||||
|
await element(by.id(`select-list-view-item-${room}`)).tap();
|
||||||
|
|
||||||
|
await waitFor(element(by.label('You are the last owner of this channel. Once you leave the team, the channel will be kept inside the team but you will be managing it from outside.'))).toExist().withTimeout(2000);
|
||||||
|
await element(by.text('OK')).tap();
|
||||||
|
await waitFor(element(by.id('select-list-view-submit'))).toExist().withTimeout(2000);
|
||||||
|
await element(by.id('select-list-view-submit')).tap();
|
||||||
|
await waitFor(element(by.text('Last owner cannot be removed'))).toExist().withTimeout(8000);
|
||||||
|
await element(by.text('OK')).tap();
|
||||||
|
await tapBack();
|
||||||
|
await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Room Members', async() => {
|
||||||
|
before(async() => {
|
||||||
|
await element(by.id('room-actions-members')).tap();
|
||||||
|
await waitFor(element(by.id('room-members-view'))).toExist().withTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should show all users', async() => {
|
||||||
|
await element(by.id('room-members-view-toggle-status')).tap();
|
||||||
|
await waitFor(element(by.id(`room-members-view-item-${ user.username }`))).toExist().withTimeout(60000);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should filter user', async() => {
|
||||||
|
await waitFor(element(by.id(`room-members-view-item-${ user.username }`))).toExist().withTimeout(60000);
|
||||||
|
await element(by.id('room-members-view-search')).replaceText('rocket');
|
||||||
|
await waitFor(element(by.id(`room-members-view-item-${ user.username }`))).toBeNotVisible().withTimeout(60000);
|
||||||
|
await element(by.id('room-members-view-search')).tap();
|
||||||
|
await element(by.id('room-members-view-search')).clearText('');
|
||||||
|
await waitFor(element(by.id(`room-members-view-item-${ user.username }`))).toExist().withTimeout(60000);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should remove member from team', async() => {
|
||||||
|
await openActionSheet('rocket.cat');
|
||||||
|
await element(by.id('action-sheet-remove-from-team')).tap();
|
||||||
|
await waitFor(element(by.id('select-list-view'))).toExist().withTimeout(5000);
|
||||||
|
await waitFor(element(by.id(`select-list-view-item-${ room }`))).toExist().withTimeout(5000);
|
||||||
|
await element(by.id(`select-list-view-item-${ room }`)).tap();
|
||||||
|
await waitFor(element(by.id(`${ room }-checked`))).toExist().withTimeout(5000);
|
||||||
|
await element(by.id(`select-list-view-item-${ room }`)).tap();
|
||||||
|
await waitFor(element(by.id(`${ room }-unchecked`))).toExist().withTimeout(5000);
|
||||||
|
await element(by.id('select-list-view-submit')).tap();
|
||||||
|
await waitFor(element(by.id('room-members-view-item-rocket.cat'))).toBeNotVisible().withTimeout(60000);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should set member as owner', async() => {
|
||||||
|
await openActionSheet(user.username);
|
||||||
|
await element(by.id('action-sheet-set-owner')).tap();
|
||||||
|
await waitForToast();
|
||||||
|
|
||||||
|
await openActionSheet(user.username);
|
||||||
|
await waitFor(element(by.id('action-sheet-set-owner-checked'))).toBeVisible().withTimeout(6000);
|
||||||
|
await closeActionSheet();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should leave team', async() => {
|
||||||
|
await tapBack();
|
||||||
|
await element(by.id('room-actions-scrollview')).scrollTo('bottom');
|
||||||
|
await waitFor(element(by.id('room-actions-leave-channel'))).toExist().withTimeout(2000);
|
||||||
|
await element(by.id('room-actions-leave-channel')).tap();
|
||||||
|
|
||||||
|
await waitFor(element(by.id('select-list-view'))).toExist().withTimeout(2000);
|
||||||
|
await waitFor(element(by.id(`select-list-view-item-${room}`))).toExist().withTimeout(2000);
|
||||||
|
await waitFor(element(by.id(`select-list-view-item-${existingRoom}`))).toExist().withTimeout(2000);
|
||||||
|
await element(by.id(`select-list-view-item-${room}`)).tap();
|
||||||
|
|
||||||
|
await waitFor(element(by.label('You are the last owner of this channel. Once you leave the team, the channel will be kept inside the team but you will be managing it from outside.'))).toExist().withTimeout(2000);
|
||||||
|
await element(by.text('OK')).tap();
|
||||||
|
await waitFor(element(by.id('select-list-view-submit'))).toExist().withTimeout(2000);
|
||||||
|
await element(by.id('select-list-view-submit')).tap();
|
||||||
|
await waitFor(element(by.text(`You were removed from ${ team }`))).toExist().withTimeout(8000);
|
||||||
|
await element(by.text('OK')).tap();
|
||||||
|
await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(5000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,89 @@
|
||||||
|
const {
|
||||||
|
device, expect, element, by, waitFor
|
||||||
|
} = require('detox');
|
||||||
|
const data = require('../../data');
|
||||||
|
const { navigateToLogin, login, tapBack, searchRoom, sleep } = require('../../helpers/app');
|
||||||
|
|
||||||
|
const toBeConverted = `to-be-converted-${ data.random }`;
|
||||||
|
const toBeMoved = `to-be-moved-${ data.random }`;
|
||||||
|
|
||||||
|
const createChannel = async(room) => {
|
||||||
|
await element(by.id('rooms-list-view-create-channel')).tap();
|
||||||
|
await waitFor(element(by.id('new-message-view'))).toExist().withTimeout(5000);
|
||||||
|
await element(by.id('new-message-view-create-channel')).tap();
|
||||||
|
await waitFor(element(by.id('select-users-view'))).toExist().withTimeout(5000);
|
||||||
|
await element(by.id('selected-users-view-submit')).tap();
|
||||||
|
await waitFor(element(by.id('create-channel-view'))).toExist().withTimeout(10000);
|
||||||
|
await element(by.id('create-channel-name')).typeText(room);
|
||||||
|
await element(by.id('create-channel-submit')).tap();
|
||||||
|
await waitFor(element(by.id('room-view'))).toExist().withTimeout(60000);
|
||||||
|
await waitFor(element(by.id(`room-view-title-${ room }`))).toExist().withTimeout(60000);
|
||||||
|
await tapBack();
|
||||||
|
await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(2000);
|
||||||
|
await waitFor(element(by.id(`rooms-list-view-item-${ room }`))).toExist().withTimeout(60000);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function navigateToRoom(room) {
|
||||||
|
await searchRoom(`${ room }`);
|
||||||
|
await element(by.id(`rooms-list-view-item-${ room }`)).tap();
|
||||||
|
await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(5000);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function navigateToRoomActions(room) {
|
||||||
|
await navigateToRoom(room);
|
||||||
|
await element(by.id('room-header')).tap();
|
||||||
|
await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(5000);
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Move/Convert Team', () => {
|
||||||
|
before(async() => {
|
||||||
|
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
|
||||||
|
await navigateToLogin();
|
||||||
|
await login(data.users.regular.username, data.users.regular.password);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Convert', async() => {
|
||||||
|
before(async() => {
|
||||||
|
await createChannel(toBeConverted);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should convert channel to a team', async() => {
|
||||||
|
await navigateToRoomActions(toBeConverted);
|
||||||
|
await element(by.id('room-actions-scrollview')).scrollTo('bottom');
|
||||||
|
await waitFor(element(by.id('room-actions-convert-to-team'))).toExist().withTimeout(2000);
|
||||||
|
await element(by.id('room-actions-convert-to-team')).tap();
|
||||||
|
await waitFor(element(by.label('This can\'t be undone. Once you convert a channel to a team, you can not turn it back to a channel.'))).toExist().withTimeout(2000);
|
||||||
|
await element(by.text('Convert')).tap();
|
||||||
|
await waitFor(element(by.id('room-view'))).toExist().withTimeout(20000);
|
||||||
|
await waitFor(element(by.id(`room-view-title-${ toBeConverted }`))).toExist().withTimeout(6000);
|
||||||
|
});
|
||||||
|
|
||||||
|
after(async() => {
|
||||||
|
await tapBack();
|
||||||
|
await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(2000);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Move', async() => {
|
||||||
|
before(async() => {
|
||||||
|
await createChannel(toBeMoved);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should move channel to a team', async() => {
|
||||||
|
await navigateToRoomActions(toBeMoved);
|
||||||
|
await element(by.id('room-actions-scrollview')).scrollTo('bottom');
|
||||||
|
await waitFor(element(by.id('room-actions-move-to-team'))).toExist().withTimeout(2000);
|
||||||
|
await element(by.id('room-actions-move-to-team')).tap();
|
||||||
|
await waitFor(element(by.id('select-list-view'))).toExist().withTimeout(2000);
|
||||||
|
await element(by.id('select-list-view-submit')).tap();
|
||||||
|
await sleep(2000);
|
||||||
|
await waitFor(element(by.id('select-list-view'))).toExist().withTimeout(2000);
|
||||||
|
await waitFor(element(by.id(`select-list-view-item-${toBeConverted}`))).toExist().withTimeout(2000);
|
||||||
|
await element(by.id(`select-list-view-item-${toBeConverted}`)).tap();
|
||||||
|
await element(by.id('select-list-view-submit')).atIndex(0).tap();
|
||||||
|
await waitFor(element(by.label('After reading the previous intructions about this behavior, do you still want to move this channel to the selected team?'))).toExist().withTimeout(2000);
|
||||||
|
await element(by.text('Yes, move it!')).tap();
|
||||||
|
await waitFor(element(by.id('room-view-header-team-channels'))).toExist().withTimeout(10000);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
});
|
Loading…
Reference in New Issue