2018-03-29 17:55:37 +00:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2018-09-25 19:28:42 +00:00
|
|
|
import {
|
2018-10-23 21:39:48 +00:00
|
|
|
Text, View, ScrollView, TouchableOpacity, Keyboard, Alert
|
2018-09-25 19:28:42 +00:00
|
|
|
} 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 styles 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 SwitchContainer from './SwitchContainer';
|
|
|
|
import random from '../../utils/random';
|
2020-08-05 13:15:56 +00:00
|
|
|
import log, { logEvent, events } 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';
|
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')
|
2020-07-31 18:30:36 +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
|
|
|
|
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();
|
|
|
|
|
|
|
|
this.querySubscription = observable.subscribe((data) => {
|
|
|
|
this.room = data;
|
|
|
|
this.init(this.room);
|
|
|
|
});
|
|
|
|
|
2021-02-25 16:41:44 +00:00
|
|
|
const result = await RocketChat.hasPermission([
|
|
|
|
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,
|
|
|
|
...(this.room.teamMain ? [deleteTeamPermission] : [])
|
2021-02-25 16:41:44 +00:00
|
|
|
], rid);
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
2018-03-29 17:55:37 +00:00
|
|
|
}
|
|
|
|
|
2019-09-16 20:26:32 +00:00
|
|
|
init = (room) => {
|
2018-03-29 17:55:37 +00:00
|
|
|
const {
|
2020-09-11 14:31:38 +00:00
|
|
|
description, topic, announcement, t, ro, reactWhenReadOnly, joinCodeRequired, sysMes, encrypted
|
2018-09-25 19:28:42 +00:00
|
|
|
} = 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
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
clearErrors = () => {
|
|
|
|
this.setState({
|
|
|
|
nameError: {}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
2018-03-29 17:55:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
formIsChanged = () => {
|
|
|
|
const {
|
2020-10-30 13:51:04 +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;
|
2018-09-25 19:28:42 +00:00
|
|
|
return !(room.name === name
|
|
|
|
&& room.description === description
|
|
|
|
&& room.topic === topic
|
|
|
|
&& room.announcement === announcement
|
2019-12-04 16:39:53 +00:00
|
|
|
&& (joinCodeRequired ? this.randomValue : '') === joinCode
|
2018-09-25 19:28:42 +00:00
|
|
|
&& room.t === 'p' === t
|
|
|
|
&& room.ro === ro
|
|
|
|
&& room.reactWhenReadOnly === reactWhenReadOnly
|
2021-02-26 16:01:45 +00:00
|
|
|
&& dequal(room.sysMes, systemMessages)
|
2020-03-06 14:19:03 +00:00
|
|
|
&& enableSysMes === (room.sysMes && room.sysMes.length > 0)
|
2020-09-11 14:31:38 +00:00
|
|
|
&& room.encrypted === encrypted
|
2020-10-30 13:51:04 +00:00
|
|
|
&& isEmpty(avatar)
|
2018-03-29 17:55:37 +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 {
|
2020-10-30 13:51:04 +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);
|
|
|
|
}
|
|
|
|
|
[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
|
|
|
handleDeleteTeam = async(selected) => {
|
|
|
|
const { navigation, isMasterDetail } = this.props;
|
|
|
|
const { room } = this.state;
|
|
|
|
try {
|
|
|
|
const result = await RocketChat.deleteTeam({ teamId: room.teamId, ...(selected && { roomsToRemove: selected }) });
|
|
|
|
if (result.success) {
|
|
|
|
if (isMasterDetail) {
|
|
|
|
navigation.navigate('DrawerNavigator');
|
|
|
|
} else {
|
|
|
|
navigation.navigate('RoomsListView');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
log(e);
|
|
|
|
showErrorAlert(
|
|
|
|
e.data.error
|
|
|
|
? I18n.t(e.data.error)
|
|
|
|
: I18n.t('There_was_an_error_while_action', { action: I18n.t('deleting_team') }),
|
|
|
|
I18n.t('Cannot_delete')
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
deleteTeam = async() => {
|
|
|
|
const { room } = this.state;
|
|
|
|
const { navigation } = this.props;
|
|
|
|
|
|
|
|
try {
|
|
|
|
const db = database.active;
|
|
|
|
const subCollection = db.get('subscriptions');
|
|
|
|
const teamChannels = await subCollection.query(
|
|
|
|
Q.where('team_id', room.teamId),
|
|
|
|
Q.where('team_main', null)
|
|
|
|
);
|
|
|
|
|
|
|
|
if (teamChannels.length) {
|
|
|
|
navigation.navigate('SelectListView', {
|
|
|
|
title: 'Delete_Team',
|
|
|
|
data: teamChannels,
|
|
|
|
infoText: 'Select_channels_to_delete',
|
|
|
|
nextAction: (selected) => {
|
|
|
|
showConfirmationAlert({
|
|
|
|
message: I18n.t('You_are_deleting_the_team', { team: RocketChat.getRoomTitle(room) }),
|
|
|
|
confirmationText: I18n.t('Yes_action_it', { action: I18n.t('delete') }),
|
|
|
|
onPress: () => this.handleDeleteTeam(selected)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
showConfirmationAlert({
|
|
|
|
message: I18n.t('You_are_deleting_the_team', { team: RocketChat.getRoomTitle(room) }),
|
|
|
|
confirmationText: I18n.t('Yes_action_it', { action: I18n.t('delete') }),
|
|
|
|
onPress: () => this.handleDeleteTeam()
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
log(e);
|
|
|
|
showErrorAlert(
|
|
|
|
e.data.error
|
|
|
|
? I18n.t(e.data.error)
|
|
|
|
: I18n.t('There_was_an_error_while_action', { action: I18n.t('deleting_team') }),
|
|
|
|
I18n.t('Cannot_delete')
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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',
|
2020-03-20 16:38:01 +00:00
|
|
|
onPress: () => deleteRoom(room.rid, room.t)
|
2018-03-29 17:55:37 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
{ cancelable: false }
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
2018-06-01 17:38:13 +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',
|
2018-12-12 15:15:10 +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 }
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
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];
|
2018-09-25 19:28:42 +00:00
|
|
|
}
|
2018-03-29 17:55:37 +00:00
|
|
|
|
2019-09-16 20:26:32 +00:00
|
|
|
hasArchivePermission = () => {
|
|
|
|
const { permissions } = this.state;
|
|
|
|
return (permissions[PERMISSION_ARCHIVE] || permissions[PERMISSION_UNARCHIVE]);
|
|
|
|
};
|
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
|
|
|
|
options={MessageTypeValues.map(m => ({ value: m.value, text: { text: I18n.t('Hide_type_messages', { type: I18n.t(m.text) }) } }))}
|
|
|
|
onChange={({ value }) => this.setState({ systemMessages: value })}
|
|
|
|
placeholder={{ text: I18n.t('Hide_System_Messages') }}
|
|
|
|
value={systemMessages}
|
|
|
|
context={BLOCK_CONTEXT.FORM}
|
|
|
|
multiselect
|
|
|
|
theme={theme}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-10-30 13:51:04 +00:00
|
|
|
changeAvatar = async() => {
|
|
|
|
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);
|
|
|
|
this.setState({ avatar: { url: response.path, data: `data:image/jpeg;base64,${ response.data }`, service: 'upload' } });
|
|
|
|
} catch (e) {
|
|
|
|
console.log(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resetAvatar = () => {
|
|
|
|
this.setState({ avatar: { data: null } });
|
|
|
|
}
|
|
|
|
|
2020-08-05 13:15:56 +00:00
|
|
|
toggleRoomType = (value) => {
|
|
|
|
logEvent(events.RI_EDIT_TOGGLE_ROOM_TYPE);
|
2020-09-11 14:31:38 +00:00
|
|
|
this.setState(({ encrypted }) => ({ t: value, encrypted: value && encrypted }));
|
2020-08-05 13:15:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
toggleReadOnly = (value) => {
|
|
|
|
logEvent(events.RI_EDIT_TOGGLE_READ_ONLY);
|
|
|
|
this.setState({ ro: value });
|
|
|
|
}
|
|
|
|
|
|
|
|
toggleReactions = (value) => {
|
|
|
|
logEvent(events.RI_EDIT_TOGGLE_REACTIONS);
|
|
|
|
this.setState({ reactWhenReadOnly: value });
|
|
|
|
}
|
|
|
|
|
|
|
|
toggleHideSystemMessages = (value) => {
|
|
|
|
logEvent(events.RI_EDIT_TOGGLE_SYSTEM_MSG);
|
|
|
|
this.setState(({ systemMessages }) => ({ enableSysMes: value, systemMessages: value ? systemMessages : [] }));
|
|
|
|
}
|
|
|
|
|
2020-09-11 14:31:38 +00:00
|
|
|
toggleEncrypted = (value) => {
|
|
|
|
logEvent(events.RI_EDIT_TOGGLE_ENCRYPTED);
|
|
|
|
this.setState({ encrypted: value });
|
|
|
|
}
|
|
|
|
|
2018-03-29 17:55:37 +00:00
|
|
|
render() {
|
|
|
|
const {
|
2020-10-30 13:51:04 +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}
|
|
|
|
keyboardVerticalOffset={128}
|
|
|
|
>
|
2020-10-30 13:59:44 +00:00
|
|
|
<StatusBar />
|
2020-06-15 14:00:46 +00:00
|
|
|
<SafeAreaView
|
|
|
|
testID='room-info-edit-view'
|
|
|
|
style={{ backgroundColor: themes[theme].backgroundColor }}
|
2018-05-23 13:39:18 +00:00
|
|
|
>
|
2020-06-15 14:00:46 +00:00
|
|
|
<ScrollView
|
|
|
|
contentContainerStyle={sharedStyles.containerScrollView}
|
|
|
|
testID='room-info-edit-view-list'
|
|
|
|
{...scrollPersistTaps}
|
|
|
|
>
|
2020-11-04 16:53:44 +00:00
|
|
|
<TouchableOpacity
|
|
|
|
style={styles.avatarContainer}
|
|
|
|
onPress={this.changeAvatar}
|
2021-03-18 13:33:35 +00:00
|
|
|
disabled={compareServerVersion(serverVersion, '3.6.0', methods.lowerThan)}
|
2020-11-04 16:53:44 +00:00
|
|
|
>
|
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}
|
|
|
|
size={100}
|
|
|
|
>
|
2021-03-18 13:33:35 +00:00
|
|
|
{compareServerVersion(serverVersion, '3.6.0', methods.lowerThan)
|
2020-11-04 16:53:44 +00:00
|
|
|
? 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
|
|
|
|
inputRef={(e) => { this.name = e; }}
|
|
|
|
label={I18n.t('Name')}
|
|
|
|
value={name}
|
|
|
|
onChangeText={value => this.setState({ name: value })}
|
|
|
|
onSubmitEditing={() => { this.description.focus(); }}
|
|
|
|
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
|
|
|
|
inputRef={(e) => { this.description = e; }}
|
|
|
|
label={I18n.t('Description')}
|
|
|
|
value={description}
|
|
|
|
onChangeText={value => this.setState({ description: value })}
|
|
|
|
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
|
|
|
|
inputRef={(e) => { this.topic = e; }}
|
|
|
|
label={I18n.t('Topic')}
|
|
|
|
value={topic}
|
|
|
|
onChangeText={value => this.setState({ topic: value })}
|
|
|
|
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
|
|
|
|
inputRef={(e) => { this.announcement = e; }}
|
|
|
|
label={I18n.t('Announcement')}
|
|
|
|
value={announcement}
|
|
|
|
onChangeText={value => this.setState({ announcement: value })}
|
|
|
|
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
|
|
|
|
inputRef={(e) => { this.joinCode = e; }}
|
|
|
|
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')}
|
[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
|
|
|
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')}
|
[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
|
|
|
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')}
|
[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
|
|
|
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'
|
|
|
|
/>
|
2018-09-25 19:28:42 +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')}
|
2020-08-05 13:15:56 +00:00
|
|
|
onValueChange={this.toggleReactions}
|
2019-09-16 20:26:32 +00:00
|
|
|
disabled={!permissions[PERMISSION_SET_REACT_WHEN_READONLY]}
|
2019-12-04 16:39:53 +00:00
|
|
|
theme={theme}
|
2018-09-25 19:28:42 +00:00
|
|
|
testID='room-info-edit-view-react-when-ro'
|
|
|
|
/>
|
|
|
|
)
|
2018-06-13 01:33:00 +00:00
|
|
|
: null
|
|
|
|
}
|
2018-09-25 19:28:42 +00:00
|
|
|
{room.broadcast
|
|
|
|
? [
|
2018-06-13 01:33:00 +00:00
|
|
|
<Text style={styles.broadcast}>{I18n.t('Broadcast_Channel')}</Text>,
|
2019-12-04 16:39:53 +00:00
|
|
|
<View style={[styles.divider, { borderColor: themes[theme].separatorColor }]} />
|
2018-06-13 01:33:00 +00:00
|
|
|
]
|
|
|
|
: 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')}
|
|
|
|
leftLabelSecondary={enableSysMes ? I18n.t('Overwrites_the_server_configuration_and_use_room_config') : I18n.t('Uses_server_configuration')}
|
|
|
|
theme={theme}
|
|
|
|
testID='room-info-edit-switch-system-messages'
|
2020-08-05 13:15:56 +00:00
|
|
|
onValueChange={this.toggleHideSystemMessages}
|
2020-03-06 14:19:03 +00:00
|
|
|
labelContainerStyle={styles.hideSystemMessages}
|
|
|
|
leftLabelStyle={styles.systemMessagesLabel}
|
|
|
|
>
|
|
|
|
{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()}
|
|
|
|
testID='room-info-edit-view-submit'
|
|
|
|
>
|
2019-12-04 16:39:53 +00:00
|
|
|
<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()}
|
2018-06-13 01:33:00 +00:00
|
|
|
testID='room-info-edit-view-reset'
|
2018-03-29 17:55:37 +00:00
|
|
|
>
|
2019-12-04 16:39:53 +00:00
|
|
|
<Text
|
|
|
|
style={[
|
|
|
|
styles.button,
|
|
|
|
styles.button_inverted,
|
|
|
|
{ color: themes[theme].bodyText }
|
|
|
|
]}
|
|
|
|
accessibilityTraits='button'
|
|
|
|
>
|
|
|
|
{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,
|
2018-06-13 01:33:00 +00:00
|
|
|
!this.hasArchivePermission() && 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}
|
|
|
|
disabled={!this.hasArchivePermission()}
|
2020-03-03 20:27:38 +00:00
|
|
|
testID={archived ? 'room-info-edit-view-unarchive' : 'room-info-edit-view-archive'}
|
2018-03-29 17:55:37 +00:00
|
|
|
>
|
2019-12-04 16:39:53 +00:00
|
|
|
<Text
|
|
|
|
style={[
|
|
|
|
styles.button,
|
|
|
|
styles.button_inverted,
|
|
|
|
{ color: dangerColor }
|
|
|
|
]}
|
|
|
|
>
|
2019-09-16 20:26:32 +00:00
|
|
|
{ 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()}
|
|
|
|
testID='room-info-edit-view-delete'
|
|
|
|
>
|
2019-12-04 16:39:53 +00:00
|
|
|
<Text
|
|
|
|
style={[
|
|
|
|
styles.button,
|
|
|
|
styles.button_inverted,
|
|
|
|
{ color: dangerColor }
|
|
|
|
]}
|
|
|
|
accessibilityTraits='button'
|
|
|
|
>
|
|
|
|
{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 => ({
|
2020-03-20 16:38:01 +00:00
|
|
|
deleteRoom: (rid, t) => dispatch(deleteRoomAction(rid, t))
|
2019-08-07 13:51:34 +00:00
|
|
|
});
|
|
|
|
|
2020-03-06 14:19:03 +00:00
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(withTheme(RoomInfoEditView));
|