2022-05-10 21:26:06 +00:00
|
|
|
import React from 'react';
|
2022-02-25 21:24:08 +00:00
|
|
|
import { Q } from '@nozbe/watermelondb';
|
2022-05-26 14:07:17 +00:00
|
|
|
import { BlockContext } from '@rocket.chat/ui-kit';
|
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';
|
2022-06-23 20:10:48 +00:00
|
|
|
import { Alert, Keyboard, ScrollView, Text, TextInput, TouchableOpacity, View, StyleSheet } from 'react-native';
|
2022-02-25 21:24:08 +00:00
|
|
|
import ImagePicker, { Image } from 'react-native-image-crop-picker';
|
|
|
|
import { connect } from 'react-redux';
|
2021-02-01 17:18:55 +00:00
|
|
|
|
2022-02-25 21:24:08 +00:00
|
|
|
import { deleteRoom } from '../../actions/room';
|
2022-04-07 14:10:03 +00:00
|
|
|
import { themes } from '../../lib/constants';
|
2022-02-25 21:24:08 +00:00
|
|
|
import Avatar from '../../containers/Avatar';
|
|
|
|
import Loading from '../../containers/Loading';
|
|
|
|
import SafeAreaView from '../../containers/SafeAreaView';
|
|
|
|
import StatusBar from '../../containers/StatusBar';
|
2022-05-18 19:17:42 +00:00
|
|
|
import FormTextInput from '../../containers/TextInput/FormTextInput';
|
2022-02-25 21:24:08 +00:00
|
|
|
import { LISTENER } from '../../containers/Toast';
|
|
|
|
import { MultiSelect } from '../../containers/UIKit/MultiSelect';
|
2022-05-10 21:26:06 +00:00
|
|
|
import {
|
|
|
|
IApplicationState,
|
|
|
|
IBaseScreen,
|
|
|
|
IRoomSettings,
|
|
|
|
ISubscription,
|
|
|
|
SubscriptionType,
|
|
|
|
TSubscriptionModel,
|
|
|
|
IAvatar
|
|
|
|
} from '../../definitions';
|
2022-02-25 21:24:08 +00:00
|
|
|
import { ERoomType } from '../../definitions/ERoomType';
|
|
|
|
import I18n from '../../i18n';
|
2019-09-16 20:26:32 +00:00
|
|
|
import database from '../../lib/database';
|
2022-05-02 19:21:15 +00:00
|
|
|
import { CustomIcon } from '../../containers/CustomIcon';
|
2022-04-13 20:43:56 +00:00
|
|
|
import KeyboardView from '../../containers/KeyboardView';
|
2022-02-25 21:24:08 +00:00
|
|
|
import { TSupportedPermissions } from '../../reducers/permissions';
|
|
|
|
import { ModalStackParamList } from '../../stacks/MasterDetailStack/types';
|
|
|
|
import { ChatsStackParamList } from '../../stacks/types';
|
2022-05-10 21:26:06 +00:00
|
|
|
import { withTheme } from '../../theme';
|
2022-06-06 14:17:51 +00:00
|
|
|
import EventEmitter from '../../lib/methods/helpers/events';
|
|
|
|
import log, { events, logEvent } from '../../lib/methods/helpers/log';
|
|
|
|
import { MessageTypeValues } from './messageTypes';
|
|
|
|
import scrollPersistTaps from '../../lib/methods/helpers/scrollPersistTaps';
|
2022-02-25 21:24:08 +00:00
|
|
|
import sharedStyles from '../Styles';
|
2021-09-13 20:41:05 +00:00
|
|
|
import styles from './styles';
|
2022-02-25 21:24:08 +00:00
|
|
|
import SwitchContainer from './SwitchContainer';
|
2022-06-06 14:17:51 +00:00
|
|
|
import {
|
|
|
|
getRoomTitle,
|
|
|
|
hasPermission,
|
|
|
|
compareServerVersion,
|
|
|
|
showConfirmationAlert,
|
|
|
|
showErrorAlert,
|
|
|
|
random
|
|
|
|
} from '../../lib/methods/helpers';
|
2022-04-28 20:37:25 +00:00
|
|
|
import { Services } from '../../lib/services';
|
2022-02-25 21:24:08 +00:00
|
|
|
|
|
|
|
interface IRoomInfoEditViewState {
|
|
|
|
room: ISubscription;
|
|
|
|
avatar: IAvatar;
|
2022-05-03 00:48:08 +00:00
|
|
|
permissions: { [key in TSupportedPermissions]?: boolean };
|
2022-02-25 21:24:08 +00:00
|
|
|
name: string;
|
|
|
|
description?: string;
|
|
|
|
topic?: string;
|
|
|
|
announcement?: string;
|
|
|
|
joinCode: string;
|
|
|
|
nameError: any;
|
|
|
|
saving: boolean;
|
|
|
|
t: boolean;
|
|
|
|
ro: boolean;
|
|
|
|
reactWhenReadOnly?: boolean;
|
|
|
|
archived: boolean;
|
|
|
|
systemMessages?: boolean | string[];
|
|
|
|
enableSysMes?: boolean | string[];
|
|
|
|
encrypted?: boolean;
|
|
|
|
}
|
2018-03-29 17:55:37 +00:00
|
|
|
|
2022-02-25 21:24:08 +00:00
|
|
|
interface IRoomInfoEditViewProps extends IBaseScreen<ChatsStackParamList | ModalStackParamList, 'RoomInfoEditView'> {
|
|
|
|
serverVersion?: string;
|
|
|
|
encryptionEnabled: boolean;
|
|
|
|
setReadOnlyPermission: string[];
|
|
|
|
setReactWhenReadOnlyPermission: string[];
|
|
|
|
archiveRoomPermission: string[];
|
|
|
|
unarchiveRoomPermission: string[];
|
|
|
|
deleteCPermission: string[];
|
|
|
|
deletePPermission: string[];
|
|
|
|
deleteTeamPermission: string[];
|
|
|
|
}
|
|
|
|
|
|
|
|
class RoomInfoEditView extends React.Component<IRoomInfoEditViewProps, IRoomInfoEditViewState> {
|
|
|
|
randomValue = random(15);
|
2022-05-10 21:26:06 +00:00
|
|
|
private room: TSubscriptionModel;
|
|
|
|
private name: TextInput | null | undefined;
|
|
|
|
private description: TextInput | null | undefined;
|
|
|
|
private topic: TextInput | null | undefined;
|
|
|
|
private announcement: TextInput | null | undefined;
|
|
|
|
private joinCode: TextInput | null | undefined;
|
2018-03-29 17:55:37 +00:00
|
|
|
|
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
|
|
|
|
2022-02-25 21:24:08 +00:00
|
|
|
constructor(props: IRoomInfoEditViewProps) {
|
2019-05-28 13:03:08 +00:00
|
|
|
super(props);
|
2022-05-10 21:26:06 +00:00
|
|
|
this.room = {} as TSubscriptionModel;
|
2018-03-29 17:55:37 +00:00
|
|
|
this.state = {
|
2022-02-25 21:24:08 +00:00
|
|
|
room: {} as ISubscription,
|
|
|
|
avatar: {} as IAvatar,
|
2022-05-03 00:48:08 +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
|
|
|
}
|
|
|
|
|
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);
|
2022-06-09 13:01:58 +00:00
|
|
|
this.room = sub;
|
|
|
|
this.init(this.room);
|
2019-09-16 20:26:32 +00:00
|
|
|
|
2022-04-28 20:37:25 +00:00
|
|
|
const result = await hasPermission(
|
2021-09-13 20:41:05 +00:00
|
|
|
[
|
|
|
|
setReadOnlyPermission,
|
|
|
|
setReactWhenReadOnlyPermission,
|
|
|
|
archiveRoomPermission,
|
|
|
|
unarchiveRoomPermission,
|
|
|
|
deleteCPermission,
|
|
|
|
deletePPermission,
|
|
|
|
...(this.room.teamMain ? [deleteTeamPermission] : [])
|
|
|
|
],
|
|
|
|
rid
|
|
|
|
);
|
2021-02-25 16:41:44 +00:00
|
|
|
|
|
|
|
this.setState({
|
|
|
|
permissions: {
|
2022-02-25 21:24:08 +00:00
|
|
|
'set-readonly': result[0],
|
|
|
|
'set-react-when-readonly': result[1],
|
|
|
|
'archive-room': result[2],
|
|
|
|
'unarchive-room': result[3],
|
|
|
|
'delete-c': result[4],
|
|
|
|
'delete-p': result[5],
|
|
|
|
...(this.room.teamMain && { '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
|
|
|
|
2022-02-25 21:24:08 +00:00
|
|
|
init = (room: ISubscription) => {
|
|
|
|
const { description, topic, announcement, t, ro, reactWhenReadOnly, joinCodeRequired, encrypted } = room;
|
|
|
|
const sysMes = room.sysMes as string[];
|
2018-03-29 17:55:37 +00:00
|
|
|
// fake password just to user knows about it
|
|
|
|
this.setState({
|
2019-09-16 20:26:32 +00:00
|
|
|
room,
|
2022-04-28 20:37:25 +00:00
|
|
|
name: getRoomTitle(room),
|
2018-03-29 17:55:37 +00:00
|
|
|
description,
|
|
|
|
topic,
|
|
|
|
announcement,
|
|
|
|
t: t === 'p',
|
2022-02-25 21:24:08 +00:00
|
|
|
avatar: {} as IAvatar,
|
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;
|
2022-02-25 21:24:08 +00:00
|
|
|
const sysMes = room.sysMes as string[];
|
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 &&
|
2022-02-25 21:24:08 +00:00
|
|
|
dequal(sysMes, systemMessages) &&
|
|
|
|
enableSysMes === (sysMes && sysMes.length > 0) &&
|
2021-09-13 20:41:05 +00:00
|
|
|
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();
|
|
|
|
|
2022-05-10 21:26:06 +00:00
|
|
|
const params = {} as IRoomSettings;
|
2018-03-29 17:55:37 +00:00
|
|
|
|
|
|
|
// Name
|
|
|
|
if (room.name !== name) {
|
|
|
|
params.roomName = name;
|
|
|
|
}
|
2020-10-30 13:51:04 +00:00
|
|
|
// Avatar
|
|
|
|
if (!isEmpty(avatar)) {
|
2022-05-10 21:26:06 +00:00
|
|
|
params.roomAvatar = avatar.data as string;
|
2020-10-30 13:51:04 +00:00
|
|
|
}
|
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
|
2022-03-25 13:02:09 +00:00
|
|
|
if ((room.t === SubscriptionType.GROUP) !== t) {
|
2022-05-10 21:26:06 +00:00
|
|
|
params.roomType = t ? ('p' as SubscriptionType) : ('c' as SubscriptionType);
|
2018-03-29 17:55:37 +00:00
|
|
|
}
|
|
|
|
// 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)) {
|
2022-05-10 21:26:06 +00:00
|
|
|
params.systemMessages = systemMessages as string[];
|
2020-03-06 14:19:03 +00:00
|
|
|
}
|
|
|
|
|
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 {
|
2022-04-28 20:37:25 +00:00
|
|
|
await Services.saveRoomSettings(room.rid, params);
|
2022-02-25 21:24:08 +00:00
|
|
|
} catch (e: any) {
|
2018-03-29 17:55:37 +00:00
|
|
|
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;
|
2022-02-25 21:24:08 +00:00
|
|
|
const { navigation, deleteCPermission, deletePPermission, dispatch } = 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');
|
2022-05-10 21:26:06 +00:00
|
|
|
const teamChannels = await subCollection
|
|
|
|
.query(Q.where('team_id', room.teamId as string), Q.where('team_main', Q.notEq(true)))
|
|
|
|
.fetch();
|
[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
|
2022-04-28 20:37:25 +00:00
|
|
|
const permissions = await hasPermission([permissionType], teamChannels[i].rid);
|
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',
|
2022-03-02 14:49:43 +00:00
|
|
|
nextAction: (selected: string[]) => {
|
[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({
|
2022-04-28 20:37:25 +00:00
|
|
|
message: I18n.t('You_are_deleting_the_team', { team: getRoomTitle(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
|
|
|
confirmationText: I18n.t('Yes_action_it', { action: I18n.t('delete') }),
|
2022-02-25 21:24:08 +00:00
|
|
|
onPress: () => deleteRoom(ERoomType.t, 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({
|
2022-04-28 20:37:25 +00:00
|
|
|
message: I18n.t('You_are_deleting_the_team', { team: getRoomTitle(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
|
|
|
confirmationText: I18n.t('Yes_action_it', { action: I18n.t('delete') }),
|
2022-02-25 21:24:08 +00:00
|
|
|
onPress: () => dispatch(deleteRoom(ERoomType.t, 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
|
|
|
});
|
|
|
|
}
|
2022-02-25 21:24:08 +00:00
|
|
|
} catch (e: any) {
|
[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
|
|
|
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;
|
2022-02-25 21:24:08 +00:00
|
|
|
const { dispatch } = 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',
|
2022-02-25 21:24:08 +00:00
|
|
|
onPress: () => dispatch(deleteRoom(ERoomType.c, 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);
|
2022-04-28 20:37:25 +00:00
|
|
|
await Services.toggleArchiveRoom(rid, t as SubscriptionType, !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) {
|
2022-02-25 21:24:08 +00:00
|
|
|
return permissions['delete-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
|
|
|
}
|
|
|
|
|
|
|
|
if (room.t === 'p') {
|
2022-02-25 21:24:08 +00:00
|
|
|
return permissions['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
|
|
|
}
|
|
|
|
|
2022-02-25 21:24:08 +00:00
|
|
|
return permissions['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;
|
|
|
|
|
|
|
|
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) }) }
|
|
|
|
}))}
|
2022-02-25 21:24:08 +00:00
|
|
|
onChange={({ value }: { value: boolean }) => this.setState({ systemMessages: value })}
|
2020-03-06 14:19:03 +00:00
|
|
|
placeholder={{ text: I18n.t('Hide_System_Messages') }}
|
2022-02-25 21:24:08 +00:00
|
|
|
value={systemMessages as string[]}
|
2022-05-26 14:07:17 +00:00
|
|
|
context={BlockContext.FORM}
|
2020-03-06 14:19:03 +00:00
|
|
|
multiselect
|
|
|
|
/>
|
|
|
|
);
|
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 {
|
2022-02-25 21:24:08 +00:00
|
|
|
const response: Image = 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
|
|
|
|
2022-02-25 21:24:08 +00:00
|
|
|
toggleRoomType = (value: boolean) => {
|
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
|
|
|
|
2022-02-25 21:24:08 +00:00
|
|
|
toggleReadOnly = (value: boolean) => {
|
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
|
|
|
|
2022-02-25 21:24:08 +00:00
|
|
|
toggleReactions = (value: boolean) => {
|
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
|
|
|
|
2022-02-25 21:24:08 +00:00
|
|
|
toggleHideSystemMessages = (value: boolean) => {
|
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
|
|
|
|
2022-02-25 21:24:08 +00:00
|
|
|
toggleEncrypted = (value: boolean) => {
|
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}
|
2022-02-25 21:24:08 +00:00
|
|
|
disabled={compareServerVersion(serverVersion || '', 'lowerThan', '3.6.0')}>
|
2020-10-30 13:51:04 +00:00
|
|
|
<Avatar
|
|
|
|
type={room.t}
|
|
|
|
text={room.name}
|
|
|
|
avatar={avatar?.url}
|
|
|
|
isStatic={avatar?.url}
|
2022-02-25 21:24:08 +00:00
|
|
|
rid={isEmpty(avatar) ? room.rid : undefined}
|
2021-09-13 20:41:05 +00:00
|
|
|
size={100}>
|
2022-02-25 21:24:08 +00:00
|
|
|
{serverVersion && compareServerVersion(serverVersion, 'lowerThan', '3.6.0') ? undefined : (
|
2021-09-13 20:41:05 +00:00
|
|
|
<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>
|
2022-05-18 19:17:42 +00:00
|
|
|
<FormTextInput
|
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={() => {
|
2022-02-25 21:24:08 +00:00
|
|
|
this.description?.focus();
|
2021-09-13 20:41:05 +00:00
|
|
|
}}
|
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'
|
|
|
|
/>
|
2022-05-18 19:17:42 +00:00
|
|
|
<FormTextInput
|
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={() => {
|
2022-02-25 21:24:08 +00:00
|
|
|
this.topic?.focus();
|
2021-09-13 20:41:05 +00:00
|
|
|
}}
|
2019-12-04 16:39:53 +00:00
|
|
|
theme={theme}
|
2018-06-13 01:33:00 +00:00
|
|
|
testID='room-info-edit-view-description'
|
|
|
|
/>
|
2022-05-18 19:17:42 +00:00
|
|
|
<FormTextInput
|
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={() => {
|
2022-02-25 21:24:08 +00:00
|
|
|
this.announcement?.focus();
|
2021-09-13 20:41:05 +00:00
|
|
|
}}
|
2019-12-04 16:39:53 +00:00
|
|
|
theme={theme}
|
2018-06-13 01:33:00 +00:00
|
|
|
testID='room-info-edit-view-topic'
|
|
|
|
/>
|
2022-05-18 19:17:42 +00:00
|
|
|
<FormTextInput
|
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={() => {
|
2022-02-25 21:24:08 +00:00
|
|
|
this.joinCode?.focus();
|
2021-09-13 20:41:05 +00:00
|
|
|
}}
|
2019-12-04 16:39:53 +00:00
|
|
|
theme={theme}
|
2018-06-13 01:33:00 +00:00
|
|
|
testID='room-info-edit-view-announcement'
|
|
|
|
/>
|
2022-06-23 20:10:48 +00:00
|
|
|
{/* This TextInput avoid appears the password fill when typing into Announcements TextInput */}
|
|
|
|
<View style={{ height: StyleSheet.hairlineWidth, overflow: 'hidden' }}>
|
|
|
|
<TextInput
|
|
|
|
style={{
|
|
|
|
height: StyleSheet.hairlineWidth
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</View>
|
2022-05-18 19:17:42 +00:00
|
|
|
<FormTextInput
|
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}
|
2022-02-25 21:24:08 +00:00
|
|
|
disabled={!permissions['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
|
2022-02-25 21:24:08 +00:00
|
|
|
value={reactWhenReadOnly as boolean}
|
2021-09-13 20:41:05 +00:00
|
|
|
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}
|
2022-02-25 21:24:08 +00:00
|
|
|
disabled={!permissions['set-react-when-readonly']}
|
2021-09-13 20:41:05 +00:00
|
|
|
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}
|
2022-02-25 21:24:08 +00:00
|
|
|
{serverVersion && !compareServerVersion(serverVersion, 'lowerThan', '3.0.0') ? (
|
2020-03-06 14:19:03 +00:00
|
|
|
<SwitchContainer
|
2022-02-25 21:24:08 +00:00
|
|
|
value={enableSysMes as boolean}
|
2020-03-06 14:19:03 +00:00
|
|
|
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
|
2022-02-25 21:24:08 +00:00
|
|
|
value={encrypted as boolean}
|
2020-09-11 14:31:38 +00:00
|
|
|
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'>
|
2022-04-08 14:27:10 +00:00
|
|
|
<Text style={[styles.button, { color: themes[theme].buttonText }]} accessibilityRole='button'>
|
2021-09-13 20:41:05 +00:00
|
|
|
{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 }]}
|
2022-04-08 14:27:10 +00:00
|
|
|
accessibilityRole='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
|
2022-02-25 21:24:08 +00:00
|
|
|
? !permissions['unarchive-room'] && sharedStyles.opacity5
|
|
|
|
: !permissions['archive-room'] && 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}
|
2022-02-25 21:24:08 +00:00
|
|
|
disabled={archived ? !permissions['unarchive-room'] : !permissions['archive-room']}
|
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'>
|
2022-04-08 14:27:10 +00:00
|
|
|
<Text style={[styles.button, styles.button_inverted, { color: dangerColor }]} accessibilityRole='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
|
|
|
|
2022-02-25 21:24:08 +00:00
|
|
|
const mapStateToProps = (state: IApplicationState) => ({
|
|
|
|
serverVersion: state.server.version as string,
|
2021-02-25 16:41:44 +00:00
|
|
|
encryptionEnabled: state.encryption.enabled,
|
2022-02-25 21:24:08 +00:00
|
|
|
setReadOnlyPermission: state.permissions['set-readonly'] as string[],
|
|
|
|
setReactWhenReadOnlyPermission: state.permissions['set-react-when-readonly'] as string[],
|
|
|
|
archiveRoomPermission: state.permissions['archive-room'] as string[],
|
|
|
|
unarchiveRoomPermission: state.permissions['unarchive-room'] as string[],
|
|
|
|
deleteCPermission: state.permissions['delete-c'] as string[],
|
|
|
|
deletePPermission: state.permissions['delete-p'] as string[],
|
|
|
|
deleteTeamPermission: state.permissions['delete-team'] as string[],
|
[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
|
|
|
isMasterDetail: state.app.isMasterDetail
|
2020-03-06 14:19:03 +00:00
|
|
|
});
|
|
|
|
|
2022-02-25 21:24:08 +00:00
|
|
|
export default connect(mapStateToProps)(withTheme(RoomInfoEditView));
|