Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] App not prompting join code for password protected channels #2514

Merged
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions app/i18n/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ export default {
Invite_Link: 'Invite Link',
Invite_users: 'Invite users',
Join: 'Join',
Join_Code: '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
1 change: 1 addition & 0 deletions app/i18n/locales/pt-BR.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ export default {
Invite_Link: 'Link de Convite',
Invite_users: 'Convidar usuários',
Join: 'Entrar',
Join_Code: 'Insira o Código da 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
2 changes: 2 additions & 0 deletions app/lib/database/model/Subscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,6 @@ export default class Subscription extends Model {
@json('livechat_data', sanitizer) livechatData;

@json('tags', sanitizer) tags;

@field('join_code') joinCode;
DanMke marked this conversation as resolved.
Show resolved Hide resolved
}
11 changes: 11 additions & 0 deletions app/lib/database/model/migrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,17 @@ export default schemaMigrations({
]
})
]
},
{
toVersion: 10,
steps: [
addColumns({
table: 'subscriptions',
columns: [
{ name: 'join_code', type: 'string', isOptional: false }
DanMke marked this conversation as resolved.
Show resolved Hide resolved
]
})
]
}
]
});
5 changes: 3 additions & 2 deletions app/lib/database/schema/app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { appSchema, tableSchema } from '@nozbe/watermelondb';

export default appSchema({
version: 9,
version: 10,
tables: [
tableSchema({
name: 'subscriptions',
Expand Down Expand Up @@ -49,7 +49,8 @@ export default appSchema({
{ name: 'department_id', type: 'string', isOptional: true },
{ name: 'served_by', type: 'string', isOptional: true },
{ name: 'livechat_data', type: 'string', isOptional: true },
{ name: 'tags', type: 'string', isOptional: true }
{ name: 'tags', type: 'string', isOptional: true },
{ name: 'join_code', type: 'string', isOptional: false }
DanMke marked this conversation as resolved.
Show resolved Hide resolved
]
}),
tableSchema({
Expand Down
3 changes: 2 additions & 1 deletion app/lib/methods/helpers/findSubscriptionsRooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ export default async(subscriptions = [], rooms = []) => {
departmentId: s.departmentId,
servedBy: s.servedBy,
livechatData: s.livechatData,
tags: s.tags
tags: s.tags,
joinCode: s.joinCode
DanMke marked this conversation as resolved.
Show resolved Hide resolved
}));
subscriptions = subscriptions.concat(existingSubs);

Expand Down
5 changes: 3 additions & 2 deletions app/lib/methods/subscriptions/rooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const createOrUpdateSubscription = async(subscription, room) => {
const db = database.active;
const subCollection = db.collections.get('subscriptions');
const roomsCollection = db.collections.get('rooms');

subscription.joinCodeRequired = room.joinCodeRequired;
DanMke marked this conversation as resolved.
Show resolved Hide resolved
if (!subscription) {
try {
const s = await subCollection.find(room._id);
Expand Down Expand Up @@ -79,7 +79,8 @@ const createOrUpdateSubscription = async(subscription, room) => {
departmentId: s.departmentId,
servedBy: s.servedBy,
livechatData: s.livechatData,
tags: s.tags
tags: s.tags,
joinCode: s.joinCode
DanMke marked this conversation as resolved.
Show resolved Hide resolved
DanMke marked this conversation as resolved.
Show resolved Hide resolved
DanMke marked this conversation as resolved.
Show resolved Hide resolved
};
} catch (error) {
try {
Expand Down
4 changes: 2 additions & 2 deletions app/lib/rocketchat.js
Original file line number Diff line number Diff line change
Expand Up @@ -597,13 +597,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
15 changes: 12 additions & 3 deletions app/views/RoomView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import Navigation from '../../lib/Navigation';
import SafeAreaView from '../../containers/SafeAreaView';
import { withDimensions } from '../../dimensions';
import { getHeaderTitlePosition } from '../../containers/Header';

import TextInput from '../../presentation/TextInput';
DanMke marked this conversation as resolved.
Show resolved Hide resolved
import { takeInquiry } from '../../ee/omnichannel/lib';

const stateAttrsUpdate = [
Expand Down Expand Up @@ -113,6 +113,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 @@ -688,12 +689,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 @@ -907,6 +908,14 @@ class RoomView extends React.Component {
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>
<TextInput
returnKeyType='default'
placeholder={I18n.t('Join_Code')}
onChangeText={(value) => { this.setState({ joinCode: value }); }}
underlineColorAndroid='transparent'
style={[styles.joinInput, { borderColor: theme === 'light' ? 'black' : 'white' }]}
theme={theme}
/>
<Touch
onPress={this.joinRoom}
style={[styles.joinRoomButton, { backgroundColor: themes[theme].actionTintColor }]}
Expand Down
6 changes: 6 additions & 0 deletions app/views/RoomView/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,11 @@ export default StyleSheet.create({
previewMode: {
fontSize: 16,
...sharedStyles.textMedium
},
joinInput: {
marginTop: 10,
DanMke marked this conversation as resolved.
Show resolved Hide resolved
borderWidth: 2,
width: '90%',
textAlign: 'center'
}
});