2018-03-29 17:55:37 +00:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2021-09-13 20:41:05 +00:00
|
|
|
import { Alert, Keyboard, ScrollView, Text, TouchableOpacity, View } from 'react-native';
|
2018-03-29 17:55:37 +00:00
|
|
|
import { connect } from 'react-redux';
|
2020-03-06 14:19:03 +00:00
|
|
|
import { BLOCK_CONTEXT } from '@rocket.chat/ui-kit';
|
2020-10-30 13:51:04 +00:00
|
|
|
import ImagePicker from 'react-native-image-crop-picker';
|
2021-02-26 16:01:45 +00:00
|
|
|
import { dequal } from 'dequal';
|
2020-10-30 13:51:04 +00:00
|
|
|
import isEmpty from 'lodash/isEmpty';
|
[NEW] Delete Teams (#3123)
* 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
* Minor tweaks
* Typo
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-28 14:22:41 +00:00
|
|
|
import { Q } from '@nozbe/watermelondb';
|
2021-02-01 17:18:55 +00:00
|
|
|
|
[NEW] Delete Teams (#3123)
* 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
* Minor tweaks
* Typo
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-28 14:22:41 +00:00
|
|
|
import { compareServerVersion, methods } from '../../lib/utils';
|
2019-09-16 20:26:32 +00:00
|
|
|
import database from '../../lib/database';
|
2020-03-20 16:38:01 +00:00
|
|
|
import { deleteRoom as deleteRoomAction } from '../../actions/room';
|
2018-03-29 17:55:37 +00:00
|
|
|
import KeyboardView from '../../presentation/KeyboardView';
|
|
|
|
import sharedStyles from '../Styles';
|
|
|
|
import scrollPersistTaps from '../../utils/scrollPersistTaps';
|
[NEW] Delete Teams (#3123)
* 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
* Minor tweaks
* Typo
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-28 14:22:41 +00:00
|
|
|
import { showConfirmationAlert, showErrorAlert } from '../../utils/info';
|
2019-07-23 14:02:57 +00:00
|
|
|
import { LISTENER } from '../../containers/Toast';
|
|
|
|
import EventEmitter from '../../utils/events';
|
2018-03-29 17:55:37 +00:00
|
|
|
import RocketChat from '../../lib/rocketchat';
|
|
|
|
import RCTextInput from '../../containers/TextInput';
|
2018-04-24 19:34:03 +00:00
|
|
|
import Loading from '../../containers/Loading';
|
2018-03-29 17:55:37 +00:00
|
|
|
import random from '../../utils/random';
|
2021-09-13 20:41:05 +00:00
|
|
|
import log, { events, logEvent } from '../../utils/log';
|
2018-06-01 17:38:13 +00:00
|
|
|
import I18n from '../../i18n';
|
2019-03-12 16:23:06 +00:00
|
|
|
import StatusBar from '../../containers/StatusBar';
|
2019-12-04 16:39:53 +00:00
|
|
|
import { themes } from '../../constants/colors';
|
|
|
|
import { withTheme } from '../../theme';
|
2020-03-06 14:19:03 +00:00
|
|
|
import { MultiSelect } from '../../containers/UIKit/MultiSelect';
|
|
|
|
import { MessageTypeValues } from '../../utils/messageTypes';
|
2020-06-15 14:00:46 +00:00
|
|
|
import SafeAreaView from '../../containers/SafeAreaView';
|
2020-10-30 13:51:04 +00:00
|
|
|
import Avatar from '../../containers/Avatar';
|
|
|
|
import { CustomIcon } from '../../lib/Icons';
|
2021-09-13 20:41:05 +00:00
|
|
|
import SwitchContainer from './SwitchContainer';
|
|
|
|
import styles from './styles';
|
2018-03-29 17:55:37 +00:00
|
|
|
|
|
|
|
const PERMISSION_SET_READONLY = 'set-readonly';
|
|
|
|
const PERMISSION_SET_REACT_WHEN_READONLY = 'set-react-when-readonly';
|
|
|
|
const PERMISSION_ARCHIVE = 'archive-room';
|
|
|
|
const PERMISSION_UNARCHIVE = 'unarchive-room';
|
|
|
|
const PERMISSION_DELETE_C = 'delete-c';
|
|
|
|
const PERMISSION_DELETE_P = 'delete-p';
|
[NEW] Delete Teams (#3123)
* 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
* Minor tweaks
* Typo
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-28 14:22:41 +00:00
|
|
|
const PERMISSION_DELETE_TEAM = 'delete-team';
|
2018-03-29 17:55:37 +00:00
|
|
|
|
2019-08-07 13:51:34 +00:00
|
|
|
class RoomInfoEditView extends React.Component {
|
2020-07-31 18:30:36 +00:00
|
|
|
static navigationOptions = () => ({
|
2020-06-15 14:00:46 +00:00
|
|
|
title: I18n.t('Room_Info_Edit')
|
2021-09-13 20:41:05 +00:00
|
|
|
});
|
2018-10-23 21:39:48 +00:00
|
|
|
|
2018-03-29 17:55:37 +00:00
|
|
|
static propTypes = {
|
[NEW] Delete Teams (#3123)
* 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
* Minor tweaks
* Typo
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-28 14:22:41 +00:00
|
|
|
navigation: PropTypes.object,
|
2020-06-15 14:00:46 +00:00
|
|
|
route: PropTypes.object,
|
2020-03-20 16:38:01 +00:00
|
|
|
deleteRoom: PropTypes.func,
|
2020-03-06 14:19:03 +00:00
|
|
|
serverVersion: PropTypes.string,
|
2021-01-20 17:34:01 +00:00
|
|
|
encryptionEnabled: PropTypes.bool,
|
2021-02-25 16:41:44 +00:00
|
|
|
theme: PropTypes.string,
|
|
|
|
setReadOnlyPermission: PropTypes.array,
|
|
|
|
setReactWhenReadOnlyPermission: PropTypes.array,
|
|
|
|
archiveRoomPermission: PropTypes.array,
|
|
|
|
unarchiveRoomPermission: PropTypes.array,
|
|
|
|
deleteCPermission: PropTypes.array,
|
[NEW] Delete Teams (#3123)
* 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
* Minor tweaks
* Typo
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-28 14:22:41 +00:00
|
|
|
deletePPermission: PropTypes.array,
|
|
|
|
deleteTeamPermission: PropTypes.array,
|
|
|
|
isMasterDetail: PropTypes.bool
|
2018-03-29 17:55:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
constructor(props) {
|
2019-05-28 13:03:08 +00:00
|
|
|
super(props);
|
2018-03-29 17:55:37 +00:00
|
|
|
this.state = {
|
2019-09-16 20:26:32 +00:00
|
|
|
room: {},
|
2020-10-30 13:51:04 +00:00
|
|
|
avatar: {},
|
2019-09-16 20:26:32 +00:00
|
|
|
permissions: {},
|
2018-03-29 17:55:37 +00:00
|
|
|
name: '',
|
|
|
|
description: '',
|
|
|
|
topic: '',
|
|
|
|
announcement: '',
|
|
|
|
joinCode: '',
|
|
|
|
nameError: {},
|
|
|
|
saving: false,
|
|
|
|
t: false,
|
|
|
|
ro: false,
|
2019-09-16 20:26:32 +00:00
|
|
|
reactWhenReadOnly: false,
|
2020-03-06 14:19:03 +00:00
|
|
|
archived: false,
|
|
|
|
systemMessages: [],
|
2020-09-11 14:31:38 +00:00
|
|
|
enableSysMes: false,
|
|
|
|
encrypted: false
|
2018-03-29 17:55:37 +00:00
|
|
|
};
|
2019-09-16 20:26:32 +00:00
|
|
|
this.loadRoom();
|
2018-03-29 17:55:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
2019-09-16 20:26:32 +00:00
|
|
|
if (this.querySubscription && this.querySubscription.unsubscribe) {
|
|
|
|
this.querySubscription.unsubscribe();
|
|
|
|
}
|
2018-03-29 17:55:37 +00:00
|
|
|
}
|
|
|
|
|
2019-09-16 20:26:32 +00:00
|
|
|
// eslint-disable-next-line react/sort-comp
|
2021-09-13 20:41:05 +00:00
|
|
|
loadRoom = async () => {
|
2021-02-25 16:41:44 +00:00
|
|
|
const {
|
|
|
|
route,
|
|
|
|
setReadOnlyPermission,
|
|
|
|
setReactWhenReadOnlyPermission,
|
|
|
|
archiveRoomPermission,
|
|
|
|
unarchiveRoomPermission,
|
|
|
|
deleteCPermission,
|
[NEW] Delete Teams (#3123)
* 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
* Minor tweaks
* Typo
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-28 14:22:41 +00:00
|
|
|
deletePPermission,
|
|
|
|
deleteTeamPermission
|
2021-02-25 16:41:44 +00:00
|
|
|
} = this.props;
|
2020-06-15 14:00:46 +00:00
|
|
|
const rid = route.params?.rid;
|
2019-09-16 20:26:32 +00:00
|
|
|
if (!rid) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
const db = database.active;
|
2021-02-26 16:25:51 +00:00
|
|
|
const sub = await db.get('subscriptions').find(rid);
|
2019-09-16 20:26:32 +00:00
|
|
|
const observable = sub.observe();
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
this.querySubscription = observable.subscribe(data => {
|
2019-09-16 20:26:32 +00:00
|
|
|
this.room = data;
|
|
|
|
this.init(this.room);
|
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
const result = await RocketChat.hasPermission(
|
|
|
|
[
|
|
|
|
setReadOnlyPermission,
|
|
|
|
setReactWhenReadOnlyPermission,
|
|
|
|
archiveRoomPermission,
|
|
|
|
unarchiveRoomPermission,
|
|
|
|
deleteCPermission,
|
|
|
|
deletePPermission,
|
|
|
|
...(this.room.teamMain ? [deleteTeamPermission] : [])
|
|
|
|
],
|
|
|
|
rid
|
|
|
|
);
|
2021-02-25 16:41:44 +00:00
|
|
|
|
|
|
|
this.setState({
|
|
|
|
permissions: {
|
|
|
|
[PERMISSION_SET_READONLY]: result[0],
|
|
|
|
[PERMISSION_SET_REACT_WHEN_READONLY]: result[1],
|
|
|
|
[PERMISSION_ARCHIVE]: result[2],
|
|
|
|
[PERMISSION_UNARCHIVE]: result[3],
|
|
|
|
[PERMISSION_DELETE_C]: result[4],
|
[NEW] Delete Teams (#3123)
* 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
* Minor tweaks
* Typo
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-28 14:22:41 +00:00
|
|
|
[PERMISSION_DELETE_P]: result[5],
|
|
|
|
...(this.room.teamMain && { [PERMISSION_DELETE_TEAM]: result[6] })
|
2021-02-25 16:41:44 +00:00
|
|
|
}
|
|
|
|
});
|
2019-09-16 20:26:32 +00:00
|
|
|
} catch (e) {
|
|
|
|
log(e);
|
|
|
|
}
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2018-03-29 17:55:37 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
init = room => {
|
|
|
|
const { description, topic, announcement, t, ro, reactWhenReadOnly, joinCodeRequired, sysMes, encrypted } = room;
|
2018-03-29 17:55:37 +00:00
|
|
|
// fake password just to user knows about it
|
|
|
|
this.randomValue = random(15);
|
|
|
|
this.setState({
|
2019-09-16 20:26:32 +00:00
|
|
|
room,
|
2020-04-30 16:24:49 +00:00
|
|
|
name: RocketChat.getRoomTitle(room),
|
2018-03-29 17:55:37 +00:00
|
|
|
description,
|
|
|
|
topic,
|
|
|
|
announcement,
|
|
|
|
t: t === 'p',
|
2020-10-30 13:51:04 +00:00
|
|
|
avatar: {},
|
2018-03-29 17:55:37 +00:00
|
|
|
ro,
|
|
|
|
reactWhenReadOnly,
|
2019-09-16 20:26:32 +00:00
|
|
|
joinCode: joinCodeRequired ? this.randomValue : '',
|
2020-03-06 14:19:03 +00:00
|
|
|
archived: room.archived,
|
|
|
|
systemMessages: sysMes,
|
2020-09-11 14:31:38 +00:00
|
|
|
enableSysMes: sysMes && sysMes.length > 0,
|
|
|
|
encrypted
|
2018-03-29 17:55:37 +00:00
|
|
|
});
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2018-03-29 17:55:37 +00:00
|
|
|
|
|
|
|
clearErrors = () => {
|
|
|
|
this.setState({
|
|
|
|
nameError: {}
|
|
|
|
});
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2018-03-29 17:55:37 +00:00
|
|
|
|
|
|
|
reset = () => {
|
2020-08-05 13:15:56 +00:00
|
|
|
logEvent(events.RI_EDIT_RESET);
|
2018-03-29 17:55:37 +00:00
|
|
|
this.clearErrors();
|
2019-09-16 20:26:32 +00:00
|
|
|
this.init(this.room);
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2018-03-29 17:55:37 +00:00
|
|
|
|
|
|
|
formIsChanged = () => {
|
|
|
|
const {
|
2021-09-13 20:41:05 +00:00
|
|
|
room,
|
|
|
|
name,
|
|
|
|
description,
|
|
|
|
topic,
|
|
|
|
announcement,
|
|
|
|
t,
|
|
|
|
ro,
|
|
|
|
reactWhenReadOnly,
|
|
|
|
joinCode,
|
|
|
|
systemMessages,
|
|
|
|
enableSysMes,
|
|
|
|
encrypted,
|
|
|
|
avatar
|
2018-03-29 17:55:37 +00:00
|
|
|
} = this.state;
|
2019-12-04 16:39:53 +00:00
|
|
|
const { joinCodeRequired } = room;
|
2021-09-13 20:41:05 +00:00
|
|
|
return !(
|
|
|
|
room.name === name &&
|
|
|
|
room.description === description &&
|
|
|
|
room.topic === topic &&
|
|
|
|
room.announcement === announcement &&
|
|
|
|
(joinCodeRequired ? this.randomValue : '') === joinCode &&
|
|
|
|
(room.t === 'p') === t &&
|
|
|
|
room.ro === ro &&
|
|
|
|
room.reactWhenReadOnly === reactWhenReadOnly &&
|
|
|
|
dequal(room.sysMes, systemMessages) &&
|
|
|
|
enableSysMes === (room.sysMes && room.sysMes.length > 0) &&
|
|
|
|
room.encrypted === encrypted &&
|
|
|
|
isEmpty(avatar)
|
2018-03-29 17:55:37 +00:00
|
|
|
);
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2018-03-29 17:55:37 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
submit = async () => {
|
2020-08-05 13:15:56 +00:00
|
|
|
logEvent(events.RI_EDIT_SAVE);
|
2018-03-29 17:55:37 +00:00
|
|
|
Keyboard.dismiss();
|
|
|
|
const {
|
2021-09-13 20:41:05 +00:00
|
|
|
room,
|
|
|
|
name,
|
|
|
|
description,
|
|
|
|
topic,
|
|
|
|
announcement,
|
|
|
|
t,
|
|
|
|
ro,
|
|
|
|
reactWhenReadOnly,
|
|
|
|
joinCode,
|
|
|
|
systemMessages,
|
|
|
|
encrypted,
|
|
|
|
avatar
|
2018-03-29 17:55:37 +00:00
|
|
|
} = this.state;
|
|
|
|
|
|
|
|
this.setState({ saving: true });
|
|
|
|
let error = false;
|
|
|
|
|
|
|
|
if (!this.formIsChanged()) {
|
2018-06-01 17:38:13 +00:00
|
|
|
showErrorAlert(I18n.t('Nothing_to_save'));
|
2018-03-29 17:55:37 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Clear error objects
|
|
|
|
await this.clearErrors();
|
|
|
|
|
|
|
|
const params = {};
|
|
|
|
|
|
|
|
// Name
|
|
|
|
if (room.name !== name) {
|
|
|
|
params.roomName = name;
|
|
|
|
}
|
2020-10-30 13:51:04 +00:00
|
|
|
// Avatar
|
|
|
|
if (!isEmpty(avatar)) {
|
|
|
|
params.roomAvatar = avatar.data;
|
|
|
|
}
|
2018-03-29 17:55:37 +00:00
|
|
|
// Description
|
|
|
|
if (room.description !== description) {
|
|
|
|
params.roomDescription = description;
|
|
|
|
}
|
|
|
|
// Topic
|
|
|
|
if (room.topic !== topic) {
|
|
|
|
params.roomTopic = topic;
|
|
|
|
}
|
|
|
|
// Announcement
|
|
|
|
if (room.announcement !== announcement) {
|
|
|
|
params.roomAnnouncement = announcement;
|
|
|
|
}
|
|
|
|
// Room Type
|
|
|
|
if (room.t !== t) {
|
|
|
|
params.roomType = t ? 'p' : 'c';
|
|
|
|
}
|
|
|
|
// Read Only
|
|
|
|
if (room.ro !== ro) {
|
|
|
|
params.readOnly = ro;
|
|
|
|
}
|
|
|
|
// React When Read Only
|
|
|
|
if (room.reactWhenReadOnly !== reactWhenReadOnly) {
|
|
|
|
params.reactWhenReadOnly = reactWhenReadOnly;
|
|
|
|
}
|
|
|
|
|
2021-02-26 16:01:45 +00:00
|
|
|
if (!dequal(room.sysMes, systemMessages)) {
|
2020-03-06 14:19:03 +00:00
|
|
|
params.systemMessages = systemMessages;
|
|
|
|
}
|
|
|
|
|
2018-03-29 17:55:37 +00:00
|
|
|
// Join Code
|
|
|
|
if (this.randomValue !== joinCode) {
|
|
|
|
params.joinCode = joinCode;
|
|
|
|
}
|
|
|
|
|
2020-09-11 14:31:38 +00:00
|
|
|
// Encrypted
|
|
|
|
if (room.encrypted !== encrypted) {
|
|
|
|
params.encrypted = encrypted;
|
|
|
|
}
|
|
|
|
|
2018-03-29 17:55:37 +00:00
|
|
|
try {
|
|
|
|
await RocketChat.saveRoomSettings(room.rid, params);
|
|
|
|
} catch (e) {
|
|
|
|
if (e.error === 'error-invalid-room-name') {
|
|
|
|
this.setState({ nameError: e });
|
|
|
|
}
|
|
|
|
error = true;
|
2019-08-23 13:18:47 +00:00
|
|
|
log(e);
|
2018-03-29 17:55:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
await this.setState({ saving: false });
|
|
|
|
setTimeout(() => {
|
|
|
|
if (error) {
|
2020-08-05 13:15:56 +00:00
|
|
|
logEvent(events.RI_EDIT_SAVE_F);
|
2018-06-13 01:33:00 +00:00
|
|
|
showErrorAlert(I18n.t('There_was_an_error_while_action', { action: I18n.t('saving_settings') }));
|
2018-03-29 17:55:37 +00:00
|
|
|
} else {
|
2019-07-23 14:02:57 +00:00
|
|
|
EventEmitter.emit(LISTENER, { message: I18n.t('Settings_succesfully_changed') });
|
2018-03-29 17:55:37 +00:00
|
|
|
}
|
|
|
|
}, 100);
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2018-03-29 17:55:37 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
deleteTeam = async () => {
|
[NEW] Delete Teams (#3123)
* 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
* Minor tweaks
* Typo
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-28 14:22:41 +00:00
|
|
|
const { room } = this.state;
|
2021-09-13 20:41:05 +00:00
|
|
|
const { navigation, deleteCPermission, deletePPermission, deleteRoom } = this.props;
|
[NEW] Delete Teams (#3123)
* 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
* Minor tweaks
* Typo
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-28 14:22:41 +00:00
|
|
|
|
|
|
|
try {
|
|
|
|
const db = database.active;
|
|
|
|
const subCollection = db.get('subscriptions');
|
2021-09-13 20:41:05 +00:00
|
|
|
const teamChannels = await subCollection.query(Q.where('team_id', room.teamId), Q.where('team_main', Q.notEq(true)));
|
[NEW] Delete Teams (#3123)
* 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
* Minor tweaks
* Typo
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-28 14:22:41 +00:00
|
|
|
|
2021-07-02 19:13:41 +00:00
|
|
|
const teamChannelOwner = [];
|
|
|
|
for (let i = 0; i < teamChannels.length; i += 1) {
|
|
|
|
const permissionType = teamChannels[i].t === 'c' ? deleteCPermission : deletePPermission;
|
|
|
|
// eslint-disable-next-line no-await-in-loop
|
2021-09-13 20:41:05 +00:00
|
|
|
const permissions = await RocketChat.hasPermission([permissionType], teamChannels[i].rid);
|
2021-07-02 19:13:41 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
if (permissions[0]) {
|
|
|
|
teamChannelOwner.push(teamChannels[i]);
|
|
|
|
}
|
2021-07-02 19:13:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (teamChannelOwner.length) {
|
[NEW] Delete Teams (#3123)
* 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
* Minor tweaks
* Typo
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-28 14:22:41 +00:00
|
|
|
navigation.navigate('SelectListView', {
|
|
|
|
title: 'Delete_Team',
|
2021-07-02 19:13:41 +00:00
|
|
|
data: teamChannelOwner,
|
[NEW] Delete Teams (#3123)
* 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
* Minor tweaks
* Typo
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-28 14:22:41 +00:00
|
|
|
infoText: 'Select_channels_to_delete',
|
2021-09-13 20:41:05 +00:00
|
|
|
nextAction: selected => {
|
[NEW] Delete Teams (#3123)
* 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
* Minor tweaks
* Typo
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-28 14:22:41 +00:00
|
|
|
showConfirmationAlert({
|
|
|
|
message: I18n.t('You_are_deleting_the_team', { team: RocketChat.getRoomTitle(room) }),
|
|
|
|
confirmationText: I18n.t('Yes_action_it', { action: I18n.t('delete') }),
|
2021-07-02 19:13:41 +00:00
|
|
|
onPress: () => deleteRoom('team', room, selected)
|
[NEW] Delete Teams (#3123)
* 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
* Minor tweaks
* Typo
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-28 14:22:41 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
showConfirmationAlert({
|
|
|
|
message: I18n.t('You_are_deleting_the_team', { team: RocketChat.getRoomTitle(room) }),
|
|
|
|
confirmationText: I18n.t('Yes_action_it', { action: I18n.t('delete') }),
|
2021-07-02 19:13:41 +00:00
|
|
|
onPress: () => deleteRoom('team', room)
|
[NEW] Delete Teams (#3123)
* 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
* Minor tweaks
* Typo
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-28 14:22:41 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
log(e);
|
|
|
|
showErrorAlert(
|
2021-09-13 20:41:05 +00:00
|
|
|
e.data.error ? I18n.t(e.data.error) : I18n.t('There_was_an_error_while_action', { action: I18n.t('deleting_team') }),
|
[NEW] Delete Teams (#3123)
* 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
* Minor tweaks
* Typo
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-28 14:22:41 +00:00
|
|
|
I18n.t('Cannot_delete')
|
|
|
|
);
|
|
|
|
}
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
[NEW] Delete Teams (#3123)
* 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
* Minor tweaks
* Typo
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-28 14:22:41 +00:00
|
|
|
|
2018-03-29 17:55:37 +00:00
|
|
|
delete = () => {
|
2018-09-25 19:28:42 +00:00
|
|
|
const { room } = this.state;
|
2020-03-20 16:38:01 +00:00
|
|
|
const { deleteRoom } = this.props;
|
2018-09-25 19:28:42 +00:00
|
|
|
|
2018-03-29 17:55:37 +00:00
|
|
|
Alert.alert(
|
2018-06-01 17:38:13 +00:00
|
|
|
I18n.t('Are_you_sure_question_mark'),
|
|
|
|
I18n.t('Delete_Room_Warning'),
|
2018-03-29 17:55:37 +00:00
|
|
|
[
|
|
|
|
{
|
2018-06-01 17:38:13 +00:00
|
|
|
text: I18n.t('Cancel'),
|
2018-03-29 17:55:37 +00:00
|
|
|
style: 'cancel'
|
|
|
|
},
|
|
|
|
{
|
2018-06-01 17:38:13 +00:00
|
|
|
text: I18n.t('Yes_action_it', { action: I18n.t('delete') }),
|
2018-03-29 17:55:37 +00:00
|
|
|
style: 'destructive',
|
2021-07-02 19:13:41 +00:00
|
|
|
onPress: () => deleteRoom('channel', room)
|
2018-03-29 17:55:37 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
{ cancelable: false }
|
|
|
|
);
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2018-03-29 17:55:37 +00:00
|
|
|
|
|
|
|
toggleArchive = () => {
|
2018-09-25 19:28:42 +00:00
|
|
|
const { room } = this.state;
|
2018-12-12 15:15:10 +00:00
|
|
|
const { rid, archived, t } = room;
|
2018-09-25 19:28:42 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
const action = I18n.t(`${archived ? 'un' : ''}archive`);
|
2018-03-29 17:55:37 +00:00
|
|
|
Alert.alert(
|
2018-06-01 17:38:13 +00:00
|
|
|
I18n.t('Are_you_sure_question_mark'),
|
|
|
|
I18n.t('Do_you_really_want_to_key_this_room_question_mark', { key: action }),
|
2018-03-29 17:55:37 +00:00
|
|
|
[
|
|
|
|
{
|
2018-06-01 17:38:13 +00:00
|
|
|
text: I18n.t('Cancel'),
|
2018-03-29 17:55:37 +00:00
|
|
|
style: 'cancel'
|
|
|
|
},
|
|
|
|
{
|
2018-06-01 17:38:13 +00:00
|
|
|
text: I18n.t('Yes_action_it', { action }),
|
2018-03-29 17:55:37 +00:00
|
|
|
style: 'destructive',
|
2021-09-13 20:41:05 +00:00
|
|
|
onPress: async () => {
|
2018-03-29 17:55:37 +00:00
|
|
|
try {
|
2020-08-05 13:15:56 +00:00
|
|
|
logEvent(events.RI_EDIT_TOGGLE_ARCHIVE);
|
2018-12-12 15:15:10 +00:00
|
|
|
await RocketChat.toggleArchiveRoom(rid, t, !archived);
|
2018-05-18 17:55:08 +00:00
|
|
|
} catch (e) {
|
2020-08-05 13:15:56 +00:00
|
|
|
logEvent(events.RI_EDIT_TOGGLE_ARCHIVE_F);
|
2019-08-23 13:18:47 +00:00
|
|
|
log(e);
|
2018-03-29 17:55:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
{ cancelable: false }
|
|
|
|
);
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2018-03-29 17:55:37 +00:00
|
|
|
|
2018-09-25 19:28:42 +00:00
|
|
|
hasDeletePermission = () => {
|
2019-09-16 20:26:32 +00:00
|
|
|
const { room, permissions } = this.state;
|
[NEW] Delete Teams (#3123)
* 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
* Minor tweaks
* Typo
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-28 14:22:41 +00:00
|
|
|
|
|
|
|
if (room.teamMain) {
|
|
|
|
return permissions[PERMISSION_DELETE_TEAM];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (room.t === 'p') {
|
|
|
|
return permissions[PERMISSION_DELETE_P];
|
|
|
|
}
|
|
|
|
|
|
|
|
return permissions[PERMISSION_DELETE_C];
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2018-03-29 17:55:37 +00:00
|
|
|
|
2020-03-06 14:19:03 +00:00
|
|
|
renderSystemMessages = () => {
|
|
|
|
const { systemMessages, enableSysMes } = this.state;
|
|
|
|
const { theme } = this.props;
|
|
|
|
|
|
|
|
if (!enableSysMes) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<MultiSelect
|
2021-09-13 20:41:05 +00:00
|
|
|
options={MessageTypeValues.map(m => ({
|
|
|
|
value: m.value,
|
|
|
|
text: { text: I18n.t('Hide_type_messages', { type: I18n.t(m.text) }) }
|
|
|
|
}))}
|
2020-03-06 14:19:03 +00:00
|
|
|
onChange={({ value }) => this.setState({ systemMessages: value })}
|
|
|
|
placeholder={{ text: I18n.t('Hide_System_Messages') }}
|
|
|
|
value={systemMessages}
|
|
|
|
context={BLOCK_CONTEXT.FORM}
|
|
|
|
multiselect
|
|
|
|
theme={theme}
|
|
|
|
/>
|
|
|
|
);
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2020-03-06 14:19:03 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
changeAvatar = async () => {
|
2020-10-30 13:51:04 +00:00
|
|
|
const options = {
|
|
|
|
cropping: true,
|
|
|
|
compressImageQuality: 0.8,
|
|
|
|
cropperAvoidEmptySpaceAroundImage: false,
|
|
|
|
cropperChooseText: I18n.t('Choose'),
|
|
|
|
cropperCancelText: I18n.t('Cancel'),
|
|
|
|
includeBase64: true
|
|
|
|
};
|
|
|
|
|
|
|
|
try {
|
|
|
|
const response = await ImagePicker.openPicker(options);
|
2021-09-13 20:41:05 +00:00
|
|
|
this.setState({ avatar: { url: response.path, data: `data:image/jpeg;base64,${response.data}`, service: 'upload' } });
|
2020-10-30 13:51:04 +00:00
|
|
|
} catch (e) {
|
|
|
|
console.log(e);
|
|
|
|
}
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2020-10-30 13:51:04 +00:00
|
|
|
|
|
|
|
resetAvatar = () => {
|
|
|
|
this.setState({ avatar: { data: null } });
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2020-10-30 13:51:04 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
toggleRoomType = value => {
|
2020-08-05 13:15:56 +00:00
|
|
|
logEvent(events.RI_EDIT_TOGGLE_ROOM_TYPE);
|
2020-09-11 14:31:38 +00:00
|
|
|
this.setState(({ encrypted }) => ({ t: value, encrypted: value && encrypted }));
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2020-08-05 13:15:56 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
toggleReadOnly = value => {
|
2020-08-05 13:15:56 +00:00
|
|
|
logEvent(events.RI_EDIT_TOGGLE_READ_ONLY);
|
|
|
|
this.setState({ ro: value });
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2020-08-05 13:15:56 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
toggleReactions = value => {
|
2020-08-05 13:15:56 +00:00
|
|
|
logEvent(events.RI_EDIT_TOGGLE_REACTIONS);
|
|
|
|
this.setState({ reactWhenReadOnly: value });
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2020-08-05 13:15:56 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
toggleHideSystemMessages = value => {
|
2020-08-05 13:15:56 +00:00
|
|
|
logEvent(events.RI_EDIT_TOGGLE_SYSTEM_MSG);
|
|
|
|
this.setState(({ systemMessages }) => ({ enableSysMes: value, systemMessages: value ? systemMessages : [] }));
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2020-08-05 13:15:56 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
toggleEncrypted = value => {
|
2020-09-11 14:31:38 +00:00
|
|
|
logEvent(events.RI_EDIT_TOGGLE_ENCRYPTED);
|
|
|
|
this.setState({ encrypted: value });
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2020-09-11 14:31:38 +00:00
|
|
|
|
2018-03-29 17:55:37 +00:00
|
|
|
render() {
|
|
|
|
const {
|
2021-09-13 20:41:05 +00:00
|
|
|
name,
|
|
|
|
nameError,
|
|
|
|
description,
|
|
|
|
topic,
|
|
|
|
announcement,
|
|
|
|
t,
|
|
|
|
ro,
|
|
|
|
reactWhenReadOnly,
|
|
|
|
room,
|
|
|
|
joinCode,
|
|
|
|
saving,
|
|
|
|
permissions,
|
|
|
|
archived,
|
|
|
|
enableSysMes,
|
|
|
|
encrypted,
|
|
|
|
avatar
|
2018-03-29 17:55:37 +00:00
|
|
|
} = this.state;
|
2021-01-20 17:34:01 +00:00
|
|
|
const { serverVersion, encryptionEnabled, theme } = this.props;
|
2019-12-04 16:39:53 +00:00
|
|
|
const { dangerColor } = themes[theme];
|
2020-03-06 14:19:03 +00:00
|
|
|
|
2018-03-29 17:55:37 +00:00
|
|
|
return (
|
|
|
|
<KeyboardView
|
2019-12-04 16:39:53 +00:00
|
|
|
style={{ backgroundColor: themes[theme].backgroundColor }}
|
2018-03-29 17:55:37 +00:00
|
|
|
contentContainerStyle={sharedStyles.container}
|
2021-09-13 20:41:05 +00:00
|
|
|
keyboardVerticalOffset={128}>
|
2020-10-30 13:59:44 +00:00
|
|
|
<StatusBar />
|
2021-09-13 20:41:05 +00:00
|
|
|
<SafeAreaView testID='room-info-edit-view' style={{ backgroundColor: themes[theme].backgroundColor }}>
|
2020-06-15 14:00:46 +00:00
|
|
|
<ScrollView
|
|
|
|
contentContainerStyle={sharedStyles.containerScrollView}
|
|
|
|
testID='room-info-edit-view-list'
|
2021-09-13 20:41:05 +00:00
|
|
|
{...scrollPersistTaps}>
|
2020-11-04 16:53:44 +00:00
|
|
|
<TouchableOpacity
|
|
|
|
style={styles.avatarContainer}
|
|
|
|
onPress={this.changeAvatar}
|
2021-09-13 20:41:05 +00:00
|
|
|
disabled={compareServerVersion(serverVersion, '3.6.0', methods.lowerThan)}>
|
2020-10-30 13:51:04 +00:00
|
|
|
<Avatar
|
|
|
|
type={room.t}
|
|
|
|
text={room.name}
|
|
|
|
avatar={avatar?.url}
|
|
|
|
isStatic={avatar?.url}
|
|
|
|
rid={isEmpty(avatar) && room.rid}
|
2021-09-13 20:41:05 +00:00
|
|
|
size={100}>
|
|
|
|
{compareServerVersion(serverVersion, '3.6.0', methods.lowerThan) ? null : (
|
|
|
|
<TouchableOpacity
|
|
|
|
style={[styles.resetButton, { backgroundColor: themes[theme].dangerColor }]}
|
|
|
|
onPress={this.resetAvatar}>
|
|
|
|
<CustomIcon name='delete' color={themes[theme].backgroundColor} size={24} />
|
|
|
|
</TouchableOpacity>
|
|
|
|
)}
|
2020-10-30 13:51:04 +00:00
|
|
|
</Avatar>
|
|
|
|
</TouchableOpacity>
|
2018-06-13 01:33:00 +00:00
|
|
|
<RCTextInput
|
2021-09-13 20:41:05 +00:00
|
|
|
inputRef={e => {
|
|
|
|
this.name = e;
|
|
|
|
}}
|
2018-06-13 01:33:00 +00:00
|
|
|
label={I18n.t('Name')}
|
|
|
|
value={name}
|
|
|
|
onChangeText={value => this.setState({ name: value })}
|
2021-09-13 20:41:05 +00:00
|
|
|
onSubmitEditing={() => {
|
|
|
|
this.description.focus();
|
|
|
|
}}
|
2018-06-13 01:33:00 +00:00
|
|
|
error={nameError}
|
2019-12-04 16:39:53 +00:00
|
|
|
theme={theme}
|
2018-06-13 01:33:00 +00:00
|
|
|
testID='room-info-edit-view-name'
|
|
|
|
/>
|
|
|
|
<RCTextInput
|
2021-09-13 20:41:05 +00:00
|
|
|
inputRef={e => {
|
|
|
|
this.description = e;
|
|
|
|
}}
|
2018-06-13 01:33:00 +00:00
|
|
|
label={I18n.t('Description')}
|
|
|
|
value={description}
|
|
|
|
onChangeText={value => this.setState({ description: value })}
|
2021-09-13 20:41:05 +00:00
|
|
|
onSubmitEditing={() => {
|
|
|
|
this.topic.focus();
|
|
|
|
}}
|
2019-12-04 16:39:53 +00:00
|
|
|
theme={theme}
|
2018-06-13 01:33:00 +00:00
|
|
|
testID='room-info-edit-view-description'
|
|
|
|
/>
|
|
|
|
<RCTextInput
|
2021-09-13 20:41:05 +00:00
|
|
|
inputRef={e => {
|
|
|
|
this.topic = e;
|
|
|
|
}}
|
2018-06-13 01:33:00 +00:00
|
|
|
label={I18n.t('Topic')}
|
|
|
|
value={topic}
|
|
|
|
onChangeText={value => this.setState({ topic: value })}
|
2021-09-13 20:41:05 +00:00
|
|
|
onSubmitEditing={() => {
|
|
|
|
this.announcement.focus();
|
|
|
|
}}
|
2019-12-04 16:39:53 +00:00
|
|
|
theme={theme}
|
2018-06-13 01:33:00 +00:00
|
|
|
testID='room-info-edit-view-topic'
|
|
|
|
/>
|
|
|
|
<RCTextInput
|
2021-09-13 20:41:05 +00:00
|
|
|
inputRef={e => {
|
|
|
|
this.announcement = e;
|
|
|
|
}}
|
2018-06-13 01:33:00 +00:00
|
|
|
label={I18n.t('Announcement')}
|
|
|
|
value={announcement}
|
|
|
|
onChangeText={value => this.setState({ announcement: value })}
|
2021-09-13 20:41:05 +00:00
|
|
|
onSubmitEditing={() => {
|
|
|
|
this.joinCode.focus();
|
|
|
|
}}
|
2019-12-04 16:39:53 +00:00
|
|
|
theme={theme}
|
2018-06-13 01:33:00 +00:00
|
|
|
testID='room-info-edit-view-announcement'
|
|
|
|
/>
|
|
|
|
<RCTextInput
|
2021-09-13 20:41:05 +00:00
|
|
|
inputRef={e => {
|
|
|
|
this.joinCode = e;
|
|
|
|
}}
|
2018-06-13 01:33:00 +00:00
|
|
|
label={I18n.t('Password')}
|
|
|
|
value={joinCode}
|
|
|
|
onChangeText={value => this.setState({ joinCode: value })}
|
|
|
|
onSubmitEditing={this.submit}
|
|
|
|
secureTextEntry
|
2019-12-04 16:39:53 +00:00
|
|
|
theme={theme}
|
2018-06-13 01:33:00 +00:00
|
|
|
testID='room-info-edit-view-password'
|
|
|
|
/>
|
|
|
|
<SwitchContainer
|
|
|
|
value={t}
|
|
|
|
leftLabelPrimary={I18n.t('Public')}
|
2021-09-13 20:41:05 +00:00
|
|
|
leftLabelSecondary={
|
|
|
|
room.teamMain ? I18n.t('Everyone_can_access_this_team') : I18n.t('Everyone_can_access_this_channel')
|
|
|
|
}
|
2018-06-13 01:33:00 +00:00
|
|
|
rightLabelPrimary={I18n.t('Private')}
|
2021-09-13 20:41:05 +00:00
|
|
|
rightLabelSecondary={
|
|
|
|
room.teamMain
|
|
|
|
? I18n.t('Just_invited_people_can_access_this_team')
|
|
|
|
: I18n.t('Just_invited_people_can_access_this_channel')
|
|
|
|
}
|
2020-08-05 13:15:56 +00:00
|
|
|
onValueChange={this.toggleRoomType}
|
2019-12-04 16:39:53 +00:00
|
|
|
theme={theme}
|
2018-06-13 01:33:00 +00:00
|
|
|
testID='room-info-edit-view-t'
|
|
|
|
/>
|
|
|
|
<SwitchContainer
|
|
|
|
value={ro}
|
2018-10-24 19:10:44 +00:00
|
|
|
leftLabelPrimary={I18n.t('Collaborative')}
|
2021-09-13 20:41:05 +00:00
|
|
|
leftLabelSecondary={
|
|
|
|
room.teamMain
|
|
|
|
? I18n.t('All_users_in_the_team_can_write_new_messages')
|
|
|
|
: I18n.t('All_users_in_the_channel_can_write_new_messages')
|
|
|
|
}
|
2018-06-13 01:33:00 +00:00
|
|
|
rightLabelPrimary={I18n.t('Read_Only')}
|
|
|
|
rightLabelSecondary={I18n.t('Only_authorized_users_can_write_new_messages')}
|
2020-08-05 13:15:56 +00:00
|
|
|
onValueChange={this.toggleReadOnly}
|
2019-09-16 20:26:32 +00:00
|
|
|
disabled={!permissions[PERMISSION_SET_READONLY] || room.broadcast}
|
2019-12-04 16:39:53 +00:00
|
|
|
theme={theme}
|
2018-06-13 01:33:00 +00:00
|
|
|
testID='room-info-edit-view-ro'
|
|
|
|
/>
|
2021-09-13 20:41:05 +00:00
|
|
|
{ro && !room.broadcast ? (
|
|
|
|
<SwitchContainer
|
|
|
|
value={reactWhenReadOnly}
|
|
|
|
leftLabelPrimary={I18n.t('No_Reactions')}
|
|
|
|
leftLabelSecondary={I18n.t('Reactions_are_disabled')}
|
|
|
|
rightLabelPrimary={I18n.t('Allow_Reactions')}
|
|
|
|
rightLabelSecondary={I18n.t('Reactions_are_enabled')}
|
|
|
|
onValueChange={this.toggleReactions}
|
|
|
|
disabled={!permissions[PERMISSION_SET_REACT_WHEN_READONLY]}
|
|
|
|
theme={theme}
|
|
|
|
testID='room-info-edit-view-react-when-ro'
|
|
|
|
/>
|
|
|
|
) : null}
|
2018-09-25 19:28:42 +00:00
|
|
|
{room.broadcast
|
|
|
|
? [
|
2021-09-13 20:41:05 +00:00
|
|
|
<Text style={styles.broadcast}>{I18n.t('Broadcast_Channel')}</Text>,
|
|
|
|
<View style={[styles.divider, { borderColor: themes[theme].separatorColor }]} />
|
|
|
|
]
|
|
|
|
: null}
|
2021-03-18 13:33:35 +00:00
|
|
|
{!compareServerVersion(serverVersion, '3.0.0', methods.lowerThan) ? (
|
2020-03-06 14:19:03 +00:00
|
|
|
<SwitchContainer
|
|
|
|
value={enableSysMes}
|
|
|
|
leftLabelPrimary={I18n.t('Hide_System_Messages')}
|
2021-09-13 20:41:05 +00:00
|
|
|
leftLabelSecondary={
|
|
|
|
enableSysMes
|
|
|
|
? I18n.t('Overwrites_the_server_configuration_and_use_room_config')
|
|
|
|
: I18n.t('Uses_server_configuration')
|
|
|
|
}
|
2020-03-06 14:19:03 +00:00
|
|
|
theme={theme}
|
|
|
|
testID='room-info-edit-switch-system-messages'
|
2020-08-05 13:15:56 +00:00
|
|
|
onValueChange={this.toggleHideSystemMessages}
|
2020-03-06 14:19:03 +00:00
|
|
|
labelContainerStyle={styles.hideSystemMessages}
|
2021-09-13 20:41:05 +00:00
|
|
|
leftLabelStyle={styles.systemMessagesLabel}>
|
2020-03-06 14:19:03 +00:00
|
|
|
{this.renderSystemMessages()}
|
|
|
|
</SwitchContainer>
|
|
|
|
) : null}
|
2021-01-20 17:34:01 +00:00
|
|
|
{encryptionEnabled ? (
|
2020-09-11 14:31:38 +00:00
|
|
|
<SwitchContainer
|
|
|
|
value={encrypted}
|
|
|
|
disabled={!t}
|
|
|
|
leftLabelPrimary={I18n.t('Encrypted')}
|
|
|
|
leftLabelSecondary={I18n.t('End_to_end_encrypted_room')}
|
|
|
|
theme={theme}
|
|
|
|
testID='room-info-edit-switch-encrypted'
|
|
|
|
onValueChange={this.toggleEncrypted}
|
|
|
|
labelContainerStyle={styles.hideSystemMessages}
|
|
|
|
leftLabelStyle={styles.systemMessagesLabel}
|
|
|
|
/>
|
|
|
|
) : null}
|
2018-06-13 01:33:00 +00:00
|
|
|
<TouchableOpacity
|
2019-12-04 16:39:53 +00:00
|
|
|
style={[
|
|
|
|
styles.buttonContainer,
|
|
|
|
{ backgroundColor: themes[theme].buttonBackground },
|
|
|
|
!this.formIsChanged() && styles.buttonContainerDisabled
|
|
|
|
]}
|
2018-06-13 01:33:00 +00:00
|
|
|
onPress={this.submit}
|
|
|
|
disabled={!this.formIsChanged()}
|
2021-09-13 20:41:05 +00:00
|
|
|
testID='room-info-edit-view-submit'>
|
|
|
|
<Text style={[styles.button, { color: themes[theme].buttonText }]} accessibilityTraits='button'>
|
|
|
|
{I18n.t('SAVE')}
|
|
|
|
</Text>
|
2018-06-13 01:33:00 +00:00
|
|
|
</TouchableOpacity>
|
|
|
|
<View style={{ flexDirection: 'row' }}>
|
2018-03-29 17:55:37 +00:00
|
|
|
<TouchableOpacity
|
2019-12-04 16:39:53 +00:00
|
|
|
style={[
|
|
|
|
styles.buttonContainer_inverted,
|
|
|
|
styles.buttonInverted,
|
2020-01-28 13:26:46 +00:00
|
|
|
{ flex: 1, borderColor: themes[theme].auxiliaryText },
|
|
|
|
!this.formIsChanged() && styles.buttonContainerDisabled
|
2019-12-04 16:39:53 +00:00
|
|
|
]}
|
2018-06-13 01:33:00 +00:00
|
|
|
onPress={this.reset}
|
2020-01-28 13:26:46 +00:00
|
|
|
disabled={!this.formIsChanged()}
|
2021-09-13 20:41:05 +00:00
|
|
|
testID='room-info-edit-view-reset'>
|
2019-12-04 16:39:53 +00:00
|
|
|
<Text
|
2021-09-13 20:41:05 +00:00
|
|
|
style={[styles.button, styles.button_inverted, { color: themes[theme].bodyText }]}
|
|
|
|
accessibilityTraits='button'>
|
2019-12-04 16:39:53 +00:00
|
|
|
{I18n.t('RESET')}
|
|
|
|
</Text>
|
2018-03-29 17:55:37 +00:00
|
|
|
</TouchableOpacity>
|
|
|
|
<TouchableOpacity
|
|
|
|
style={[
|
2019-12-04 16:39:53 +00:00
|
|
|
styles.buttonInverted,
|
|
|
|
styles.buttonContainer_inverted,
|
2021-09-13 20:41:05 +00:00
|
|
|
archived
|
|
|
|
? !permissions[PERMISSION_UNARCHIVE] && sharedStyles.opacity5
|
|
|
|
: !permissions[PERMISSION_ARCHIVE] && sharedStyles.opacity5,
|
2019-12-04 16:39:53 +00:00
|
|
|
{ flex: 1, marginLeft: 10, borderColor: dangerColor }
|
2018-03-29 17:55:37 +00:00
|
|
|
]}
|
2018-06-13 01:33:00 +00:00
|
|
|
onPress={this.toggleArchive}
|
2021-08-16 21:08:34 +00:00
|
|
|
disabled={archived ? !permissions[PERMISSION_UNARCHIVE] : !permissions[PERMISSION_ARCHIVE]}
|
2021-09-13 20:41:05 +00:00
|
|
|
testID={archived ? 'room-info-edit-view-unarchive' : 'room-info-edit-view-archive'}>
|
|
|
|
<Text style={[styles.button, styles.button_inverted, { color: dangerColor }]}>
|
|
|
|
{archived ? I18n.t('UNARCHIVE') : I18n.t('ARCHIVE')}
|
2018-06-13 01:33:00 +00:00
|
|
|
</Text>
|
2018-03-29 17:55:37 +00:00
|
|
|
</TouchableOpacity>
|
|
|
|
</View>
|
2019-12-04 16:39:53 +00:00
|
|
|
<View style={[styles.divider, { borderColor: themes[theme].separatorColor }]} />
|
2018-06-13 01:33:00 +00:00
|
|
|
<TouchableOpacity
|
|
|
|
style={[
|
2019-12-04 16:39:53 +00:00
|
|
|
styles.buttonContainer_inverted,
|
|
|
|
styles.buttonContainerLastChild,
|
2018-06-13 01:33:00 +00:00
|
|
|
styles.buttonDanger,
|
2019-12-04 16:39:53 +00:00
|
|
|
{ borderColor: dangerColor },
|
2018-06-13 01:33:00 +00:00
|
|
|
!this.hasDeletePermission() && sharedStyles.opacity5
|
|
|
|
]}
|
[NEW] Delete Teams (#3123)
* 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
* Minor tweaks
* Typo
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-28 14:22:41 +00:00
|
|
|
onPress={room.teamMain ? this.deleteTeam : this.delete}
|
2018-06-13 01:33:00 +00:00
|
|
|
disabled={!this.hasDeletePermission()}
|
2021-09-13 20:41:05 +00:00
|
|
|
testID='room-info-edit-view-delete'>
|
|
|
|
<Text style={[styles.button, styles.button_inverted, { color: dangerColor }]} accessibilityTraits='button'>
|
2019-12-04 16:39:53 +00:00
|
|
|
{I18n.t('DELETE')}
|
|
|
|
</Text>
|
2018-06-13 01:33:00 +00:00
|
|
|
</TouchableOpacity>
|
2018-09-25 19:28:42 +00:00
|
|
|
<Loading visible={saving} />
|
2020-06-15 14:00:46 +00:00
|
|
|
</ScrollView>
|
|
|
|
</SafeAreaView>
|
2018-03-29 17:55:37 +00:00
|
|
|
</KeyboardView>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2019-08-07 13:51:34 +00:00
|
|
|
|
2020-03-06 14:19:03 +00:00
|
|
|
const mapStateToProps = state => ({
|
2021-02-11 21:44:36 +00:00
|
|
|
serverVersion: state.server.version,
|
2021-02-25 16:41:44 +00:00
|
|
|
encryptionEnabled: state.encryption.enabled,
|
|
|
|
setReadOnlyPermission: state.permissions[PERMISSION_SET_READONLY],
|
|
|
|
setReactWhenReadOnlyPermission: state.permissions[PERMISSION_SET_REACT_WHEN_READONLY],
|
|
|
|
archiveRoomPermission: state.permissions[PERMISSION_ARCHIVE],
|
|
|
|
unarchiveRoomPermission: state.permissions[PERMISSION_UNARCHIVE],
|
|
|
|
deleteCPermission: state.permissions[PERMISSION_DELETE_C],
|
[NEW] Delete Teams (#3123)
* 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
* Minor tweaks
* Typo
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-28 14:22:41 +00:00
|
|
|
deletePPermission: state.permissions[PERMISSION_DELETE_P],
|
|
|
|
deleteTeamPermission: state.permissions[PERMISSION_DELETE_TEAM],
|
|
|
|
isMasterDetail: state.app.isMasterDetail
|
2020-03-06 14:19:03 +00:00
|
|
|
});
|
|
|
|
|
2019-08-07 13:51:34 +00:00
|
|
|
const mapDispatchToProps = dispatch => ({
|
2021-07-02 19:13:41 +00:00
|
|
|
deleteRoom: (roomType, room, selected) => dispatch(deleteRoomAction(roomType, room, selected))
|
2019-08-07 13:51:34 +00:00
|
|
|
});
|
|
|
|
|
2020-03-06 14:19:03 +00:00
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(withTheme(RoomInfoEditView));
|