diff --git a/app/i18n/locales/en.json b/app/i18n/locales/en.json
index a8f8d963..e23bb33b 100644
--- a/app/i18n/locales/en.json
+++ b/app/i18n/locales/en.json
@@ -332,6 +332,7 @@
"My_servers": "My servers",
"N_people_reacted": "{{n}} people reacted",
"N_users": "{{n}} users",
+ "N_channels": "{{n}} channels",
"name": "name",
"Name": "Name",
"Navigation_history": "Navigation history",
diff --git a/app/lib/rocketchat.js b/app/lib/rocketchat.js
index f174aa1e..6e7b3bcb 100644
--- a/app/lib/rocketchat.js
+++ b/app/lib/rocketchat.js
@@ -798,6 +798,10 @@ const RocketChat = {
// RC 3.13.0
return this.sdk.get('teams.listRoomsOfUser', { teamId, userId });
},
+ getTeamInfo({ teamId }) {
+ // RC 3.13.0
+ return this.sdk.get('teams.info', { teamId });
+ },
convertChannelToTeam({ rid, name, type }) {
const params = {
...(type === 'c'
diff --git a/app/presentation/DirectoryItem/index.js b/app/presentation/DirectoryItem/index.js
index 75b944c5..9f98969a 100644
--- a/app/presentation/DirectoryItem/index.js
+++ b/app/presentation/DirectoryItem/index.js
@@ -18,7 +18,7 @@ const DirectoryItemLabel = React.memo(({ text, theme }) => {
});
const DirectoryItem = ({
- title, description, avatar, onPress, testID, style, rightLabel, type, rid, theme
+ title, description, avatar, onPress, testID, style, rightLabel, type, rid, theme, teamMain
}) => (
-
+
{title}
{ description ? {description} : null }
@@ -56,7 +56,8 @@ DirectoryItem.propTypes = {
style: PropTypes.any,
rightLabel: PropTypes.string,
rid: PropTypes.string,
- theme: PropTypes.string
+ theme: PropTypes.string,
+ teamMain: PropTypes.bool
};
DirectoryItemLabel.propTypes = {
diff --git a/app/views/DirectoryView/Options.js b/app/views/DirectoryView/Options.js
index ad8de1da..a88bf42b 100644
--- a/app/views/DirectoryView/Options.js
+++ b/app/views/DirectoryView/Options.js
@@ -64,6 +64,11 @@ export default class DirectoryOptions extends PureComponent {
icon = 'channel-public';
}
+ if (itemType === 'teams') {
+ text = 'Teams';
+ icon = 'teams';
+ }
+
return (
changeType(itemType)}
@@ -105,6 +110,7 @@ export default class DirectoryOptions extends PureComponent {
{this.renderItem('channels')}
{this.renderItem('users')}
+ {this.renderItem('teams')}
{isFederationEnabled
? (
<>
diff --git a/app/views/DirectoryView/index.js b/app/views/DirectoryView/index.js
index f78e74a2..c5cacb64 100644
--- a/app/views/DirectoryView/index.js
+++ b/app/views/DirectoryView/index.js
@@ -121,6 +121,8 @@ class DirectoryView extends React.Component {
logEvent(events.DIRECTORY_SEARCH_USERS);
} else if (type === 'channels') {
logEvent(events.DIRECTORY_SEARCH_CHANNELS);
+ } else if (type === 'teams') {
+ logEvent(events.DIRECTORY_SEARCH_TEAMS);
}
}
@@ -149,17 +151,34 @@ class DirectoryView extends React.Component {
if (result.success) {
this.goRoom({ rid: result.room._id, name: item.username, t: 'd' });
}
- } else {
+ } else if (['p', 'c'].includes(item.t) && !item.teamMain) {
const { room } = await RocketChat.getRoomInfo(item._id);
this.goRoom({
rid: item._id, name: item.name, joinCodeRequired: room.joinCodeRequired, t: 'c', search: true
});
+ } else {
+ this.goRoom({
+ rid: item._id, name: item.name, t: item.t, search: true, teamMain: item.teamMain, teamId: item.teamId
+ });
}
}
renderHeader = () => {
const { type } = this.state;
const { theme } = this.props;
+ let text = 'Users';
+ let icon = 'user';
+
+ if (type === 'channels') {
+ text = 'Channels';
+ icon = 'channel-public';
+ }
+
+ if (type === 'teams') {
+ text = 'Teams';
+ icon = 'teams';
+ }
+
return (
<>
-
- {type === 'users' ? I18n.t('Users') : I18n.t('Channels')}
+
+ {I18n.t(text)}
@@ -217,12 +236,25 @@ class DirectoryView extends React.Component {
/>
);
}
+
+ if (type === 'teams') {
+ return (
+
+ );
+ }
return (
);
diff --git a/e2e/tests/assorted/09-joinfromdirectory.spec.js b/e2e/tests/assorted/09-joinfromdirectory.spec.js
index 308c4db2..039ef823 100644
--- a/e2e/tests/assorted/09-joinfromdirectory.spec.js
+++ b/e2e/tests/assorted/09-joinfromdirectory.spec.js
@@ -32,16 +32,24 @@ describe('Join room from directory', () => {
await navigateToRoom(data.channels.detoxpublic.name);
})
- it('should back and tap directory', async() => {
+ it('should search user and navigate', async() => {
await tapBack();
await element(by.id('rooms-list-view-directory')).tap();
- })
-
- it('should search user and navigate', async() => {
+ await waitFor(element(by.id('directory-view'))).toExist().withTimeout(2000);
await element(by.id('directory-view-dropdown')).tap();
await element(by.label('Users')).tap();
await element(by.label('Search by')).tap();
await navigateToRoom(data.users.alternate.username);
})
+
+ it('should search user and navigate', async() => {
+ await tapBack();
+ await element(by.id('rooms-list-view-directory')).tap();
+ await waitFor(element(by.id('directory-view'))).toExist().withTimeout(2000);
+ await element(by.id('directory-view-dropdown')).tap();
+ await element(by.label('Teams')).tap();
+ await element(by.label('Search by')).tap();
+ await navigateToRoom(data.teams.private.name);
+ })
});
});