Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
0ff3842
Adding joinCode parameter
DanMke Sep 30, 2020
9b12537
Insert join code input
vitorl-s Oct 3, 2020
bcbc444
Add joinCode field on db
vitorl-s Oct 3, 2020
c60f7a1
Add label i18 pt-br and en-us
vitorl-s Oct 3, 2020
e7d452f
Add insert join code text
vitorl-s Oct 6, 2020
ebe257a
Fix atribute name
vitorl-s Oct 6, 2020
40ca5ea
Add join text
vitorl-s Oct 6, 2020
9788da3
Fix attributes joinCode, joinCodeRequired and pass attribute param in…
DanMke Oct 7, 2020
f943f5d
Merge branch 'develop' into fix.password-protected-channel
DanMke Oct 7, 2020
a9e200a
Fixing attribute joinCodeRequired pass to goRoom
DanMke Oct 7, 2020
68aa406
Changed textinput style
DanMke Oct 7, 2020
13e3035
Delete not necessary attribute
DanMke Oct 7, 2020
e224dcb
Fixing input style
DanMke Oct 8, 2020
7ed8f59
Undo unncessary changes
djorkaeffalexandre Oct 13, 2020
39c2716
use a join code modal
djorkaeffalexandre Oct 13, 2020
096ce7f
Merge branch 'develop' into fix.password-protected-channel
djorkaeffalexandre Oct 13, 2020
e1ec916
Merge remote-tracking branch 'upstream/develop' into fix.password-pro…
youssef-md Nov 3, 2020
4d9a5cf
Merge develop
djorkaeffalexandre Nov 30, 2020
3c16be7
tests: e2e tests to join protected channel
djorkaeffalexandre Nov 30, 2020
1ed0c6b
fix: undo unnecessary change
djorkaeffalexandre Nov 30, 2020
510f1f0
tests: cancel join code
djorkaeffalexandre Nov 30, 2020
48b64c8
Merge branch 'develop' into fix.password-protected-channel
diegolmello Dec 1, 2020
6e8e065
Remove some tests
diegolmello Dec 1, 2020
c9a3a0b
Minor fixes
diegolmello Dec 1, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/i18n/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ export default {
Invite_Link: 'Invite Link',
Invite_users: 'Invite users',
Join: 'Join',
Join_Code: 'Join Code',
Insert_Join_Code: 'Insert Join code',
Join_our_open_workspace: 'Join our open workspace',
Join_your_workspace: 'Join your workspace',
Just_invited_people_can_access_this_channel: 'Just invited people can access this channel',
Expand Down
2 changes: 2 additions & 0 deletions app/i18n/locales/pt-BR.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ export default {
Invite_Link: 'Link de Convite',
Invite_users: 'Convidar usuários',
Join: 'Entrar',
Join_Code: 'Insira o Código da sala',
Insert_Join_Code: 'Insira o código para entrar na sala',
Join_our_open_workspace: 'Entra na nossa workspace pública',
Join_your_workspace: 'Entre na sua workspace',
Just_invited_people_can_access_this_channel: 'Apenas as pessoas convidadas podem acessar este canal',
Expand Down
4 changes: 2 additions & 2 deletions app/lib/database/model/Subscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ export default class Subscription extends Model {

@field('archived') archived;

@field('join_code_required') joinCodeRequired;

@field('notifications') notifications;

@json('muted', sanitizer) muted;
Expand Down Expand Up @@ -110,6 +108,8 @@ export default class Subscription extends Model {

@json('tags', sanitizer) tags;

@field('join_code_required') joinCodeRequired;

Comment thread
DanMke marked this conversation as resolved.
Outdated
@field('e2e_key') E2EKey;

@field('encrypted') encrypted;
Expand Down
1 change: 1 addition & 0 deletions app/lib/database/model/migrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export default schemaMigrations({
addColumns({
table: 'subscriptions',
columns: [
{ name: 'join_code_required', type: 'boolean' },
Comment thread
DanMke marked this conversation as resolved.
Outdated
{ name: 'e2e_key', type: 'string', isOptional: true },
{ name: 'encrypted', type: 'boolean', isOptional: true },
{ name: 'e2e_key_id', type: 'string', isOptional: true }
Expand Down
2 changes: 1 addition & 1 deletion app/lib/database/schema/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export default appSchema({
{ name: 'blocker', type: 'boolean', isOptional: true },
{ name: 'react_when_read_only', type: 'boolean', isOptional: true },
{ name: 'archived', type: 'boolean' },
{ name: 'join_code_required', type: 'boolean', isOptional: true },
{ name: 'muted', type: 'string', isOptional: true },
{ name: 'broadcast', type: 'boolean', isOptional: true },
{ name: 'prid', type: 'string', isOptional: true },
Expand All @@ -50,6 +49,7 @@ export default appSchema({
{ name: 'served_by', type: 'string', isOptional: true },
{ name: 'livechat_data', type: 'string', isOptional: true },
{ name: 'tags', type: 'string', isOptional: true },
{ name: 'join_code_required', type: 'boolean' },
Comment thread
DanMke marked this conversation as resolved.
Outdated
{ name: 'e2e_key', type: 'string', isOptional: true },
{ name: 'encrypted', type: 'boolean', isOptional: true },
{ name: 'e2e_key_id', type: 'string', isOptional: true }
Expand Down
4 changes: 2 additions & 2 deletions app/lib/methods/helpers/findSubscriptionsRooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export default async(subscriptions = [], rooms = []) => {
blocker: s.blocker,
reactWhenReadOnly: s.reactWhenReadOnly,
archived: s.archived,
joinCodeRequired: s.joinCodeRequired,
muted: s.muted,
broadcast: s.broadcast,
prid: s.prid,
Expand All @@ -50,6 +49,7 @@ export default async(subscriptions = [], rooms = []) => {
servedBy: s.servedBy,
livechatData: s.livechatData,
tags: s.tags,
joinCodeRequired: s.joinCodeRequired,
Comment thread
DanMke marked this conversation as resolved.
Outdated
encrypted: s.encrypted,
e2eKeyId: s.e2eKeyId,
E2EKey: s.E2EKey
Expand All @@ -66,7 +66,6 @@ export default async(subscriptions = [], rooms = []) => {
announcement: r.announcement,
reactWhenReadOnly: r.reactWhenReadOnly,
archived: r.archived,
joinCodeRequired: r.joinCodeRequired,
jitsiTimeout: r.jitsiTimeout,
usernames: r.usernames,
uids: r.uids,
Expand All @@ -79,6 +78,7 @@ export default async(subscriptions = [], rooms = []) => {
servedBy: r.servedBy,
livechatData: r.livechatData,
tags: r.tags,
joinCodeRequired: r.joinCodeRequired,
Comment thread
DanMke marked this conversation as resolved.
Outdated
encrypted: r.encrypted,
e2eKeyId: r.e2eKeyId
}));
Expand Down
1 change: 1 addition & 0 deletions app/lib/methods/helpers/mergeSubscriptionsRooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const merge = (subscription, room) => {
subscription.uids = room.uids;
}
subscription.ro = room.ro;
subscription.joinCodeRequired = room.joinCodeRequired;
subscription.broadcast = room.broadcast;
subscription.encrypted = room.encrypted;
subscription.e2eKeyId = room.e2eKeyId;
Expand Down
6 changes: 3 additions & 3 deletions app/lib/methods/subscriptions/rooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const createOrUpdateSubscription = async(subscription, room) => {
const db = database.active;
const subCollection = db.collections.get('subscriptions');
const roomsCollection = db.collections.get('rooms');

if (!subscription) {
try {
const s = await subCollection.find(room._id);
Expand Down Expand Up @@ -64,7 +63,6 @@ const createOrUpdateSubscription = async(subscription, room) => {
blocker: s.blocker,
reactWhenReadOnly: s.reactWhenReadOnly,
archived: s.archived,
joinCodeRequired: s.joinCodeRequired,
muted: s.muted,
broadcast: s.broadcast,
prid: s.prid,
Expand All @@ -82,6 +80,7 @@ const createOrUpdateSubscription = async(subscription, room) => {
servedBy: s.servedBy,
livechatData: s.livechatData,
tags: s.tags,
joinCodeRequired: s.joinCodeRequired,
Comment thread
DanMke marked this conversation as resolved.
Outdated
encrypted: s.encrypted,
e2eKeyId: s.e2eKeyId,
E2EKey: s.E2EKey
Expand Down Expand Up @@ -116,7 +115,8 @@ const createOrUpdateSubscription = async(subscription, room) => {
broadcast: r.broadcast,
customFields: r.customFields,
departmentId: r.departmentId,
livechatData: r.livechatData
livechatData: r.livechatData,
joinCodeRequired: r.joinCodeRequired
};
} catch (error) {
// Do nothing
Expand Down
4 changes: 2 additions & 2 deletions app/lib/rocketchat.js
Original file line number Diff line number Diff line change
Expand Up @@ -616,13 +616,13 @@ const RocketChat = {
});
},

joinRoom(roomId, type) {
joinRoom(roomId, joinCode, type) {
// TODO: join code
// RC 0.48.0
if (type === 'p') {
return this.methodCallWrapper('joinRoom', roomId);
}
return this.post('channels.join', { roomId });
return this.post('channels.join', { roomId, joinCode });
},
triggerBlockAction,
triggerSubmitView,
Expand Down
3 changes: 2 additions & 1 deletion app/views/DirectoryView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@ class DirectoryView extends React.Component {
this.goRoom({ rid: result.room._id, name: item.username, t: 'd' });
}
} else {
const { room } = await RocketChat.getRoomInfo(item._id);
this.goRoom({
rid: item._id, name: item.name, t: 'c', search: true
rid: item._id, name: item.name, joinCodeRequired: room.joinCodeRequired, t: 'c', search: true
});
}
}
Expand Down
27 changes: 23 additions & 4 deletions app/views/RoomView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import Navigation from '../../lib/Navigation';
import SafeAreaView from '../../containers/SafeAreaView';
import { withDimensions } from '../../dimensions';
import { getHeaderTitlePosition } from '../../containers/Header';
import TextInput from '../../containers/TextInput';
import { E2E_MESSAGE_TYPE, E2E_STATUS } from '../../lib/encryption/constants';

import { takeInquiry } from '../../ee/omnichannel/lib';
Expand All @@ -73,7 +74,7 @@ const stateAttrsUpdate = [
'readOnly',
'member'
];
const roomAttrsUpdate = ['f', 'ro', 'blocked', 'blocker', 'archived', 'muted', 'jitsiTimeout', 'announcement', 'sysMes', 'topic', 'name', 'fname', 'roles', 'bannerClosed', 'visitor'];
const roomAttrsUpdate = ['f', 'ro', 'blocked', 'blocker', 'archived', 'muted', 'jitsiTimeout', 'announcement', 'sysMes', 'topic', 'name', 'fname', 'roles', 'bannerClosed', 'visitor', 'joinCodeRequired'];

class RoomView extends React.Component {
static propTypes = {
Expand Down Expand Up @@ -115,6 +116,7 @@ class RoomView extends React.Component {
const search = props.route.params?.search;
const prid = props.route.params?.prid;
this.state = {
joinCode: '',
joined: true,
room: room || {
rid: this.rid, t: this.t, name, fname, prid
Expand Down Expand Up @@ -706,12 +708,12 @@ class RoomView extends React.Component {
joinRoom = async() => {
logEvent(events.ROOM_JOIN);
try {
const { room } = this.state;
const { room, joinCode } = this.state;

if (this.isOmnichannel) {
await takeInquiry(room._id);
} else {
await RocketChat.joinRoom(this.rid, this.t);
await RocketChat.joinRoom(this.rid, joinCode, this.t);
}
this.internalSetState({
joined: true
Expand Down Expand Up @@ -919,14 +921,31 @@ class RoomView extends React.Component {
joined, room, selectedMessage, editing, replying, replyWithMention, readOnly
} = this.state;
const { navigation, theme } = this.props;
const { joinCodeRequired } = room;

if (!this.rid) {
return null;
}
if (!joined && !this.tmid) {
return (
<View style={styles.joinRoomContainer} key='room-view-join' testID='room-view-join'>
<Text accessibilityLabel={I18n.t('You_are_in_preview_mode')} style={[styles.previewMode, { color: themes[theme].titleText }]}>{I18n.t('You_are_in_preview_mode')}</Text>
{
joinCodeRequired
? (
<>
<Text accessibilityLabel={I18n.t('Insert_Join_Code')} style={[styles.previewMode, { color: themes[theme].titleText }]}>{I18n.t('Insert_Join_Code')}</Text>
Comment thread
DanMke marked this conversation as resolved.
Outdated
<TextInput
returnKeyType='default'
placeholder={I18n.t('Join_Code')}
onChangeText={(value) => { this.setState({ joinCode: value }); }}
underlineColorAndroid='transparent'
containerStyle={styles.joinCodeInput}
Comment thread
DanMke marked this conversation as resolved.
Outdated
theme={theme}
/>
</>
Comment thread
DanMke marked this conversation as resolved.
Outdated
)
: <Text accessibilityLabel={I18n.t('You_are_in_preview_mode')} style={[styles.previewMode, { color: themes[theme].titleText }]}>{I18n.t('You_are_in_preview_mode')}</Text>
}
<Touch
onPress={this.joinRoom}
style={[styles.joinRoomButton, { backgroundColor: themes[theme].actionTintColor }]}
Expand Down
3 changes: 3 additions & 0 deletions app/views/RoomView/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,8 @@ export default StyleSheet.create({
previewMode: {
fontSize: 16,
...sharedStyles.textMedium
},
joinCodeInput: {
padding: 8
}
});