regression: add teams to action screen (#4942)
* add teams to action screen * keep it the old way * fix test id * back to old one rule * fix team tests * fix moveconvert test * remove skip from room.spec * fix shared config doc * remove skip from broadcast.spec
This commit is contained in:
parent
cf14ebea78
commit
337e9e155d
|
@ -768,7 +768,7 @@
|
|||
"Convert_to_Team_Warning": "You are converting this Channel to a Team. All Members will be kept.",
|
||||
"Move_to_Team": "Move to Team",
|
||||
"Move_Channel_Paragraph": "Moving a channel inside a team means that this channel will be added in the team’s context, however, all channel’s members, which are not members of the respective team, will still have access to this channel, but will not be added as team’s members. \n\nAll channel’s management will still be made by the owners of this channel.\n\nTeam’s members and even team’s owners, if not a member of this channel, can not have access to the channel’s content. \n\nPlease notice that the Team’s owner will be able remove members from the Channel.",
|
||||
"Move_to_Team_Warning": "After reading the previous intructions about this behavior, do you still want to move this channel to the selected team?",
|
||||
"Move_to_Team_Warning": "After reading the previous instructions about this behavior, do you still want to move this channel to the selected team?",
|
||||
"Load_More": "Load More",
|
||||
"Load_Newer": "Load Newer",
|
||||
"Load_Older": "Load Older",
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import { Q } from '@nozbe/watermelondb';
|
||||
|
||||
import { useActionSheet } from '../../containers/ActionSheet';
|
||||
import StartACallActionSheet from '../../containers/UIKit/VideoConferenceBlock/components/StartACallActionSheet';
|
||||
import { ISubscription, SubscriptionType, TSubscriptionModel } from '../../definitions';
|
||||
import { ISubscription, SubscriptionType } from '../../definitions';
|
||||
import i18n from '../../i18n';
|
||||
import { getUserSelector } from '../../selectors/login';
|
||||
import database from '../database';
|
||||
import { getSubscriptionByRoomId } from '../database/services/Subscription';
|
||||
import { callJitsi } from '../methods';
|
||||
import { compareServerVersion, showErrorAlert } from '../methods/helpers';
|
||||
|
@ -40,14 +38,18 @@ export const useVideoConf = (rid: string): { showInitCallActionSheet: () => Prom
|
|||
const { showActionSheet } = useActionSheet();
|
||||
const snaps = useSnaps([1250]);
|
||||
|
||||
const handleShowCallOption = (room: TSubscriptionModel) => {
|
||||
const handleShowCallOption = async () => {
|
||||
if (isServer5OrNewer) return setShowCallOption(true);
|
||||
const isJitsiDisabledForTeams = room.teamMain && !jitsiEnableTeams;
|
||||
const isJitsiDisabledForChannels = !room.teamMain && (room.t === 'p' || room.t === 'c') && !jitsiEnableChannels;
|
||||
const room = await getSubscriptionByRoomId(rid);
|
||||
|
||||
if (room.t === SubscriptionType.DIRECT) return setShowCallOption(!!jitsiEnabled);
|
||||
if (room.t === SubscriptionType.CHANNEL) return setShowCallOption(!isJitsiDisabledForChannels);
|
||||
if (room.t === SubscriptionType.GROUP) return setShowCallOption(!isJitsiDisabledForTeams);
|
||||
if (room) {
|
||||
const isJitsiDisabledForTeams = room.teamMain && !jitsiEnableTeams;
|
||||
const isJitsiDisabledForChannels = !room.teamMain && (room.t === 'p' || room.t === 'c') && !jitsiEnableChannels;
|
||||
|
||||
if (room.t === SubscriptionType.DIRECT) return setShowCallOption(!!jitsiEnabled);
|
||||
if (room.t === SubscriptionType.CHANNEL) return setShowCallOption(!isJitsiDisabledForChannels);
|
||||
if (room.t === SubscriptionType.GROUP) return setShowCallOption(!isJitsiDisabledForTeams);
|
||||
}
|
||||
|
||||
return setShowCallOption(false);
|
||||
};
|
||||
|
@ -90,23 +92,8 @@ export const useVideoConf = (rid: string): { showInitCallActionSheet: () => Prom
|
|||
}
|
||||
};
|
||||
|
||||
const initSubscription = () => {
|
||||
try {
|
||||
const db = database.active;
|
||||
const observeSubCollection = db.get('subscriptions').query(Q.where('rid', rid)).observe();
|
||||
const subObserveQuery = observeSubCollection.subscribe(data => {
|
||||
if (data[0]) {
|
||||
handleShowCallOption(data[0]);
|
||||
subObserveQuery.unsubscribe();
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
console.log("observeSubscriptions: Can't find subscription to observe");
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
initSubscription();
|
||||
handleShowCallOption();
|
||||
}, []);
|
||||
|
||||
return { showInitCallActionSheet, showCallOption };
|
||||
|
|
|
@ -41,7 +41,8 @@ import {
|
|||
getUidDirectMessage,
|
||||
hasPermission,
|
||||
isGroupChat,
|
||||
compareServerVersion
|
||||
compareServerVersion,
|
||||
isTeamRoom
|
||||
} from '../../lib/methods/helpers';
|
||||
import { Services } from '../../lib/services';
|
||||
import { getSubscriptionByRoomId } from '../../lib/database/services/Subscription';
|
||||
|
@ -1033,7 +1034,8 @@ class RoomActionsView extends React.Component<IRoomActionsViewProps, IRoomAction
|
|||
|
||||
render() {
|
||||
const { room, membersCount, canViewMembers, joined, canAutoTranslate } = this.state;
|
||||
const { rid, t, prid } = room;
|
||||
const { isMasterDetail, navigation } = this.props;
|
||||
const { rid, t, prid, teamId } = room;
|
||||
const isGroupChatHandler = isGroupChat(room);
|
||||
|
||||
return (
|
||||
|
@ -1081,7 +1083,32 @@ class RoomActionsView extends React.Component<IRoomActionsViewProps, IRoomAction
|
|||
<List.Separator />
|
||||
</>
|
||||
) : null}
|
||||
|
||||
{teamId && isTeamRoom({ teamId, joined }) ? (
|
||||
<>
|
||||
<List.Item
|
||||
title='Teams'
|
||||
onPress={() => {
|
||||
logEvent(events.ROOM_GO_TEAM_CHANNELS);
|
||||
if (isMasterDetail) {
|
||||
// @ts-ignore TODO: find a way to make this work - OLD Diego :)
|
||||
navigation.navigate('ModalStackNavigator', {
|
||||
screen: 'TeamChannelsView',
|
||||
params: { teamId, joined }
|
||||
});
|
||||
} else {
|
||||
navigation.navigate('TeamChannelsView', {
|
||||
teamId,
|
||||
joined
|
||||
});
|
||||
}
|
||||
}}
|
||||
testID='room-actions-teams'
|
||||
left={() => <List.Icon name='channel-public' />}
|
||||
showActionIndicator
|
||||
/>
|
||||
<List.Separator />
|
||||
</>
|
||||
) : null}
|
||||
{['l'].includes(t) && !this.isOmnichannelPreview && this.omnichannelPermissions?.canViewCannedResponse ? (
|
||||
<>
|
||||
<List.Item
|
||||
|
|
|
@ -153,23 +153,6 @@ class RightButtonsContainer extends Component<IRightButtonsProps, IRigthButtonsS
|
|||
});
|
||||
};
|
||||
|
||||
goTeamChannels = () => {
|
||||
logEvent(events.ROOM_GO_TEAM_CHANNELS);
|
||||
const { navigation, isMasterDetail, teamId, joined } = this.props;
|
||||
if (!teamId) {
|
||||
return;
|
||||
}
|
||||
if (isMasterDetail) {
|
||||
// @ts-ignore TODO: find a way to make this work
|
||||
navigation.navigate('ModalStackNavigator', {
|
||||
screen: 'TeamChannelsView',
|
||||
params: { teamId, joined }
|
||||
});
|
||||
} else {
|
||||
navigation.navigate('TeamChannelsView', { teamId, joined });
|
||||
}
|
||||
};
|
||||
|
||||
goThreadsView = () => {
|
||||
logEvent(events.ROOM_GO_THREADS);
|
||||
const { rid, t, navigation, isMasterDetail } = this.props;
|
||||
|
|
|
@ -16,7 +16,7 @@ import {
|
|||
import { createRandomUser, ITestUser } from '../../helpers/data_setup';
|
||||
import random from '../../helpers/random';
|
||||
|
||||
describe.skip('Broadcast room', () => {
|
||||
describe('Broadcast room', () => {
|
||||
let textMatcher: TTextMatcher;
|
||||
let user: ITestUser;
|
||||
let otherUser: ITestUser;
|
||||
|
|
|
@ -485,7 +485,7 @@ describe('Room screen', () => {
|
|||
await tapBack();
|
||||
});
|
||||
|
||||
it.skip('should reply in DM to another user', async () => {
|
||||
it('should reply in DM to another user', async () => {
|
||||
const replyUser = await createRandomUser();
|
||||
const { name: replyRoom } = await createRandomRoom(replyUser, 'c');
|
||||
const originalMessage = 'Message to reply in DM';
|
||||
|
|
|
@ -26,7 +26,7 @@ async function openActionSheet(username: string) {
|
|||
async function navigateToRoomActions() {
|
||||
await waitFor(element(by.id('room-view')))
|
||||
.toExist()
|
||||
.withTimeout(2000);
|
||||
.withTimeout(5000);
|
||||
await element(by.id('room-header')).atIndex(0).tap();
|
||||
await waitFor(element(by.id('room-actions-view')))
|
||||
.toExist()
|
||||
|
@ -92,14 +92,14 @@ describe('Team', () => {
|
|||
await navigateToRoom(team);
|
||||
});
|
||||
|
||||
describe.skip('Team Room', () => {
|
||||
describe('Team Room', () => {
|
||||
describe('Team Header', () => {
|
||||
it('should have actions button ', async () => {
|
||||
await expect(element(by.id('room-header'))).toExist();
|
||||
});
|
||||
|
||||
it('should have team channels button ', async () => {
|
||||
await expect(element(by.id('room-view-header-team-channels'))).toExist();
|
||||
it('should have call button ', async () => {
|
||||
await expect(element(by.id('room-view-header-call'))).toExist();
|
||||
});
|
||||
|
||||
it('should have threads button ', async () => {
|
||||
|
@ -111,9 +111,10 @@ describe('Team', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('Team Header Usage', () => {
|
||||
describe('Team Action Usage', () => {
|
||||
it('should navigate to team channels view', async () => {
|
||||
await element(by.id('room-view-header-team-channels')).tap();
|
||||
await element(by.id('room-header')).tap();
|
||||
await element(by.id('room-actions-teams')).tap();
|
||||
await waitFor(element(by.id('team-channels-view')))
|
||||
.toExist()
|
||||
.withTimeout(5000);
|
||||
|
@ -183,8 +184,9 @@ describe('Team', () => {
|
|||
.toExist()
|
||||
.withTimeout(20000);
|
||||
await expect(element(by.id('room-view'))).toExist();
|
||||
await expect(element(by.id('room-view-header-team-channels'))).toExist();
|
||||
await element(by.id('room-view-header-team-channels')).tap();
|
||||
await element(by.id('room-header')).tap();
|
||||
await expect(element(by.id('room-actions-teams'))).toExist();
|
||||
await element(by.id('room-actions-teams')).tap();
|
||||
|
||||
await waitFor(element(by.id('team-channels-view')))
|
||||
.toExist()
|
||||
|
@ -198,7 +200,7 @@ describe('Team', () => {
|
|||
.toExist()
|
||||
.withTimeout(60000);
|
||||
await expect(element(by.id(`room-view-title-${room}`))).toExist();
|
||||
await expect(element(by.id('room-view-header-team-channels')).atIndex(0)).toExist();
|
||||
await expect(element(by.id('room-view-header-call')).atIndex(0)).toExist();
|
||||
await expect(element(by.id('room-view-header-threads')).atIndex(0)).toExist();
|
||||
await expect(element(by.id('room-view-search')).atIndex(0)).toExist();
|
||||
await tapBack();
|
||||
|
@ -206,10 +208,9 @@ describe('Team', () => {
|
|||
|
||||
it('should add existing channel to team', async () => {
|
||||
await navigateToRoom(team);
|
||||
await waitFor(element(by.id('room-view-header-team-channels')))
|
||||
.toExist()
|
||||
.withTimeout(5000);
|
||||
await element(by.id('room-view-header-team-channels')).tap();
|
||||
await element(by.id('room-header')).tap();
|
||||
await expect(element(by.id('room-actions-teams'))).toExist();
|
||||
await element(by.id('room-actions-teams')).tap();
|
||||
await waitFor(element(by.id('team-channels-view')))
|
||||
.toExist()
|
||||
.withTimeout(5000);
|
||||
|
@ -229,11 +230,9 @@ describe('Team', () => {
|
|||
.withTimeout(6000);
|
||||
await element(by.id('add-existing-channel-view-submit')).tap();
|
||||
await checkRoomTitle(team);
|
||||
await waitFor(element(by.id('room-view-header-team-channels')))
|
||||
.toBeVisible()
|
||||
.withTimeout(2000);
|
||||
await element(by.id('room-view-header-team-channels')).tap();
|
||||
|
||||
await element(by.id('room-header')).tap();
|
||||
await expect(element(by.id('room-actions-teams'))).toExist();
|
||||
await element(by.id('room-actions-teams')).tap();
|
||||
await waitFor(element(by.id(`rooms-list-view-item-${existingRoom}`)).atIndex(0))
|
||||
.toExist()
|
||||
.withTimeout(10000);
|
||||
|
@ -276,6 +275,7 @@ describe('Team', () => {
|
|||
await waitFor(element(by.id(`rooms-list-view-item-${existingRoom}`)).atIndex(0))
|
||||
.toExist()
|
||||
.withTimeout(6000);
|
||||
await tapBack();
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -383,10 +383,6 @@ describe('Team', () => {
|
|||
describe('Room Members', () => {
|
||||
beforeAll(async () => {
|
||||
await tapAndWaitFor(element(by.id('room-actions-members')), element(by.id('room-members-view')), 2000);
|
||||
// await element(by.id('room-actions-members')).tap();
|
||||
// await waitFor(element(by.id('room-members-view')))
|
||||
// .toBeVisible()
|
||||
// .withTimeout(2000);
|
||||
});
|
||||
|
||||
it('should show all users', async () => {
|
||||
|
|
|
@ -55,7 +55,7 @@ async function navigateToRoomActions(room: string) {
|
|||
.withTimeout(5000);
|
||||
}
|
||||
|
||||
describe.skip('Move/Convert Team', () => {
|
||||
describe('Move/Convert Team', () => {
|
||||
let alertButtonType: string;
|
||||
let textMatcher: TTextMatcher;
|
||||
let user: ITestUser;
|
||||
|
@ -124,16 +124,19 @@ describe.skip('Move/Convert Team', () => {
|
|||
await waitFor(
|
||||
element(
|
||||
by[textMatcher](
|
||||
'After reading the previous intructions about this behavior, do you still want to move this channel to the selected team?'
|
||||
'After reading the previous instructions about this behavior, do you still want to move this channel to the selected team?'
|
||||
)
|
||||
)
|
||||
)
|
||||
.toBeVisible()
|
||||
.withTimeout(2000);
|
||||
await element(by[textMatcher]('Yes, move it!').and(by.type(alertButtonType))).tap();
|
||||
await waitFor(element(by.id('room-view-header-team-channels')))
|
||||
.toBeVisible()
|
||||
.withTimeout(10000);
|
||||
await sleep(300); // wait for animation
|
||||
await element(by.id('room-header')).tap();
|
||||
await waitFor(element(by.id(`room-actions-teams`)))
|
||||
.toExist()
|
||||
.withTimeout(6000);
|
||||
await tapBack();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
|
|
Loading…
Reference in New Issue