2022-08-26 13:21:25 +00:00
|
|
|
import { NavigationProp, RouteProp, useNavigation, useRoute } from '@react-navigation/native';
|
|
|
|
import React, { useEffect, useReducer } from 'react';
|
|
|
|
import { FlatList, Text, View } from 'react-native';
|
|
|
|
|
|
|
|
import { TActionSheetOptionsItem, useActionSheet } from '../../containers/ActionSheet';
|
2022-02-25 16:43:42 +00:00
|
|
|
import ActivityIndicator from '../../containers/ActivityIndicator';
|
2022-08-26 13:21:25 +00:00
|
|
|
import { CustomIcon } from '../../containers/CustomIcon';
|
2022-02-25 16:43:42 +00:00
|
|
|
import * as HeaderButton from '../../containers/HeaderButton';
|
2021-09-13 20:41:05 +00:00
|
|
|
import * as List from '../../containers/List';
|
2022-08-26 13:21:25 +00:00
|
|
|
import { RadioButton } from '../../containers/RadioButton';
|
2022-02-25 16:43:42 +00:00
|
|
|
import SafeAreaView from '../../containers/SafeAreaView';
|
|
|
|
import SearchBox from '../../containers/SearchBox';
|
|
|
|
import StatusBar from '../../containers/StatusBar';
|
2022-04-09 02:43:31 +00:00
|
|
|
import UserItem from '../../containers/UserItem';
|
2022-08-26 13:21:25 +00:00
|
|
|
import { TSubscriptionModel, TUserModel } from '../../definitions';
|
|
|
|
import I18n from '../../i18n';
|
|
|
|
import { useAppSelector, usePermissions } from '../../lib/hooks';
|
|
|
|
import { getRoomTitle, isGroupChat } from '../../lib/methods/helpers';
|
2022-10-13 21:29:55 +00:00
|
|
|
import { handleIgnore } from '../../lib/methods/helpers/handleIgnore';
|
2022-08-26 13:21:25 +00:00
|
|
|
import { showConfirmationAlert } from '../../lib/methods/helpers/info';
|
2022-06-06 14:17:51 +00:00
|
|
|
import log from '../../lib/methods/helpers/log';
|
|
|
|
import scrollPersistTaps from '../../lib/methods/helpers/scrollPersistTaps';
|
2022-08-26 13:21:25 +00:00
|
|
|
import { Services } from '../../lib/services';
|
2022-05-03 00:48:08 +00:00
|
|
|
import { TSupportedPermissions } from '../../reducers/permissions';
|
2022-08-26 13:21:25 +00:00
|
|
|
import { getUserSelector } from '../../selectors/login';
|
|
|
|
import { ModalStackParamList } from '../../stacks/MasterDetailStack/types';
|
|
|
|
import { useTheme } from '../../theme';
|
|
|
|
import ActionsSection from './components/ActionsSection';
|
|
|
|
import {
|
|
|
|
fetchRole,
|
|
|
|
fetchRoomMembersRoles,
|
|
|
|
handleLeader,
|
|
|
|
handleModerator,
|
|
|
|
handleMute,
|
|
|
|
handleOwner,
|
|
|
|
handleRemoveFromTeam,
|
|
|
|
handleRemoveUserFromRoom,
|
|
|
|
navToDirectMessage,
|
|
|
|
TRoomType
|
|
|
|
} from './helpers';
|
2021-09-13 20:41:05 +00:00
|
|
|
import styles from './styles';
|
2018-03-02 15:11:34 +00:00
|
|
|
|
2019-04-17 17:01:03 +00:00
|
|
|
const PAGE_SIZE = 25;
|
|
|
|
|
2022-02-25 16:43:42 +00:00
|
|
|
interface IRoomMembersViewState {
|
|
|
|
isLoading: boolean;
|
|
|
|
allUsers: boolean;
|
2022-08-19 17:27:04 +00:00
|
|
|
filtering: string;
|
2022-02-25 16:43:42 +00:00
|
|
|
members: TUserModel[];
|
2022-05-03 00:48:08 +00:00
|
|
|
room: TSubscriptionModel;
|
2022-02-25 16:43:42 +00:00
|
|
|
end: boolean;
|
2022-08-26 13:21:25 +00:00
|
|
|
roomRoles: any;
|
|
|
|
filter: string;
|
2022-08-19 17:27:04 +00:00
|
|
|
page: number;
|
2022-02-25 16:43:42 +00:00
|
|
|
}
|
2018-03-02 15:11:34 +00:00
|
|
|
|
2022-08-26 13:21:25 +00:00
|
|
|
const RightIcon = ({ check, label }: { check: boolean; label: string }) => {
|
|
|
|
const { colors } = useTheme();
|
|
|
|
return (
|
|
|
|
<CustomIcon
|
|
|
|
testID={check ? `action-sheet-set-${label}-checked` : `action-sheet-set-${label}-unchecked`}
|
|
|
|
name={check ? 'checkbox-checked' : 'checkbox-unchecked'}
|
|
|
|
size={20}
|
|
|
|
color={check ? colors.tintActive : colors.auxiliaryTintColor}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
const RoomMembersView = (): React.ReactElement => {
|
|
|
|
const { showActionSheet } = useActionSheet();
|
|
|
|
const { colors } = useTheme();
|
|
|
|
|
|
|
|
const { params } = useRoute<RouteProp<ModalStackParamList, 'RoomMembersView'>>();
|
|
|
|
const navigation = useNavigation<NavigationProp<ModalStackParamList, 'RoomMembersView'>>();
|
|
|
|
|
|
|
|
const isMasterDetail = useAppSelector(state => state.app.isMasterDetail);
|
|
|
|
|
|
|
|
const useRealName = useAppSelector(state => state.settings.UI_Use_Real_Name);
|
|
|
|
const user = useAppSelector(state => getUserSelector(state));
|
|
|
|
|
|
|
|
const [state, updateState] = useReducer(
|
|
|
|
(state: IRoomMembersViewState, newState: Partial<IRoomMembersViewState>) => ({ ...state, ...newState }),
|
|
|
|
{
|
2019-04-17 17:01:03 +00:00
|
|
|
isLoading: false,
|
2018-03-02 15:11:34 +00:00
|
|
|
allUsers: false,
|
2022-08-19 17:27:04 +00:00
|
|
|
filtering: '',
|
2019-04-17 17:01:03 +00:00
|
|
|
members: [],
|
2022-08-26 13:21:25 +00:00
|
|
|
room: params.room || ({} as TSubscriptionModel),
|
2022-08-19 17:27:04 +00:00
|
|
|
end: false,
|
2022-08-26 13:21:25 +00:00
|
|
|
roomRoles: null,
|
|
|
|
filter: '',
|
2022-08-19 17:27:04 +00:00
|
|
|
page: 0
|
2019-09-17 14:43:49 +00:00
|
|
|
}
|
2022-08-26 13:21:25 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
const teamPermissions: TSupportedPermissions[] = state.room.teamMain
|
|
|
|
? ['edit-team-member', 'view-all-team-channels', 'view-all-teams']
|
|
|
|
: [];
|
|
|
|
|
|
|
|
const [
|
|
|
|
muteUserPermission,
|
|
|
|
setLeaderPermission,
|
|
|
|
setOwnerPermission,
|
|
|
|
setModeratorPermission,
|
|
|
|
removeUserPermission,
|
|
|
|
editTeamMemberPermission,
|
|
|
|
viewAllTeamChannelsPermission,
|
|
|
|
viewAllTeamsPermission
|
|
|
|
] = usePermissions(['mute-user', 'set-leader', 'set-owner', 'set-moderator', 'remove-user', ...teamPermissions], params.rid);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
const subscription = params?.room?.observe && params.room.observe().subscribe(changes => updateState({ room: changes }));
|
|
|
|
setHeader(true);
|
|
|
|
fetchMembers(true);
|
|
|
|
return () => subscription?.unsubscribe();
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
const fetchRoles = () => {
|
|
|
|
if (isGroupChat(state.room)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (
|
|
|
|
muteUserPermission ||
|
|
|
|
setLeaderPermission ||
|
|
|
|
setOwnerPermission ||
|
|
|
|
setModeratorPermission ||
|
|
|
|
removeUserPermission ||
|
|
|
|
editTeamMemberPermission ||
|
|
|
|
viewAllTeamChannelsPermission ||
|
|
|
|
viewAllTeamsPermission
|
|
|
|
) {
|
|
|
|
fetchRoomMembersRoles(state.room.t as any, state.room.rid, updateState);
|
|
|
|
}
|
2021-02-25 16:41:44 +00:00
|
|
|
};
|
2022-08-26 13:21:25 +00:00
|
|
|
fetchRoles();
|
|
|
|
}, [
|
|
|
|
muteUserPermission,
|
|
|
|
setLeaderPermission,
|
|
|
|
setOwnerPermission,
|
|
|
|
setModeratorPermission,
|
|
|
|
removeUserPermission,
|
|
|
|
editTeamMemberPermission,
|
|
|
|
viewAllTeamChannelsPermission,
|
|
|
|
viewAllTeamsPermission
|
|
|
|
]);
|
|
|
|
|
|
|
|
const toggleStatus = (status: boolean) => {
|
|
|
|
try {
|
|
|
|
updateState({ members: [], allUsers: status, end: false });
|
|
|
|
fetchMembers(status);
|
|
|
|
setHeader(status);
|
|
|
|
} catch (e) {
|
|
|
|
log(e);
|
2019-09-16 20:26:32 +00:00
|
|
|
}
|
2022-08-26 13:21:25 +00:00
|
|
|
};
|
2018-04-24 19:34:03 +00:00
|
|
|
|
2022-08-26 13:21:25 +00:00
|
|
|
const setHeader = (allUsers: boolean) => {
|
2020-06-15 14:00:46 +00:00
|
|
|
navigation.setOptions({
|
|
|
|
title: I18n.t('Members'),
|
|
|
|
headerRight: () => (
|
2020-10-30 16:15:58 +00:00
|
|
|
<HeaderButton.Container>
|
2022-08-26 13:21:25 +00:00
|
|
|
<HeaderButton.Item
|
|
|
|
iconName='filter'
|
|
|
|
onPress={() =>
|
|
|
|
showActionSheet({
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
title: I18n.t('Online'),
|
|
|
|
onPress: () => toggleStatus(true),
|
|
|
|
right: () => <RadioButton check={allUsers} />,
|
|
|
|
testID: 'room-members-view-toggle-status-online'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: I18n.t('All'),
|
|
|
|
onPress: () => toggleStatus(false),
|
|
|
|
right: () => <RadioButton check={!allUsers} />,
|
|
|
|
testID: 'room-members-view-toggle-status-all'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
}
|
|
|
|
testID='room-members-view-filter'
|
|
|
|
/>
|
2020-10-30 16:15:58 +00:00
|
|
|
</HeaderButton.Container>
|
2020-06-15 14:00:46 +00:00
|
|
|
)
|
|
|
|
});
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2020-06-15 14:00:46 +00:00
|
|
|
|
2022-08-26 13:21:25 +00:00
|
|
|
const getUserDisplayName = (user: TUserModel) => (useRealName ? user.name : user.username) || user.username;
|
2022-08-19 17:27:04 +00:00
|
|
|
|
2022-08-26 13:21:25 +00:00
|
|
|
const onPressUser = (selectedUser: TUserModel) => {
|
|
|
|
const { room, roomRoles, members } = state;
|
2018-12-21 10:55:35 +00:00
|
|
|
|
2022-05-03 00:48:08 +00:00
|
|
|
const options: TActionSheetOptionsItem[] = [
|
2021-09-13 20:41:05 +00:00
|
|
|
{
|
|
|
|
icon: 'message',
|
|
|
|
title: I18n.t('Direct_message'),
|
2022-08-26 13:21:25 +00:00
|
|
|
onPress: () => navToDirectMessage(selectedUser, isMasterDetail)
|
2021-09-13 20:41:05 +00:00
|
|
|
}
|
|
|
|
];
|
2020-06-15 19:35:45 +00:00
|
|
|
|
[NEW] Remove member from team (#3117)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Added SelectListView and logic for leaving team
* Added addTeamMember and removeTeamMember
* Minor tweak
* Minor tweak
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Remove unnecesary prop
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* Minor refactor to ListItem, add SelectListView to ModalStack, update handleLeaveTeam
* Minor tweaks
* Update SelectListView
* Update handleLeaveTeam, remove unnecessary method, add story
* Minor tweak
* Minor visual tweaks
* Update SelectListView.js
* Update RoomMembersView
* Updated SelectListView, RoomActionsView, leaveTeam method and string translations
* Update SelectListVIew
* Minor tweak
* Update SelectListView
* Minor tweak
* Minor tweaks
* Fix for List.Item subtitles being pushed down by title's flex
* Minor tweaks
* Update RoomActionsView
* Use showConfirmationAlert and showErrorAlert
* Remove addTeamMember, update removeTeamMember
* Update Alert
* Minor tweaks
* Minor tweaks
* Minor tweak
* Update showActionSheet on RoomMembersView
* Remove team main from query and move code around
* Fetch roles
* Update RoomMembersView and SelectListView
* Updated leaveTeam and handleRemoveFromTeam
* Fix validation
* Remove unnecessary function
* Added confirmationAlert for missing permissions case
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-26 21:01:06 +00:00
|
|
|
// Ignore
|
|
|
|
if (selectedUser._id !== user.id) {
|
|
|
|
const { ignored } = room;
|
|
|
|
const isIgnored = ignored?.includes?.(selectedUser._id);
|
|
|
|
options.push({
|
|
|
|
icon: 'ignore',
|
|
|
|
title: I18n.t(isIgnored ? 'Unignore' : 'Ignore'),
|
2022-10-13 21:29:55 +00:00
|
|
|
onPress: () => handleIgnore(selectedUser._id, !isIgnored, room.rid),
|
[TEST] E2E Tests for Teams (#3178)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Added SelectListView and logic for leaving team
* Added addTeamMember and removeTeamMember
* Minor tweak
* Added deleteTeam function
* Minor tweak
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Remove unnecesary prop
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* Minor refactor to ListItem, add SelectListView to ModalStack, update handleLeaveTeam
* Minor tweaks
* Update SelectListView
* Update handleLeaveTeam, remove unnecessary method, add story
* Minor tweak
* Minor visual tweaks
* Update SelectListView.js
* Update index.js
* Update RoomMembersView
* Updated SelectListView, RoomActionsView, leaveTeam method and string translations
* Update SelectListVIew
* Minor tweak
* Update SelectListView
* Minor tweak
* Minor tweaks
* Fix for List.Item subtitles being pushed down by title's flex
* Minor tweaks
* Update RoomActionsView
* Use showConfirmationAlert and showErrorAlert
* Remove addTeamMember, update removeTeamMember
* Update Alert
* Minor tweaks
* Minor tweaks
* Minor tweak
* Update showActionSheet on RoomMembersView
* Remove team main from query and move code around
* Fetch roles
* Update RoomMembersView and SelectListView
* Update rocketchat.js
* Updated leaveTeam and handleRemoveFromTeam
* Fix validation
* Remove unnecessary function
* Update RoomActionsView
* Update en.json
* updated deleteTeam function and permissions
* Added showConfirmationAlert
* Added string translations for teams
* Fix permission
* Added moveChannelToTeam and convertToTeam functionality
* Fix SelectListView RadioButton
* Fix moveToTeam
* Added searchBar to SelectListVIew
* Update RoomView , SelectListVIew and string translation for error
* E2E for Teams
* Fix tests and cleanup
* Minor refactor
* Wrong label
* Move/convert
* Fix convert
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-06-04 16:16:05 +00:00
|
|
|
testID: 'action-sheet-ignore-user'
|
[NEW] Remove member from team (#3117)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Added SelectListView and logic for leaving team
* Added addTeamMember and removeTeamMember
* Minor tweak
* Minor tweak
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Remove unnecesary prop
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* Minor refactor to ListItem, add SelectListView to ModalStack, update handleLeaveTeam
* Minor tweaks
* Update SelectListView
* Update handleLeaveTeam, remove unnecessary method, add story
* Minor tweak
* Minor visual tweaks
* Update SelectListView.js
* Update RoomMembersView
* Updated SelectListView, RoomActionsView, leaveTeam method and string translations
* Update SelectListVIew
* Minor tweak
* Update SelectListView
* Minor tweak
* Minor tweaks
* Fix for List.Item subtitles being pushed down by title's flex
* Minor tweaks
* Update RoomActionsView
* Use showConfirmationAlert and showErrorAlert
* Remove addTeamMember, update removeTeamMember
* Update Alert
* Minor tweaks
* Minor tweaks
* Minor tweak
* Update showActionSheet on RoomMembersView
* Remove team main from query and move code around
* Fetch roles
* Update RoomMembersView and SelectListView
* Updated leaveTeam and handleRemoveFromTeam
* Fix validation
* Remove unnecessary function
* Added confirmationAlert for missing permissions case
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-26 21:01:06 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-08-26 13:21:25 +00:00
|
|
|
if (muteUserPermission) {
|
[NEW] Remove member from team (#3117)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Added SelectListView and logic for leaving team
* Added addTeamMember and removeTeamMember
* Minor tweak
* Minor tweak
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Remove unnecesary prop
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* Minor refactor to ListItem, add SelectListView to ModalStack, update handleLeaveTeam
* Minor tweaks
* Update SelectListView
* Update handleLeaveTeam, remove unnecessary method, add story
* Minor tweak
* Minor visual tweaks
* Update SelectListView.js
* Update RoomMembersView
* Updated SelectListView, RoomActionsView, leaveTeam method and string translations
* Update SelectListVIew
* Minor tweak
* Update SelectListView
* Minor tweak
* Minor tweaks
* Fix for List.Item subtitles being pushed down by title's flex
* Minor tweaks
* Update RoomActionsView
* Use showConfirmationAlert and showErrorAlert
* Remove addTeamMember, update removeTeamMember
* Update Alert
* Minor tweaks
* Minor tweaks
* Minor tweak
* Update showActionSheet on RoomMembersView
* Remove team main from query and move code around
* Fetch roles
* Update RoomMembersView and SelectListView
* Updated leaveTeam and handleRemoveFromTeam
* Fix validation
* Remove unnecessary function
* Added confirmationAlert for missing permissions case
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-26 21:01:06 +00:00
|
|
|
const { muted = [] } = room;
|
|
|
|
const userIsMuted = muted.find?.(m => m === selectedUser.username);
|
|
|
|
selectedUser.muted = !!userIsMuted;
|
|
|
|
options.push({
|
|
|
|
icon: userIsMuted ? 'audio' : 'audio-disabled',
|
|
|
|
title: I18n.t(userIsMuted ? 'Unmute' : 'Mute'),
|
|
|
|
onPress: () => {
|
|
|
|
showConfirmationAlert({
|
2021-09-13 20:41:05 +00:00
|
|
|
message: I18n.t(`The_user_${userIsMuted ? 'will' : 'wont'}_be_able_to_type_in_roomName`, {
|
2022-04-28 20:37:25 +00:00
|
|
|
roomName: getRoomTitle(room)
|
[NEW] Remove member from team (#3117)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Added SelectListView and logic for leaving team
* Added addTeamMember and removeTeamMember
* Minor tweak
* Minor tweak
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Remove unnecesary prop
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* Minor refactor to ListItem, add SelectListView to ModalStack, update handleLeaveTeam
* Minor tweaks
* Update SelectListView
* Update handleLeaveTeam, remove unnecessary method, add story
* Minor tweak
* Minor visual tweaks
* Update SelectListView.js
* Update RoomMembersView
* Updated SelectListView, RoomActionsView, leaveTeam method and string translations
* Update SelectListVIew
* Minor tweak
* Update SelectListView
* Minor tweak
* Minor tweaks
* Fix for List.Item subtitles being pushed down by title's flex
* Minor tweaks
* Update RoomActionsView
* Use showConfirmationAlert and showErrorAlert
* Remove addTeamMember, update removeTeamMember
* Update Alert
* Minor tweaks
* Minor tweaks
* Minor tweak
* Update showActionSheet on RoomMembersView
* Remove team main from query and move code around
* Fetch roles
* Update RoomMembersView and SelectListView
* Updated leaveTeam and handleRemoveFromTeam
* Fix validation
* Remove unnecessary function
* Added confirmationAlert for missing permissions case
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-26 21:01:06 +00:00
|
|
|
}),
|
|
|
|
confirmationText: I18n.t(userIsMuted ? 'Unmute' : 'Mute'),
|
2022-08-26 13:21:25 +00:00
|
|
|
onPress: () => handleMute(selectedUser, room.rid)
|
[NEW] Remove member from team (#3117)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Added SelectListView and logic for leaving team
* Added addTeamMember and removeTeamMember
* Minor tweak
* Minor tweak
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Remove unnecesary prop
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* Minor refactor to ListItem, add SelectListView to ModalStack, update handleLeaveTeam
* Minor tweaks
* Update SelectListView
* Update handleLeaveTeam, remove unnecessary method, add story
* Minor tweak
* Minor visual tweaks
* Update SelectListView.js
* Update RoomMembersView
* Updated SelectListView, RoomActionsView, leaveTeam method and string translations
* Update SelectListVIew
* Minor tweak
* Update SelectListView
* Minor tweak
* Minor tweaks
* Fix for List.Item subtitles being pushed down by title's flex
* Minor tweaks
* Update RoomActionsView
* Use showConfirmationAlert and showErrorAlert
* Remove addTeamMember, update removeTeamMember
* Update Alert
* Minor tweaks
* Minor tweaks
* Minor tweak
* Update showActionSheet on RoomMembersView
* Remove team main from query and move code around
* Fetch roles
* Update RoomMembersView and SelectListView
* Updated leaveTeam and handleRemoveFromTeam
* Fix validation
* Remove unnecessary function
* Added confirmationAlert for missing permissions case
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-26 21:01:06 +00:00
|
|
|
});
|
[TEST] E2E Tests for Teams (#3178)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Added SelectListView and logic for leaving team
* Added addTeamMember and removeTeamMember
* Minor tweak
* Added deleteTeam function
* Minor tweak
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Remove unnecesary prop
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* Minor refactor to ListItem, add SelectListView to ModalStack, update handleLeaveTeam
* Minor tweaks
* Update SelectListView
* Update handleLeaveTeam, remove unnecessary method, add story
* Minor tweak
* Minor visual tweaks
* Update SelectListView.js
* Update index.js
* Update RoomMembersView
* Updated SelectListView, RoomActionsView, leaveTeam method and string translations
* Update SelectListVIew
* Minor tweak
* Update SelectListView
* Minor tweak
* Minor tweaks
* Fix for List.Item subtitles being pushed down by title's flex
* Minor tweaks
* Update RoomActionsView
* Use showConfirmationAlert and showErrorAlert
* Remove addTeamMember, update removeTeamMember
* Update Alert
* Minor tweaks
* Minor tweaks
* Minor tweak
* Update showActionSheet on RoomMembersView
* Remove team main from query and move code around
* Fetch roles
* Update RoomMembersView and SelectListView
* Update rocketchat.js
* Updated leaveTeam and handleRemoveFromTeam
* Fix validation
* Remove unnecessary function
* Update RoomActionsView
* Update en.json
* updated deleteTeam function and permissions
* Added showConfirmationAlert
* Added string translations for teams
* Fix permission
* Added moveChannelToTeam and convertToTeam functionality
* Fix SelectListView RadioButton
* Fix moveToTeam
* Added searchBar to SelectListVIew
* Update RoomView , SelectListVIew and string translation for error
* E2E for Teams
* Fix tests and cleanup
* Minor refactor
* Wrong label
* Move/convert
* Fix convert
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-06-04 16:16:05 +00:00
|
|
|
},
|
|
|
|
testID: 'action-sheet-mute-user'
|
[NEW] Remove member from team (#3117)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Added SelectListView and logic for leaving team
* Added addTeamMember and removeTeamMember
* Minor tweak
* Minor tweak
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Remove unnecesary prop
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* Minor refactor to ListItem, add SelectListView to ModalStack, update handleLeaveTeam
* Minor tweaks
* Update SelectListView
* Update handleLeaveTeam, remove unnecessary method, add story
* Minor tweak
* Minor visual tweaks
* Update SelectListView.js
* Update RoomMembersView
* Updated SelectListView, RoomActionsView, leaveTeam method and string translations
* Update SelectListVIew
* Minor tweak
* Update SelectListView
* Minor tweak
* Minor tweaks
* Fix for List.Item subtitles being pushed down by title's flex
* Minor tweaks
* Update RoomActionsView
* Use showConfirmationAlert and showErrorAlert
* Remove addTeamMember, update removeTeamMember
* Update Alert
* Minor tweaks
* Minor tweaks
* Minor tweak
* Update showActionSheet on RoomMembersView
* Remove team main from query and move code around
* Fetch roles
* Update RoomMembersView and SelectListView
* Updated leaveTeam and handleRemoveFromTeam
* Fix validation
* Remove unnecessary function
* Added confirmationAlert for missing permissions case
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-26 21:01:06 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-11-30 20:00:31 +00:00
|
|
|
// Owner
|
2022-08-26 13:21:25 +00:00
|
|
|
if (setOwnerPermission) {
|
|
|
|
const isOwner = fetchRole('owner', selectedUser, roomRoles);
|
2020-11-30 20:00:31 +00:00
|
|
|
options.push({
|
|
|
|
icon: 'shield-check',
|
[NEW] Remove member from team (#3117)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Added SelectListView and logic for leaving team
* Added addTeamMember and removeTeamMember
* Minor tweak
* Minor tweak
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Remove unnecesary prop
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* Minor refactor to ListItem, add SelectListView to ModalStack, update handleLeaveTeam
* Minor tweaks
* Update SelectListView
* Update handleLeaveTeam, remove unnecessary method, add story
* Minor tweak
* Minor visual tweaks
* Update SelectListView.js
* Update RoomMembersView
* Updated SelectListView, RoomActionsView, leaveTeam method and string translations
* Update SelectListVIew
* Minor tweak
* Update SelectListView
* Minor tweak
* Minor tweaks
* Fix for List.Item subtitles being pushed down by title's flex
* Minor tweaks
* Update RoomActionsView
* Use showConfirmationAlert and showErrorAlert
* Remove addTeamMember, update removeTeamMember
* Update Alert
* Minor tweaks
* Minor tweaks
* Minor tweak
* Update showActionSheet on RoomMembersView
* Remove team main from query and move code around
* Fetch roles
* Update RoomMembersView and SelectListView
* Updated leaveTeam and handleRemoveFromTeam
* Fix validation
* Remove unnecessary function
* Added confirmationAlert for missing permissions case
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-26 21:01:06 +00:00
|
|
|
title: I18n.t('Owner'),
|
2022-08-26 13:21:25 +00:00
|
|
|
onPress: () =>
|
|
|
|
handleOwner(selectedUser, !isOwner, getUserDisplayName(selectedUser), room, () =>
|
|
|
|
fetchRoomMembersRoles(room.t as TRoomType, room.rid, updateState)
|
|
|
|
),
|
|
|
|
right: () => <RightIcon check={isOwner} label='owner' />,
|
[TEST] E2E Tests for Teams (#3178)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Added SelectListView and logic for leaving team
* Added addTeamMember and removeTeamMember
* Minor tweak
* Added deleteTeam function
* Minor tweak
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Remove unnecesary prop
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* Minor refactor to ListItem, add SelectListView to ModalStack, update handleLeaveTeam
* Minor tweaks
* Update SelectListView
* Update handleLeaveTeam, remove unnecessary method, add story
* Minor tweak
* Minor visual tweaks
* Update SelectListView.js
* Update index.js
* Update RoomMembersView
* Updated SelectListView, RoomActionsView, leaveTeam method and string translations
* Update SelectListVIew
* Minor tweak
* Update SelectListView
* Minor tweak
* Minor tweaks
* Fix for List.Item subtitles being pushed down by title's flex
* Minor tweaks
* Update RoomActionsView
* Use showConfirmationAlert and showErrorAlert
* Remove addTeamMember, update removeTeamMember
* Update Alert
* Minor tweaks
* Minor tweaks
* Minor tweak
* Update showActionSheet on RoomMembersView
* Remove team main from query and move code around
* Fetch roles
* Update RoomMembersView and SelectListView
* Update rocketchat.js
* Updated leaveTeam and handleRemoveFromTeam
* Fix validation
* Remove unnecessary function
* Update RoomActionsView
* Update en.json
* updated deleteTeam function and permissions
* Added showConfirmationAlert
* Added string translations for teams
* Fix permission
* Added moveChannelToTeam and convertToTeam functionality
* Fix SelectListView RadioButton
* Fix moveToTeam
* Added searchBar to SelectListVIew
* Update RoomView , SelectListVIew and string translation for error
* E2E for Teams
* Fix tests and cleanup
* Minor refactor
* Wrong label
* Move/convert
* Fix convert
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-06-04 16:16:05 +00:00
|
|
|
testID: 'action-sheet-set-owner'
|
2020-11-30 20:00:31 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// Leader
|
2022-08-26 13:21:25 +00:00
|
|
|
if (setLeaderPermission) {
|
|
|
|
const isLeader = fetchRole('leader', selectedUser, roomRoles);
|
2020-11-30 20:00:31 +00:00
|
|
|
options.push({
|
|
|
|
icon: 'shield-alt',
|
[NEW] Remove member from team (#3117)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Added SelectListView and logic for leaving team
* Added addTeamMember and removeTeamMember
* Minor tweak
* Minor tweak
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Remove unnecesary prop
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* Minor refactor to ListItem, add SelectListView to ModalStack, update handleLeaveTeam
* Minor tweaks
* Update SelectListView
* Update handleLeaveTeam, remove unnecessary method, add story
* Minor tweak
* Minor visual tweaks
* Update SelectListView.js
* Update RoomMembersView
* Updated SelectListView, RoomActionsView, leaveTeam method and string translations
* Update SelectListVIew
* Minor tweak
* Update SelectListView
* Minor tweak
* Minor tweaks
* Fix for List.Item subtitles being pushed down by title's flex
* Minor tweaks
* Update RoomActionsView
* Use showConfirmationAlert and showErrorAlert
* Remove addTeamMember, update removeTeamMember
* Update Alert
* Minor tweaks
* Minor tweaks
* Minor tweak
* Update showActionSheet on RoomMembersView
* Remove team main from query and move code around
* Fetch roles
* Update RoomMembersView and SelectListView
* Updated leaveTeam and handleRemoveFromTeam
* Fix validation
* Remove unnecessary function
* Added confirmationAlert for missing permissions case
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-26 21:01:06 +00:00
|
|
|
title: I18n.t('Leader'),
|
2022-08-26 13:21:25 +00:00
|
|
|
onPress: () =>
|
|
|
|
handleLeader(selectedUser, !isLeader, room, getUserDisplayName(selectedUser), () =>
|
|
|
|
fetchRoomMembersRoles(room.t as TRoomType, room.rid, updateState)
|
|
|
|
),
|
|
|
|
right: () => <RightIcon check={isLeader} label='leader' />,
|
[TEST] E2E Tests for Teams (#3178)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Added SelectListView and logic for leaving team
* Added addTeamMember and removeTeamMember
* Minor tweak
* Added deleteTeam function
* Minor tweak
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Remove unnecesary prop
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* Minor refactor to ListItem, add SelectListView to ModalStack, update handleLeaveTeam
* Minor tweaks
* Update SelectListView
* Update handleLeaveTeam, remove unnecessary method, add story
* Minor tweak
* Minor visual tweaks
* Update SelectListView.js
* Update index.js
* Update RoomMembersView
* Updated SelectListView, RoomActionsView, leaveTeam method and string translations
* Update SelectListVIew
* Minor tweak
* Update SelectListView
* Minor tweak
* Minor tweaks
* Fix for List.Item subtitles being pushed down by title's flex
* Minor tweaks
* Update RoomActionsView
* Use showConfirmationAlert and showErrorAlert
* Remove addTeamMember, update removeTeamMember
* Update Alert
* Minor tweaks
* Minor tweaks
* Minor tweak
* Update showActionSheet on RoomMembersView
* Remove team main from query and move code around
* Fetch roles
* Update RoomMembersView and SelectListView
* Update rocketchat.js
* Updated leaveTeam and handleRemoveFromTeam
* Fix validation
* Remove unnecessary function
* Update RoomActionsView
* Update en.json
* updated deleteTeam function and permissions
* Added showConfirmationAlert
* Added string translations for teams
* Fix permission
* Added moveChannelToTeam and convertToTeam functionality
* Fix SelectListView RadioButton
* Fix moveToTeam
* Added searchBar to SelectListVIew
* Update RoomView , SelectListVIew and string translation for error
* E2E for Teams
* Fix tests and cleanup
* Minor refactor
* Wrong label
* Move/convert
* Fix convert
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-06-04 16:16:05 +00:00
|
|
|
testID: 'action-sheet-set-leader'
|
2020-11-30 20:00:31 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// Moderator
|
2022-08-26 13:21:25 +00:00
|
|
|
if (setModeratorPermission) {
|
|
|
|
const isModerator = fetchRole('moderator', selectedUser, roomRoles);
|
2020-11-30 20:00:31 +00:00
|
|
|
options.push({
|
|
|
|
icon: 'shield',
|
[NEW] Remove member from team (#3117)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Added SelectListView and logic for leaving team
* Added addTeamMember and removeTeamMember
* Minor tweak
* Minor tweak
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Remove unnecesary prop
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* Minor refactor to ListItem, add SelectListView to ModalStack, update handleLeaveTeam
* Minor tweaks
* Update SelectListView
* Update handleLeaveTeam, remove unnecessary method, add story
* Minor tweak
* Minor visual tweaks
* Update SelectListView.js
* Update RoomMembersView
* Updated SelectListView, RoomActionsView, leaveTeam method and string translations
* Update SelectListVIew
* Minor tweak
* Update SelectListView
* Minor tweak
* Minor tweaks
* Fix for List.Item subtitles being pushed down by title's flex
* Minor tweaks
* Update RoomActionsView
* Use showConfirmationAlert and showErrorAlert
* Remove addTeamMember, update removeTeamMember
* Update Alert
* Minor tweaks
* Minor tweaks
* Minor tweak
* Update showActionSheet on RoomMembersView
* Remove team main from query and move code around
* Fetch roles
* Update RoomMembersView and SelectListView
* Updated leaveTeam and handleRemoveFromTeam
* Fix validation
* Remove unnecessary function
* Added confirmationAlert for missing permissions case
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-26 21:01:06 +00:00
|
|
|
title: I18n.t('Moderator'),
|
2022-08-26 13:21:25 +00:00
|
|
|
onPress: () =>
|
|
|
|
handleModerator(selectedUser, !isModerator, room, getUserDisplayName(selectedUser), () =>
|
|
|
|
fetchRoomMembersRoles(room.t as TRoomType, room.rid, updateState)
|
|
|
|
),
|
|
|
|
right: () => <RightIcon check={isModerator} label='moderator' />,
|
[TEST] E2E Tests for Teams (#3178)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Added SelectListView and logic for leaving team
* Added addTeamMember and removeTeamMember
* Minor tweak
* Added deleteTeam function
* Minor tweak
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Remove unnecesary prop
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* Minor refactor to ListItem, add SelectListView to ModalStack, update handleLeaveTeam
* Minor tweaks
* Update SelectListView
* Update handleLeaveTeam, remove unnecessary method, add story
* Minor tweak
* Minor visual tweaks
* Update SelectListView.js
* Update index.js
* Update RoomMembersView
* Updated SelectListView, RoomActionsView, leaveTeam method and string translations
* Update SelectListVIew
* Minor tweak
* Update SelectListView
* Minor tweak
* Minor tweaks
* Fix for List.Item subtitles being pushed down by title's flex
* Minor tweaks
* Update RoomActionsView
* Use showConfirmationAlert and showErrorAlert
* Remove addTeamMember, update removeTeamMember
* Update Alert
* Minor tweaks
* Minor tweaks
* Minor tweak
* Update showActionSheet on RoomMembersView
* Remove team main from query and move code around
* Fetch roles
* Update RoomMembersView and SelectListView
* Update rocketchat.js
* Updated leaveTeam and handleRemoveFromTeam
* Fix validation
* Remove unnecessary function
* Update RoomActionsView
* Update en.json
* updated deleteTeam function and permissions
* Added showConfirmationAlert
* Added string translations for teams
* Fix permission
* Added moveChannelToTeam and convertToTeam functionality
* Fix SelectListView RadioButton
* Fix moveToTeam
* Added searchBar to SelectListVIew
* Update RoomView , SelectListVIew and string translation for error
* E2E for Teams
* Fix tests and cleanup
* Minor refactor
* Wrong label
* Move/convert
* Fix convert
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-06-04 16:16:05 +00:00
|
|
|
testID: 'action-sheet-set-moderator'
|
2020-11-30 20:00:31 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
[NEW] Remove member from team (#3117)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Added SelectListView and logic for leaving team
* Added addTeamMember and removeTeamMember
* Minor tweak
* Minor tweak
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Remove unnecesary prop
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* Minor refactor to ListItem, add SelectListView to ModalStack, update handleLeaveTeam
* Minor tweaks
* Update SelectListView
* Update handleLeaveTeam, remove unnecessary method, add story
* Minor tweak
* Minor visual tweaks
* Update SelectListView.js
* Update RoomMembersView
* Updated SelectListView, RoomActionsView, leaveTeam method and string translations
* Update SelectListVIew
* Minor tweak
* Update SelectListView
* Minor tweak
* Minor tweaks
* Fix for List.Item subtitles being pushed down by title's flex
* Minor tweaks
* Update RoomActionsView
* Use showConfirmationAlert and showErrorAlert
* Remove addTeamMember, update removeTeamMember
* Update Alert
* Minor tweaks
* Minor tweaks
* Minor tweak
* Update showActionSheet on RoomMembersView
* Remove team main from query and move code around
* Fetch roles
* Update RoomMembersView and SelectListView
* Updated leaveTeam and handleRemoveFromTeam
* Fix validation
* Remove unnecessary function
* Added confirmationAlert for missing permissions case
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-26 21:01:06 +00:00
|
|
|
// Remove from team
|
2022-08-26 13:21:25 +00:00
|
|
|
if (editTeamMemberPermission) {
|
2020-11-30 20:00:31 +00:00
|
|
|
options.push({
|
[NEW] Remove member from team (#3117)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Added SelectListView and logic for leaving team
* Added addTeamMember and removeTeamMember
* Minor tweak
* Minor tweak
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Remove unnecesary prop
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* Minor refactor to ListItem, add SelectListView to ModalStack, update handleLeaveTeam
* Minor tweaks
* Update SelectListView
* Update handleLeaveTeam, remove unnecessary method, add story
* Minor tweak
* Minor visual tweaks
* Update SelectListView.js
* Update RoomMembersView
* Updated SelectListView, RoomActionsView, leaveTeam method and string translations
* Update SelectListVIew
* Minor tweak
* Update SelectListView
* Minor tweak
* Minor tweaks
* Fix for List.Item subtitles being pushed down by title's flex
* Minor tweaks
* Update RoomActionsView
* Use showConfirmationAlert and showErrorAlert
* Remove addTeamMember, update removeTeamMember
* Update Alert
* Minor tweaks
* Minor tweaks
* Minor tweak
* Update showActionSheet on RoomMembersView
* Remove team main from query and move code around
* Fetch roles
* Update RoomMembersView and SelectListView
* Updated leaveTeam and handleRemoveFromTeam
* Fix validation
* Remove unnecessary function
* Added confirmationAlert for missing permissions case
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-26 21:01:06 +00:00
|
|
|
icon: 'logout',
|
|
|
|
danger: true,
|
|
|
|
title: I18n.t('Remove_from_Team'),
|
2022-08-26 13:21:25 +00:00
|
|
|
onPress: () => handleRemoveFromTeam(selectedUser, updateState, room, members),
|
[TEST] E2E Tests for Teams (#3178)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Added SelectListView and logic for leaving team
* Added addTeamMember and removeTeamMember
* Minor tweak
* Added deleteTeam function
* Minor tweak
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Remove unnecesary prop
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* Minor refactor to ListItem, add SelectListView to ModalStack, update handleLeaveTeam
* Minor tweaks
* Update SelectListView
* Update handleLeaveTeam, remove unnecessary method, add story
* Minor tweak
* Minor visual tweaks
* Update SelectListView.js
* Update index.js
* Update RoomMembersView
* Updated SelectListView, RoomActionsView, leaveTeam method and string translations
* Update SelectListVIew
* Minor tweak
* Update SelectListView
* Minor tweak
* Minor tweaks
* Fix for List.Item subtitles being pushed down by title's flex
* Minor tweaks
* Update RoomActionsView
* Use showConfirmationAlert and showErrorAlert
* Remove addTeamMember, update removeTeamMember
* Update Alert
* Minor tweaks
* Minor tweaks
* Minor tweak
* Update showActionSheet on RoomMembersView
* Remove team main from query and move code around
* Fetch roles
* Update RoomMembersView and SelectListView
* Update rocketchat.js
* Updated leaveTeam and handleRemoveFromTeam
* Fix validation
* Remove unnecessary function
* Update RoomActionsView
* Update en.json
* updated deleteTeam function and permissions
* Added showConfirmationAlert
* Added string translations for teams
* Fix permission
* Added moveChannelToTeam and convertToTeam functionality
* Fix SelectListView RadioButton
* Fix moveToTeam
* Added searchBar to SelectListVIew
* Update RoomView , SelectListVIew and string translation for error
* E2E for Teams
* Fix tests and cleanup
* Minor refactor
* Wrong label
* Move/convert
* Fix convert
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-06-04 16:16:05 +00:00
|
|
|
testID: 'action-sheet-remove-from-team'
|
2020-11-30 20:00:31 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// Remove from room
|
2022-08-26 13:21:25 +00:00
|
|
|
if (removeUserPermission && !room.teamMain) {
|
2020-11-30 20:00:31 +00:00
|
|
|
options.push({
|
|
|
|
icon: 'logout',
|
|
|
|
title: I18n.t('Remove_from_room'),
|
|
|
|
danger: true,
|
|
|
|
onPress: () => {
|
|
|
|
showConfirmationAlert({
|
2022-04-28 20:37:25 +00:00
|
|
|
message: I18n.t('The_user_will_be_removed_from_s', { s: getRoomTitle(room) }),
|
2020-11-30 20:00:31 +00:00
|
|
|
confirmationText: I18n.t('Yes_remove_user'),
|
2022-08-26 13:21:25 +00:00
|
|
|
onPress: () => {
|
|
|
|
handleRemoveUserFromRoom(selectedUser, room, () =>
|
|
|
|
updateState({
|
|
|
|
members: members.filter(member => member._id !== selectedUser._id)
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
2020-11-30 20:00:31 +00:00
|
|
|
});
|
[TEST] E2E Tests for Teams (#3178)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Added SelectListView and logic for leaving team
* Added addTeamMember and removeTeamMember
* Minor tweak
* Added deleteTeam function
* Minor tweak
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Remove unnecesary prop
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* Minor refactor to ListItem, add SelectListView to ModalStack, update handleLeaveTeam
* Minor tweaks
* Update SelectListView
* Update handleLeaveTeam, remove unnecessary method, add story
* Minor tweak
* Minor visual tweaks
* Update SelectListView.js
* Update index.js
* Update RoomMembersView
* Updated SelectListView, RoomActionsView, leaveTeam method and string translations
* Update SelectListVIew
* Minor tweak
* Update SelectListView
* Minor tweak
* Minor tweaks
* Fix for List.Item subtitles being pushed down by title's flex
* Minor tweaks
* Update RoomActionsView
* Use showConfirmationAlert and showErrorAlert
* Remove addTeamMember, update removeTeamMember
* Update Alert
* Minor tweaks
* Minor tweaks
* Minor tweak
* Update showActionSheet on RoomMembersView
* Remove team main from query and move code around
* Fetch roles
* Update RoomMembersView and SelectListView
* Update rocketchat.js
* Updated leaveTeam and handleRemoveFromTeam
* Fix validation
* Remove unnecessary function
* Update RoomActionsView
* Update en.json
* updated deleteTeam function and permissions
* Added showConfirmationAlert
* Added string translations for teams
* Fix permission
* Added moveChannelToTeam and convertToTeam functionality
* Fix SelectListView RadioButton
* Fix moveToTeam
* Added searchBar to SelectListVIew
* Update RoomView , SelectListVIew and string translation for error
* E2E for Teams
* Fix tests and cleanup
* Minor refactor
* Wrong label
* Move/convert
* Fix convert
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-06-04 16:16:05 +00:00
|
|
|
},
|
|
|
|
testID: 'action-sheet-remove-from-room'
|
2020-11-30 20:00:31 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
showActionSheet({
|
|
|
|
options,
|
2020-06-15 19:35:45 +00:00
|
|
|
hasCancel: true
|
|
|
|
});
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2019-01-30 12:11:02 +00:00
|
|
|
|
2022-08-26 13:21:25 +00:00
|
|
|
const fetchMembers = async (status: boolean) => {
|
|
|
|
const { members, isLoading, end, room, filter, page } = state;
|
2021-09-16 16:26:05 +00:00
|
|
|
const { t } = room;
|
2022-08-19 17:27:04 +00:00
|
|
|
|
2019-04-17 17:01:03 +00:00
|
|
|
if (isLoading || end) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-08-26 13:21:25 +00:00
|
|
|
updateState({ isLoading: true });
|
2019-04-08 12:35:28 +00:00
|
|
|
try {
|
2022-04-28 20:37:25 +00:00
|
|
|
const membersResult = await Services.getRoomMembers({
|
2022-08-26 13:21:25 +00:00
|
|
|
rid: room.rid,
|
2021-09-16 16:26:05 +00:00
|
|
|
roomType: t,
|
2022-08-26 13:21:25 +00:00
|
|
|
type: !status ? 'all' : 'online',
|
|
|
|
filter,
|
2022-08-19 17:27:04 +00:00
|
|
|
skip: PAGE_SIZE * page,
|
2021-10-01 20:37:50 +00:00
|
|
|
limit: PAGE_SIZE,
|
2022-08-26 13:21:25 +00:00
|
|
|
allUsers: !status
|
2021-09-16 16:26:05 +00:00
|
|
|
});
|
2022-08-19 17:27:04 +00:00
|
|
|
const end = membersResult?.length < PAGE_SIZE;
|
|
|
|
const membersResultFiltered = membersResult?.filter((member: TUserModel) => !members.some(m => m._id === member._id));
|
2022-08-26 13:21:25 +00:00
|
|
|
updateState({
|
|
|
|
members: [...members, ...membersResultFiltered],
|
2019-04-17 17:01:03 +00:00
|
|
|
isLoading: false,
|
2022-08-19 17:27:04 +00:00
|
|
|
end,
|
|
|
|
page: page + 1
|
2019-04-17 17:01:03 +00:00
|
|
|
});
|
2020-11-30 20:00:31 +00:00
|
|
|
} catch (e) {
|
|
|
|
log(e);
|
2022-08-26 13:21:25 +00:00
|
|
|
updateState({ isLoading: false });
|
2020-11-30 20:00:31 +00:00
|
|
|
}
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2020-11-30 20:00:31 +00:00
|
|
|
|
2022-08-26 13:21:25 +00:00
|
|
|
const filteredMembers =
|
|
|
|
state.members && state.members.length > 0 && state.filter
|
|
|
|
? state.members.filter(
|
|
|
|
m =>
|
|
|
|
m.username.toLowerCase().match(state.filter.toLowerCase()) || m.name?.toLowerCase().match(state.filter.toLowerCase())
|
|
|
|
)
|
|
|
|
: null;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<SafeAreaView testID='room-members-view'>
|
|
|
|
<StatusBar />
|
|
|
|
<FlatList
|
|
|
|
data={filteredMembers || state.members}
|
|
|
|
renderItem={({ item }) => (
|
|
|
|
<View style={{ backgroundColor: colors.backgroundColor }}>
|
|
|
|
<UserItem
|
|
|
|
name={item.name as string}
|
|
|
|
username={item.username}
|
|
|
|
onPress={() => onPressUser(item)}
|
|
|
|
testID={`room-members-view-item-${item.username}`}
|
|
|
|
/>
|
|
|
|
</View>
|
|
|
|
)}
|
|
|
|
style={styles.list}
|
|
|
|
keyExtractor={item => item._id}
|
|
|
|
ItemSeparatorComponent={List.Separator}
|
|
|
|
ListHeaderComponent={
|
|
|
|
<>
|
|
|
|
<ActionsSection joined={params.joined as boolean} rid={state.room.rid} t={state.room.t} />
|
2022-09-23 02:03:02 +00:00
|
|
|
<SearchBox onChangeText={text => updateState({ filter: text.trim() })} testID='room-members-view-search' />
|
2022-08-26 13:21:25 +00:00
|
|
|
</>
|
|
|
|
}
|
|
|
|
ListFooterComponent={() => (state.isLoading ? <ActivityIndicator /> : null)}
|
|
|
|
onEndReachedThreshold={0.1}
|
|
|
|
onEndReached={() => fetchMembers(state.allUsers)}
|
|
|
|
ListEmptyComponent={() =>
|
|
|
|
state.end ? <Text style={[styles.noResult, { color: colors.titleText }]}>{I18n.t('No_members_found')}</Text> : null
|
|
|
|
}
|
|
|
|
{...scrollPersistTaps}
|
2018-09-25 19:28:42 +00:00
|
|
|
/>
|
2022-08-26 13:21:25 +00:00
|
|
|
</SafeAreaView>
|
|
|
|
);
|
|
|
|
};
|
2019-08-07 13:51:34 +00:00
|
|
|
|
2022-08-26 13:21:25 +00:00
|
|
|
export default RoomMembersView;
|