2022-05-09 13:21:09 +00:00
|
|
|
import { Q } from '@nozbe/watermelondb';
|
2022-06-01 19:46:37 +00:00
|
|
|
import { StackNavigationOptions } from '@react-navigation/stack';
|
|
|
|
import { HeaderBackButton } from '@react-navigation/elements';
|
|
|
|
import React from 'react';
|
2021-09-13 20:41:05 +00:00
|
|
|
import { Alert, FlatList, Keyboard } from 'react-native';
|
2021-12-02 13:58:49 +00:00
|
|
|
import { EdgeInsets, withSafeAreaInsets } from 'react-native-safe-area-context';
|
2021-04-07 18:31:25 +00:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
2022-01-18 14:39:24 +00:00
|
|
|
import { deleteRoom } from '../actions/room';
|
2022-05-09 13:21:09 +00:00
|
|
|
import { DisplayMode, themes } from '../lib/constants';
|
|
|
|
import { TActionSheetOptions, TActionSheetOptionsItem, withActionSheet } from '../containers/ActionSheet';
|
2022-01-18 14:39:24 +00:00
|
|
|
import ActivityIndicator from '../containers/ActivityIndicator';
|
|
|
|
import BackgroundContainer from '../containers/BackgroundContainer';
|
2021-04-07 18:31:25 +00:00
|
|
|
import { getHeaderTitlePosition } from '../containers/Header';
|
|
|
|
import * as HeaderButton from '../containers/HeaderButton';
|
2022-01-18 14:39:24 +00:00
|
|
|
import RoomHeader from '../containers/RoomHeader';
|
2021-04-07 18:31:25 +00:00
|
|
|
import SafeAreaView from '../containers/SafeAreaView';
|
2021-09-22 17:29:26 +00:00
|
|
|
import SearchHeader from '../containers/SearchHeader';
|
2022-01-18 14:39:24 +00:00
|
|
|
import StatusBar from '../containers/StatusBar';
|
2022-05-09 13:21:09 +00:00
|
|
|
import { IApplicationState, IBaseScreen, TSubscriptionModel } from '../definitions';
|
2022-02-18 13:46:19 +00:00
|
|
|
import { ERoomType } from '../definitions/ERoomType';
|
2021-04-07 18:31:25 +00:00
|
|
|
import { withDimensions } from '../dimensions';
|
|
|
|
import I18n from '../i18n';
|
2022-01-18 14:39:24 +00:00
|
|
|
import database from '../lib/database';
|
2022-05-02 19:21:15 +00:00
|
|
|
import { CustomIcon } from '../containers/CustomIcon';
|
2022-04-20 21:37:54 +00:00
|
|
|
import RoomItem, { ROW_HEIGHT } from '../containers/RoomItem';
|
2022-01-18 14:39:24 +00:00
|
|
|
import { getUserSelector } from '../selectors/login';
|
|
|
|
import { ChatsStackParamList } from '../stacks/types';
|
2022-05-09 13:21:09 +00:00
|
|
|
import { withTheme } from '../theme';
|
2022-01-18 14:39:24 +00:00
|
|
|
import debounce from '../utils/debounce';
|
|
|
|
import { isIOS } from '../utils/deviceInfo';
|
|
|
|
import { goRoom } from '../utils/goRoom';
|
|
|
|
import { showErrorAlert } from '../utils/info';
|
|
|
|
import log, { events, logEvent } from '../utils/log';
|
2022-04-28 20:37:25 +00:00
|
|
|
import { getRoomAvatar, getRoomTitle, hasPermission } from '../lib/methods';
|
|
|
|
import { Services } from '../lib/services';
|
2021-04-07 18:31:25 +00:00
|
|
|
|
2021-04-07 20:41:19 +00:00
|
|
|
const API_FETCH_COUNT = 25;
|
2021-05-27 18:07:21 +00:00
|
|
|
|
2021-12-02 13:58:49 +00:00
|
|
|
const getItemLayout = (data: IItem[] | null | undefined, index: number) => ({
|
|
|
|
length: data?.length || 0,
|
2021-04-07 18:31:25 +00:00
|
|
|
offset: ROW_HEIGHT * index,
|
|
|
|
index
|
|
|
|
});
|
2021-12-02 13:58:49 +00:00
|
|
|
const keyExtractor = (item: IItem) => item._id;
|
|
|
|
|
2022-05-09 13:21:09 +00:00
|
|
|
export interface IItem {
|
2022-02-18 13:46:19 +00:00
|
|
|
_id: ERoomType;
|
2021-12-02 13:58:49 +00:00
|
|
|
fname: string;
|
|
|
|
customFields: object;
|
|
|
|
broadcast: boolean;
|
|
|
|
encrypted: boolean;
|
|
|
|
name: string;
|
|
|
|
t: string;
|
|
|
|
msgs: number;
|
|
|
|
usersCount: number;
|
|
|
|
u: { _id: string; name: string };
|
|
|
|
ts: string;
|
|
|
|
ro: boolean;
|
|
|
|
teamId: string;
|
|
|
|
default: boolean;
|
|
|
|
sysMes: boolean;
|
|
|
|
_updatedAt: string;
|
|
|
|
teamDefault: boolean;
|
|
|
|
}
|
2021-04-07 18:31:25 +00:00
|
|
|
|
2021-12-02 13:58:49 +00:00
|
|
|
interface ITeamChannelsViewState {
|
|
|
|
loading: boolean;
|
|
|
|
loadingMore: boolean;
|
|
|
|
data: IItem[];
|
|
|
|
isSearching: boolean;
|
|
|
|
searchText: string | null;
|
|
|
|
search: IItem[];
|
|
|
|
end: boolean;
|
|
|
|
showCreate: boolean;
|
|
|
|
}
|
|
|
|
|
2022-05-09 13:21:09 +00:00
|
|
|
interface ITeamChannelsViewProps extends IBaseScreen<ChatsStackParamList, 'TeamChannelsView'> {
|
2021-12-02 13:58:49 +00:00
|
|
|
insets: EdgeInsets;
|
|
|
|
useRealName: boolean;
|
|
|
|
width: number;
|
|
|
|
StoreLastMessage: boolean;
|
|
|
|
addTeamChannelPermission: string[];
|
|
|
|
editTeamChannelPermission: string[];
|
|
|
|
removeTeamChannelPermission: string[];
|
|
|
|
deleteCPermission: string[];
|
|
|
|
deletePPermission: string[];
|
2022-05-09 13:21:09 +00:00
|
|
|
showActionSheet: (options: TActionSheetOptions) => void;
|
2021-12-02 13:58:49 +00:00
|
|
|
showAvatar: boolean;
|
2022-05-09 13:21:09 +00:00
|
|
|
displayMode: DisplayMode;
|
2021-12-02 13:58:49 +00:00
|
|
|
}
|
|
|
|
class TeamChannelsView extends React.Component<ITeamChannelsViewProps, ITeamChannelsViewState> {
|
|
|
|
private teamId: string;
|
2022-05-09 13:21:09 +00:00
|
|
|
private joined: boolean;
|
|
|
|
private teamChannels: TSubscriptionModel[];
|
|
|
|
private team: TSubscriptionModel;
|
2021-12-02 13:58:49 +00:00
|
|
|
|
|
|
|
constructor(props: ITeamChannelsViewProps) {
|
2021-04-07 18:31:25 +00:00
|
|
|
super(props);
|
2022-05-09 13:21:09 +00:00
|
|
|
this.teamChannels = [];
|
|
|
|
this.team = {} as TSubscriptionModel;
|
|
|
|
this.joined = props.route.params?.joined;
|
2021-04-07 18:31:25 +00:00
|
|
|
this.teamId = props.route.params?.teamId;
|
|
|
|
this.state = {
|
|
|
|
loading: true,
|
|
|
|
loadingMore: false,
|
|
|
|
data: [],
|
|
|
|
isSearching: false,
|
|
|
|
searchText: '',
|
2021-04-07 20:41:19 +00:00
|
|
|
search: [],
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
end: false,
|
|
|
|
showCreate: false
|
2021-04-07 18:31:25 +00:00
|
|
|
};
|
|
|
|
this.loadTeam();
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
this.setHeader();
|
2021-04-07 18:31:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
this.load();
|
|
|
|
}
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
loadTeam = async () => {
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
const { addTeamChannelPermission } = this.props;
|
|
|
|
const { loading, data } = this.state;
|
|
|
|
|
2021-04-07 18:31:25 +00:00
|
|
|
const db = database.active;
|
|
|
|
try {
|
|
|
|
const subCollection = db.get('subscriptions');
|
2022-05-09 13:21:09 +00:00
|
|
|
this.teamChannels = await subCollection.query(Q.where('team_id', Q.eq(this.teamId))).fetch();
|
|
|
|
this.team = this.teamChannels?.find((channel: TSubscriptionModel) => channel.teamMain) as TSubscriptionModel;
|
2021-04-07 18:31:25 +00:00
|
|
|
this.setHeader();
|
|
|
|
|
|
|
|
if (!this.team) {
|
|
|
|
throw new Error();
|
|
|
|
}
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
|
2022-04-28 20:37:25 +00:00
|
|
|
const permissions = await hasPermission([addTeamChannelPermission], this.team.rid);
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
if (permissions[0]) {
|
|
|
|
this.setState({ showCreate: true }, () => this.setHeader());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (loading && data.length) {
|
|
|
|
this.setState({ loading: false });
|
|
|
|
}
|
2021-04-07 18:31:25 +00:00
|
|
|
} catch {
|
|
|
|
const { navigation } = this.props;
|
|
|
|
navigation.pop();
|
|
|
|
showErrorAlert(I18n.t('Team_not_found'));
|
|
|
|
}
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2021-04-07 18:31:25 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
load = debounce(async () => {
|
|
|
|
const { loadingMore, data, search, isSearching, searchText, end } = this.state;
|
2021-04-07 18:31:25 +00:00
|
|
|
|
|
|
|
const length = isSearching ? search.length : data.length;
|
2021-04-07 20:41:19 +00:00
|
|
|
if (loadingMore || end) {
|
2021-04-07 18:31:25 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.setState({ loadingMore: true });
|
|
|
|
try {
|
2022-04-28 20:37:25 +00:00
|
|
|
const result = await Services.getTeamListRoom({
|
2021-04-07 18:31:25 +00:00
|
|
|
teamId: this.teamId,
|
|
|
|
offset: length,
|
|
|
|
count: API_FETCH_COUNT,
|
|
|
|
type: 'all',
|
|
|
|
filter: searchText
|
|
|
|
});
|
|
|
|
|
|
|
|
if (result.success) {
|
|
|
|
const newState = {
|
|
|
|
loading: false,
|
|
|
|
loadingMore: false,
|
2021-04-07 20:41:19 +00:00
|
|
|
end: result.rooms.length < API_FETCH_COUNT
|
2021-12-02 13:58:49 +00:00
|
|
|
} as ITeamChannelsViewState;
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
|
2021-04-07 18:31:25 +00:00
|
|
|
if (isSearching) {
|
2022-05-09 13:21:09 +00:00
|
|
|
newState.search = [...search, ...result.rooms] as IItem[];
|
2021-04-07 18:31:25 +00:00
|
|
|
} else {
|
2022-05-09 13:21:09 +00:00
|
|
|
newState.data = [...data, ...result.rooms] as IItem[];
|
2021-04-07 18:31:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
this.setState(newState);
|
|
|
|
} else {
|
|
|
|
this.setState({ loading: false, loadingMore: false });
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
log(e);
|
|
|
|
this.setState({ loading: false, loadingMore: false });
|
|
|
|
}
|
2021-09-13 20:41:05 +00:00
|
|
|
}, 300);
|
2021-04-07 18:31:25 +00:00
|
|
|
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
setHeader = () => {
|
|
|
|
const { isSearching, showCreate, data } = this.state;
|
2021-09-22 17:29:26 +00:00
|
|
|
const { navigation, isMasterDetail, insets, theme } = this.props;
|
2021-04-07 18:31:25 +00:00
|
|
|
|
|
|
|
const { team } = this;
|
|
|
|
if (!team) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
const headerTitlePosition = getHeaderTitlePosition({ insets, numIconsRight: 2 });
|
2021-04-07 18:31:25 +00:00
|
|
|
|
|
|
|
if (isSearching) {
|
2021-12-02 13:58:49 +00:00
|
|
|
const options: StackNavigationOptions = {
|
2021-04-07 18:31:25 +00:00
|
|
|
headerTitleAlign: 'left',
|
|
|
|
headerLeft: () => (
|
|
|
|
<HeaderButton.Container left>
|
2021-09-13 20:41:05 +00:00
|
|
|
<HeaderButton.Item iconName='close' onPress={this.onCancelSearchPress} />
|
2021-04-07 18:31:25 +00:00
|
|
|
</HeaderButton.Container>
|
|
|
|
),
|
2021-09-08 23:56:35 +00:00
|
|
|
headerTitle: () => (
|
2022-01-24 15:51:31 +00:00
|
|
|
<SearchHeader onSearchChangeText={this.onSearchChangeText} testID='team-channels-view-search-header' />
|
2021-09-08 23:56:35 +00:00
|
|
|
),
|
2021-04-07 18:31:25 +00:00
|
|
|
headerTitleContainerStyle: {
|
|
|
|
left: headerTitlePosition.left,
|
|
|
|
right: headerTitlePosition.right
|
|
|
|
},
|
|
|
|
headerRight: () => null
|
|
|
|
};
|
2021-09-22 17:29:26 +00:00
|
|
|
return navigation.setOptions(options);
|
2021-04-07 18:31:25 +00:00
|
|
|
}
|
|
|
|
|
2021-12-02 13:58:49 +00:00
|
|
|
const options: StackNavigationOptions = {
|
2021-04-07 18:31:25 +00:00
|
|
|
headerShown: true,
|
|
|
|
headerTitleAlign: 'left',
|
|
|
|
headerTitleContainerStyle: {
|
|
|
|
left: headerTitlePosition.left,
|
|
|
|
right: headerTitlePosition.right
|
|
|
|
},
|
2021-09-22 17:29:26 +00:00
|
|
|
headerLeft: () => (
|
|
|
|
<HeaderBackButton labelVisible={false} onPress={() => navigation.pop()} tintColor={themes[theme].headerTintColor} />
|
|
|
|
),
|
2021-04-07 18:31:25 +00:00
|
|
|
headerTitle: () => (
|
2022-04-28 20:37:25 +00:00
|
|
|
<RoomHeader title={getRoomTitle(team)} subtitle={team.topic} type={team.t} onPress={this.goRoomActionsView} teamMain />
|
2021-04-07 18:31:25 +00:00
|
|
|
)
|
|
|
|
};
|
|
|
|
|
|
|
|
if (isMasterDetail) {
|
|
|
|
options.headerLeft = () => <HeaderButton.CloseModal navigation={navigation} />;
|
|
|
|
}
|
|
|
|
|
|
|
|
options.headerRight = () => (
|
|
|
|
<HeaderButton.Container>
|
2021-09-13 20:41:05 +00:00
|
|
|
{showCreate ? (
|
|
|
|
<HeaderButton.Item
|
|
|
|
iconName='create'
|
|
|
|
testID='team-channels-view-create'
|
|
|
|
onPress={() => navigation.navigate('AddChannelTeamView', { teamId: this.teamId, teamChannels: data })}
|
|
|
|
/>
|
|
|
|
) : null}
|
[TEST] E2E Tests for Teams (#3178)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Added SelectListView and logic for leaving team
* Added addTeamMember and removeTeamMember
* Minor tweak
* Added deleteTeam function
* Minor tweak
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Remove unnecesary prop
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* Minor refactor to ListItem, add SelectListView to ModalStack, update handleLeaveTeam
* Minor tweaks
* Update SelectListView
* Update handleLeaveTeam, remove unnecessary method, add story
* Minor tweak
* Minor visual tweaks
* Update SelectListView.js
* Update index.js
* Update RoomMembersView
* Updated SelectListView, RoomActionsView, leaveTeam method and string translations
* Update SelectListVIew
* Minor tweak
* Update SelectListView
* Minor tweak
* Minor tweaks
* Fix for List.Item subtitles being pushed down by title's flex
* Minor tweaks
* Update RoomActionsView
* Use showConfirmationAlert and showErrorAlert
* Remove addTeamMember, update removeTeamMember
* Update Alert
* Minor tweaks
* Minor tweaks
* Minor tweak
* Update showActionSheet on RoomMembersView
* Remove team main from query and move code around
* Fetch roles
* Update RoomMembersView and SelectListView
* Update rocketchat.js
* Updated leaveTeam and handleRemoveFromTeam
* Fix validation
* Remove unnecessary function
* Update RoomActionsView
* Update en.json
* updated deleteTeam function and permissions
* Added showConfirmationAlert
* Added string translations for teams
* Fix permission
* Added moveChannelToTeam and convertToTeam functionality
* Fix SelectListView RadioButton
* Fix moveToTeam
* Added searchBar to SelectListVIew
* Update RoomView , SelectListVIew and string translation for error
* E2E for Teams
* Fix tests and cleanup
* Minor refactor
* Wrong label
* Move/convert
* Fix convert
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-06-04 16:16:05 +00:00
|
|
|
<HeaderButton.Item iconName='search' testID='team-channels-view-search' onPress={this.onSearchPress} />
|
2021-04-07 18:31:25 +00:00
|
|
|
</HeaderButton.Container>
|
|
|
|
);
|
|
|
|
navigation.setOptions(options);
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2021-04-07 18:31:25 +00:00
|
|
|
|
|
|
|
onSearchPress = () => {
|
|
|
|
logEvent(events.TC_SEARCH);
|
|
|
|
this.setState({ isSearching: true }, () => this.setHeader());
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2021-04-07 18:31:25 +00:00
|
|
|
|
2021-12-02 13:58:49 +00:00
|
|
|
onSearchChangeText = debounce((searchText: string) => {
|
2021-09-13 20:41:05 +00:00
|
|
|
this.setState(
|
|
|
|
{
|
|
|
|
searchText,
|
|
|
|
search: [],
|
|
|
|
loading: !!searchText,
|
|
|
|
loadingMore: false,
|
|
|
|
end: false
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
if (searchText) {
|
|
|
|
this.load();
|
|
|
|
}
|
2021-04-07 18:31:25 +00:00
|
|
|
}
|
2021-09-13 20:41:05 +00:00
|
|
|
);
|
|
|
|
}, 300);
|
2021-04-07 18:31:25 +00:00
|
|
|
|
|
|
|
onCancelSearchPress = () => {
|
|
|
|
logEvent(events.TC_CANCEL_SEARCH);
|
|
|
|
const { isSearching } = this.state;
|
|
|
|
if (!isSearching) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Keyboard.dismiss();
|
2021-09-13 20:41:05 +00:00
|
|
|
this.setState(
|
|
|
|
{
|
|
|
|
searchText: null,
|
|
|
|
isSearching: false,
|
|
|
|
search: [],
|
|
|
|
loadingMore: false,
|
|
|
|
end: false
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
this.setHeader();
|
|
|
|
}
|
|
|
|
);
|
2021-04-07 18:31:25 +00:00
|
|
|
};
|
|
|
|
|
2021-12-02 13:58:49 +00:00
|
|
|
goRoomActionsView = (screen: string) => {
|
2021-04-07 18:31:25 +00:00
|
|
|
logEvent(events.TC_GO_ACTIONS);
|
2022-05-09 13:21:09 +00:00
|
|
|
const { team, joined } = this;
|
2021-09-13 20:41:05 +00:00
|
|
|
const { navigation, isMasterDetail } = this.props;
|
2022-05-09 13:21:09 +00:00
|
|
|
if (!team) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (isMasterDetail && screen) {
|
2021-04-07 18:31:25 +00:00
|
|
|
navigation.navigate('ModalStackNavigator', {
|
2022-05-09 13:21:09 +00:00
|
|
|
screen: 'RoomActionsView',
|
2021-04-07 18:31:25 +00:00
|
|
|
params: {
|
2021-09-13 20:41:05 +00:00
|
|
|
rid: team.rid,
|
|
|
|
t: team.t,
|
|
|
|
room: team,
|
2022-05-09 13:21:09 +00:00
|
|
|
joined
|
2021-04-07 18:31:25 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
navigation.navigate('RoomActionsView', {
|
2021-09-13 20:41:05 +00:00
|
|
|
rid: team.rid,
|
|
|
|
t: team.t,
|
2022-05-09 13:21:09 +00:00
|
|
|
room: team,
|
|
|
|
joined
|
2021-04-07 18:31:25 +00:00
|
|
|
});
|
|
|
|
}
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2021-04-07 18:31:25 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
onPressItem = debounce(
|
2021-12-02 13:58:49 +00:00
|
|
|
async (item: IItem) => {
|
2021-09-13 20:41:05 +00:00
|
|
|
logEvent(events.TC_GO_ROOM);
|
|
|
|
const { navigation, isMasterDetail } = this.props;
|
|
|
|
try {
|
2022-03-16 00:04:10 +00:00
|
|
|
let params = {};
|
2022-04-28 20:37:25 +00:00
|
|
|
const result = await Services.getRoomInfo(item._id);
|
2022-03-16 00:04:10 +00:00
|
|
|
if (result.success) {
|
|
|
|
params = {
|
|
|
|
rid: item._id,
|
2022-04-28 20:37:25 +00:00
|
|
|
name: getRoomTitle(result.room),
|
2022-03-16 00:04:10 +00:00
|
|
|
joinCodeRequired: result.room.joinCodeRequired,
|
|
|
|
t: result.room.t,
|
|
|
|
teamId: result.room.teamId
|
|
|
|
};
|
|
|
|
}
|
2021-09-13 20:41:05 +00:00
|
|
|
if (isMasterDetail) {
|
|
|
|
navigation.pop();
|
|
|
|
}
|
|
|
|
goRoom({ item: params, isMasterDetail, navigationMethod: navigation.push });
|
2021-12-02 13:58:49 +00:00
|
|
|
} catch (e: any) {
|
2021-09-13 20:41:05 +00:00
|
|
|
if (e.data.error === 'not-allowed') {
|
|
|
|
showErrorAlert(I18n.t('error-not-allowed'));
|
|
|
|
} else {
|
|
|
|
showErrorAlert(e.data.error);
|
|
|
|
}
|
2021-06-04 18:40:50 +00:00
|
|
|
}
|
2021-09-13 20:41:05 +00:00
|
|
|
},
|
|
|
|
1000,
|
|
|
|
true
|
|
|
|
);
|
2021-04-07 18:31:25 +00:00
|
|
|
|
2021-12-02 13:58:49 +00:00
|
|
|
toggleAutoJoin = async (item: IItem) => {
|
2021-06-04 18:08:37 +00:00
|
|
|
logEvent(events.TC_TOGGLE_AUTOJOIN);
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
try {
|
|
|
|
const { data } = this.state;
|
2022-04-28 20:37:25 +00:00
|
|
|
const result = await Services.updateTeamRoom({ roomId: item._id, isDefault: !item.teamDefault });
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
if (result.success) {
|
2021-09-13 20:41:05 +00:00
|
|
|
const newData = data.map(i => {
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
if (i._id === item._id) {
|
|
|
|
i.teamDefault = !i.teamDefault;
|
|
|
|
}
|
|
|
|
return i;
|
|
|
|
});
|
|
|
|
this.setState({ data: newData });
|
|
|
|
}
|
|
|
|
} catch (e) {
|
2021-06-04 18:08:37 +00:00
|
|
|
logEvent(events.TC_TOGGLE_AUTOJOIN_F);
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
log(e);
|
|
|
|
}
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
|
2021-12-02 13:58:49 +00:00
|
|
|
remove = (item: IItem) => {
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
Alert.alert(
|
|
|
|
I18n.t('Confirmation'),
|
[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('Remove_Team_Room_Warning'),
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
[
|
|
|
|
{
|
|
|
|
text: I18n.t('Cancel'),
|
|
|
|
style: 'cancel'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: I18n.t('Yes_action_it', { action: I18n.t('remove') }),
|
|
|
|
style: 'destructive',
|
|
|
|
onPress: () => this.removeRoom(item)
|
|
|
|
}
|
|
|
|
],
|
|
|
|
{ cancelable: false }
|
|
|
|
);
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
|
2021-12-02 13:58:49 +00:00
|
|
|
removeRoom = async (item: IItem) => {
|
2021-06-04 18:08:37 +00:00
|
|
|
logEvent(events.TC_DELETE_ROOM);
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
try {
|
|
|
|
const { data } = this.state;
|
2022-05-09 13:21:09 +00:00
|
|
|
const result = await Services.removeTeamRoom({ roomId: item._id, teamId: this.team.teamId as string });
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
if (result.success) {
|
|
|
|
const newData = data.filter(room => result.room._id !== room._id);
|
|
|
|
this.setState({ data: newData });
|
|
|
|
}
|
|
|
|
} catch (e) {
|
2021-06-04 18:08:37 +00:00
|
|
|
logEvent(events.TC_DELETE_ROOM_F);
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
log(e);
|
|
|
|
}
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
|
2021-12-02 13:58:49 +00:00
|
|
|
delete = (item: IItem) => {
|
2021-06-04 18:08:37 +00:00
|
|
|
logEvent(events.TC_DELETE_ROOM);
|
2022-01-18 14:39:24 +00:00
|
|
|
const { dispatch } = this.props;
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
|
|
|
|
Alert.alert(
|
|
|
|
I18n.t('Are_you_sure_question_mark'),
|
|
|
|
I18n.t('Delete_Room_Warning'),
|
|
|
|
[
|
|
|
|
{
|
|
|
|
text: I18n.t('Cancel'),
|
|
|
|
style: 'cancel'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: I18n.t('Yes_action_it', { action: I18n.t('delete') }),
|
|
|
|
style: 'destructive',
|
2022-05-23 17:16:17 +00:00
|
|
|
onPress: () => dispatch(deleteRoom(ERoomType.c, item))
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
{ cancelable: false }
|
|
|
|
);
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
|
2021-12-02 13:58:49 +00:00
|
|
|
showChannelActions = async (item: IItem) => {
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
logEvent(events.ROOM_SHOW_BOX_ACTIONS);
|
2021-05-27 18:07:21 +00:00
|
|
|
const {
|
2021-09-13 20:41:05 +00:00
|
|
|
showActionSheet,
|
|
|
|
editTeamChannelPermission,
|
|
|
|
deleteCPermission,
|
|
|
|
deletePPermission,
|
|
|
|
theme,
|
|
|
|
removeTeamChannelPermission
|
2021-05-27 18:07:21 +00:00
|
|
|
} = this.props;
|
|
|
|
const isAutoJoinChecked = item.teamDefault;
|
|
|
|
const autoJoinIcon = isAutoJoinChecked ? 'checkbox-checked' : 'checkbox-unchecked';
|
|
|
|
const autoJoinIconColor = isAutoJoinChecked ? themes[theme].tintActive : themes[theme].auxiliaryTintColor;
|
|
|
|
|
2022-05-09 13:21:09 +00:00
|
|
|
const options: TActionSheetOptionsItem[] = [];
|
2021-05-27 18:07:21 +00:00
|
|
|
|
2022-04-28 20:37:25 +00:00
|
|
|
const permissionsTeam = await hasPermission([editTeamChannelPermission], this.team.rid);
|
2021-05-27 18:07:21 +00:00
|
|
|
if (permissionsTeam[0]) {
|
|
|
|
options.push({
|
|
|
|
title: I18n.t('Auto-join'),
|
|
|
|
icon: item.t === 'p' ? 'channel-private' : 'channel-public',
|
|
|
|
onPress: () => this.toggleAutoJoin(item),
|
2021-09-13 20:41:05 +00:00
|
|
|
right: () => (
|
|
|
|
<CustomIcon
|
|
|
|
testID={isAutoJoinChecked ? 'auto-join-checked' : 'auto-join-unchecked'}
|
|
|
|
name={autoJoinIcon}
|
|
|
|
size={20}
|
|
|
|
color={autoJoinIconColor}
|
|
|
|
/>
|
|
|
|
),
|
[TEST] E2E Tests for Teams (#3178)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Added SelectListView and logic for leaving team
* Added addTeamMember and removeTeamMember
* Minor tweak
* Added deleteTeam function
* Minor tweak
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Remove unnecesary prop
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* Minor refactor to ListItem, add SelectListView to ModalStack, update handleLeaveTeam
* Minor tweaks
* Update SelectListView
* Update handleLeaveTeam, remove unnecessary method, add story
* Minor tweak
* Minor visual tweaks
* Update SelectListView.js
* Update index.js
* Update RoomMembersView
* Updated SelectListView, RoomActionsView, leaveTeam method and string translations
* Update SelectListVIew
* Minor tweak
* Update SelectListView
* Minor tweak
* Minor tweaks
* Fix for List.Item subtitles being pushed down by title's flex
* Minor tweaks
* Update RoomActionsView
* Use showConfirmationAlert and showErrorAlert
* Remove addTeamMember, update removeTeamMember
* Update Alert
* Minor tweaks
* Minor tweaks
* Minor tweak
* Update showActionSheet on RoomMembersView
* Remove team main from query and move code around
* Fetch roles
* Update RoomMembersView and SelectListView
* Update rocketchat.js
* Updated leaveTeam and handleRemoveFromTeam
* Fix validation
* Remove unnecessary function
* Update RoomActionsView
* Update en.json
* updated deleteTeam function and permissions
* Added showConfirmationAlert
* Added string translations for teams
* Fix permission
* Added moveChannelToTeam and convertToTeam functionality
* Fix SelectListView RadioButton
* Fix moveToTeam
* Added searchBar to SelectListVIew
* Update RoomView , SelectListVIew and string translation for error
* E2E for Teams
* Fix tests and cleanup
* Minor refactor
* Wrong label
* Move/convert
* Fix convert
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-06-04 16:16:05 +00:00
|
|
|
testID: 'action-sheet-auto-join'
|
2021-05-27 18:07:21 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-04-28 20:37:25 +00:00
|
|
|
const permissionsRemoveTeam = await hasPermission([removeTeamChannelPermission], this.team.rid);
|
2021-05-27 18:07:21 +00:00
|
|
|
if (permissionsRemoveTeam[0]) {
|
|
|
|
options.push({
|
|
|
|
title: I18n.t('Remove_from_Team'),
|
|
|
|
icon: 'close',
|
|
|
|
danger: true,
|
[TEST] E2E Tests for Teams (#3178)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Added SelectListView and logic for leaving team
* Added addTeamMember and removeTeamMember
* Minor tweak
* Added deleteTeam function
* Minor tweak
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Remove unnecesary prop
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* Minor refactor to ListItem, add SelectListView to ModalStack, update handleLeaveTeam
* Minor tweaks
* Update SelectListView
* Update handleLeaveTeam, remove unnecessary method, add story
* Minor tweak
* Minor visual tweaks
* Update SelectListView.js
* Update index.js
* Update RoomMembersView
* Updated SelectListView, RoomActionsView, leaveTeam method and string translations
* Update SelectListVIew
* Minor tweak
* Update SelectListView
* Minor tweak
* Minor tweaks
* Fix for List.Item subtitles being pushed down by title's flex
* Minor tweaks
* Update RoomActionsView
* Use showConfirmationAlert and showErrorAlert
* Remove addTeamMember, update removeTeamMember
* Update Alert
* Minor tweaks
* Minor tweaks
* Minor tweak
* Update showActionSheet on RoomMembersView
* Remove team main from query and move code around
* Fetch roles
* Update RoomMembersView and SelectListView
* Update rocketchat.js
* Updated leaveTeam and handleRemoveFromTeam
* Fix validation
* Remove unnecessary function
* Update RoomActionsView
* Update en.json
* updated deleteTeam function and permissions
* Added showConfirmationAlert
* Added string translations for teams
* Fix permission
* Added moveChannelToTeam and convertToTeam functionality
* Fix SelectListView RadioButton
* Fix moveToTeam
* Added searchBar to SelectListVIew
* Update RoomView , SelectListVIew and string translation for error
* E2E for Teams
* Fix tests and cleanup
* Minor refactor
* Wrong label
* Move/convert
* Fix convert
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-06-04 16:16:05 +00:00
|
|
|
onPress: () => this.remove(item),
|
|
|
|
testID: 'action-sheet-remove-from-team'
|
2021-05-27 18:07:21 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-04-28 20:37:25 +00:00
|
|
|
const permissionsChannel = await hasPermission([item.t === 'c' ? deleteCPermission : deletePPermission], item._id);
|
2021-05-27 18:07:21 +00:00
|
|
|
if (permissionsChannel[0]) {
|
|
|
|
options.push({
|
|
|
|
title: I18n.t('Delete'),
|
|
|
|
icon: 'delete',
|
|
|
|
danger: true,
|
[TEST] E2E Tests for Teams (#3178)
* Added Create Team
* Added actionTypes, actions, ENG strings for Teams and updated NewMessageView
* Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView
* Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
* Minor tweaks
* Show TeamChannelsView only if joined the team
* Minor tweak
* Added AddChannelTeamView
* Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView
* Refactor touch component and update removeRoom and deleteRoom methods
* Minor tweaks
* Minor tweaks for removing channels and addExistingChannelView
* Added missing events and fixed channels list
* Minor tweaks for refactored touch component
* Added SelectListView and logic for leaving team
* Added addTeamMember and removeTeamMember
* Minor tweak
* Added deleteTeam function
* Minor tweak
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* Remove unnecesary prop
* Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable
* Minor tweak
* Update loadMessagesForRoom.js
* Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item
* Fix unnecessary changes
* Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView
* Updated styles, added tag story
* Minor tweak
* Minor tweaks
* Auto-join tweak
* Minor tweaks
* Minor tweak on search
* Minor refactor to ListItem, add SelectListView to ModalStack, update handleLeaveTeam
* Minor tweaks
* Update SelectListView
* Update handleLeaveTeam, remove unnecessary method, add story
* Minor tweak
* Minor visual tweaks
* Update SelectListView.js
* Update index.js
* Update RoomMembersView
* Updated SelectListView, RoomActionsView, leaveTeam method and string translations
* Update SelectListVIew
* Minor tweak
* Update SelectListView
* Minor tweak
* Minor tweaks
* Fix for List.Item subtitles being pushed down by title's flex
* Minor tweaks
* Update RoomActionsView
* Use showConfirmationAlert and showErrorAlert
* Remove addTeamMember, update removeTeamMember
* Update Alert
* Minor tweaks
* Minor tweaks
* Minor tweak
* Update showActionSheet on RoomMembersView
* Remove team main from query and move code around
* Fetch roles
* Update RoomMembersView and SelectListView
* Update rocketchat.js
* Updated leaveTeam and handleRemoveFromTeam
* Fix validation
* Remove unnecessary function
* Update RoomActionsView
* Update en.json
* updated deleteTeam function and permissions
* Added showConfirmationAlert
* Added string translations for teams
* Fix permission
* Added moveChannelToTeam and convertToTeam functionality
* Fix SelectListView RadioButton
* Fix moveToTeam
* Added searchBar to SelectListVIew
* Update RoomView , SelectListVIew and string translation for error
* E2E for Teams
* Fix tests and cleanup
* Minor refactor
* Wrong label
* Move/convert
* Fix convert
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-06-04 16:16:05 +00:00
|
|
|
onPress: () => this.delete(item),
|
|
|
|
testID: 'action-sheet-delete'
|
2021-05-27 18:07:21 +00:00
|
|
|
});
|
|
|
|
}
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
|
2021-05-27 18:07:21 +00:00
|
|
|
if (options.length === 0) {
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-05-27 18:07:21 +00:00
|
|
|
showActionSheet({ options });
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
|
2021-12-02 13:58:49 +00:00
|
|
|
renderItem = ({ item }: { item: IItem }) => {
|
2021-10-06 20:30:10 +00:00
|
|
|
const { StoreLastMessage, useRealName, theme, width, showAvatar, displayMode } = this.props;
|
2021-04-07 18:31:25 +00:00
|
|
|
return (
|
|
|
|
<RoomItem
|
|
|
|
item={item}
|
|
|
|
theme={theme}
|
|
|
|
type={item.t}
|
|
|
|
showLastMessage={StoreLastMessage}
|
|
|
|
onPress={this.onPressItem}
|
|
|
|
width={width}
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
onLongPress={this.showChannelActions}
|
2021-04-07 18:31:25 +00:00
|
|
|
useRealName={useRealName}
|
2022-04-28 20:37:25 +00:00
|
|
|
getRoomTitle={getRoomTitle}
|
|
|
|
getRoomAvatar={getRoomAvatar}
|
2021-04-07 18:31:25 +00:00
|
|
|
swipeEnabled={false}
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
autoJoin={item.teamDefault}
|
2021-10-06 20:30:10 +00:00
|
|
|
showAvatar={showAvatar}
|
|
|
|
displayMode={displayMode}
|
2021-04-07 18:31:25 +00:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
renderFooter = () => {
|
|
|
|
const { loadingMore } = this.state;
|
|
|
|
if (loadingMore) {
|
2022-03-18 02:37:10 +00:00
|
|
|
return <ActivityIndicator />;
|
2021-04-07 18:31:25 +00:00
|
|
|
}
|
|
|
|
return null;
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2021-04-07 18:31:25 +00:00
|
|
|
|
|
|
|
renderScroll = () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
const { loading, data, search, isSearching, searchText } = this.state;
|
2021-04-07 18:31:25 +00:00
|
|
|
if (loading) {
|
|
|
|
return <BackgroundContainer loading />;
|
|
|
|
}
|
|
|
|
if (isSearching && !search.length) {
|
|
|
|
return <BackgroundContainer text={searchText ? I18n.t('No_team_channels_found') : ''} />;
|
|
|
|
}
|
|
|
|
if (!isSearching && !data.length) {
|
|
|
|
return <BackgroundContainer text={I18n.t('No_team_channels_found')} />;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<FlatList
|
|
|
|
data={isSearching ? search : data}
|
|
|
|
extraData={isSearching ? search : data}
|
|
|
|
keyExtractor={keyExtractor}
|
|
|
|
renderItem={this.renderItem}
|
|
|
|
getItemLayout={getItemLayout}
|
|
|
|
removeClippedSubviews={isIOS}
|
|
|
|
keyboardShouldPersistTaps='always'
|
|
|
|
onEndReached={() => this.load()}
|
|
|
|
onEndReachedThreshold={0.5}
|
|
|
|
ListFooterComponent={this.renderFooter}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
2021-09-13 20:41:05 +00:00
|
|
|
console.count(`${this.constructor.name}.render calls`);
|
2021-04-07 18:31:25 +00:00
|
|
|
return (
|
|
|
|
<SafeAreaView testID='team-channels-view'>
|
|
|
|
<StatusBar />
|
|
|
|
{this.renderScroll()}
|
|
|
|
</SafeAreaView>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-18 14:39:24 +00:00
|
|
|
const mapStateToProps = (state: IApplicationState) => ({
|
2021-04-07 18:31:25 +00:00
|
|
|
baseUrl: state.server.server,
|
|
|
|
user: getUserSelector(state),
|
|
|
|
useRealName: state.settings.UI_Use_Real_Name,
|
|
|
|
isMasterDetail: state.app.isMasterDetail,
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
StoreLastMessage: state.settings.Store_Last_Message,
|
2022-05-09 13:21:09 +00:00
|
|
|
addTeamChannelPermission: state.permissions['add-team-channel'],
|
|
|
|
editTeamChannelPermission: state.permissions['edit-team-channel'],
|
|
|
|
removeTeamChannelPermission: state.permissions['remove-team-channel'],
|
|
|
|
deleteCPermission: state.permissions['delete-c'],
|
|
|
|
deletePPermission: state.permissions['delete-p'],
|
2021-10-06 20:30:10 +00:00
|
|
|
showAvatar: state.sortPreferences.showAvatar,
|
|
|
|
displayMode: state.sortPreferences.displayMode
|
[NEW] Add/Create/Remove channel on a team (#3090)
* 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
* Minor tweaks
* Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable
* 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
* One way to refactor :P
* Next level refactor :)
* Fix create group dm
* Refactor renderItem
* Minor bug fixes
* Fix stories
Co-authored-by: Diego Mello <diegolmello@gmail.com>
2021-05-19 21:14:42 +00:00
|
|
|
});
|
|
|
|
|
2022-01-18 14:39:24 +00:00
|
|
|
export default connect(mapStateToProps)(withDimensions(withSafeAreaInsets(withTheme(withActionSheet(TeamChannelsView)))));
|