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

[NEW] Convert/Move Channel to Team #3164

Merged
merged 110 commits into from
Jun 2, 2021
Merged
Changes from 10 commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
2f5f247
Added Create Team
gerzonc Apr 19, 2021
c8a88c9
Merge branch 'develop' into new.create-team
gerzonc Apr 19, 2021
585a9ae
Merge branch 'develop' into new.create-team
gerzonc Apr 19, 2021
8b82bd4
Added actionTypes, actions, ENG strings for Teams and updated NewMess…
gerzonc Apr 20, 2021
c8b8680
Added createTeam sagas, createTeam reducer, new Team string and updat…
gerzonc Apr 20, 2021
a245af6
Remove unnecessary actionTypes, reducers and sagas, e2e tests and nav…
gerzonc Apr 23, 2021
16fd575
Minor tweaks
gerzonc Apr 26, 2021
1ff7711
Show TeamChannelsView only if joined the team
gerzonc Apr 26, 2021
69214be
Minor tweak
gerzonc Apr 26, 2021
0cf173d
Added AddChannelTeamView
gerzonc Apr 26, 2021
27ced96
Merge branch 'develop' into new.create-team
gerzonc Apr 28, 2021
37421d3
Merge branch 'develop' into new.add-remove-channel-teams
gerzonc Apr 29, 2021
bb0632b
Added permissions, translations strings for teams, deleteTeamRoom an…
gerzonc Apr 30, 2021
c3ffa37
Refactor touch component and update removeRoom and deleteRoom methods
gerzonc May 4, 2021
69ae247
Minor tweaks
gerzonc May 5, 2021
4761e21
Minor tweaks for removing channels and addExistingChannelView
gerzonc May 5, 2021
7d2924e
Added missing events and fixed channels list
gerzonc May 5, 2021
4bac054
Minor tweaks for refactored touch component
gerzonc May 5, 2021
4b6e691
Added SelectListView and logic for leaving team
gerzonc May 6, 2021
b961fa0
Added addTeamMember and removeTeamMember
gerzonc May 6, 2021
04ea01b
Minor tweak
gerzonc May 6, 2021
9cf3e68
Merge branch 'new.delete-team' into new.add-remove-users-teams
gerzonc May 6, 2021
a305676
Added deleteTeam function
gerzonc May 7, 2021
7ecc76f
Minor tweak
gerzonc May 7, 2021
7e6a277
Minor tweaks
gerzonc May 11, 2021
cb44fdf
Merge branch 'develop' into new.add-remove-channel-teams
gerzonc May 11, 2021
c890ed3
Merge branch 'new.create-team' into new.add-remove-channel-teams
gerzonc May 11, 2021
feb7862
Merge branch 'new.add-remove-channel-teams' of https://github.com/Roc…
gerzonc May 11, 2021
be3517f
Remove unnecesary changes, update TeamChannelsView, AddExistingChanne…
gerzonc May 11, 2021
850e443
Merge branch 'new.add-remove-channel-teams' into new.delete-team
gerzonc May 11, 2021
d0f9560
Remove unnecesary prop
gerzonc May 11, 2021
b3975a4
Merge branch 'new.delete-team' into new.add-remove-users-teams
gerzonc May 11, 2021
7fb1e50
Merge branch 'develop' into new.add-remove-channel-teams
gerzonc May 13, 2021
2d50417
Add screens to ModalStack, events, autoJoin, update createChannel, ad…
gerzonc May 13, 2021
79b1123
Minor tweak
gerzonc May 13, 2021
70e503a
Update loadMessagesForRoom.js
gerzonc May 13, 2021
66e9041
Merge branch 'develop' into new.delete-team
gerzonc May 13, 2021
9a45b9e
Merge branch 'new.add-remove-channel-teams' into new.delete-team
gerzonc May 13, 2021
f42988a
Updated schema, tag component, touch, AddChannelTeamView, AddExisting…
gerzonc May 14, 2021
9820e6e
Fix unnecessary changes
gerzonc May 14, 2021
682dd21
Add i18n, update createChannel, AddExistingChannelTeamView, AddChanne…
gerzonc May 14, 2021
d3fb789
Updated styles, added tag story
gerzonc May 14, 2021
79334af
Minor tweak
gerzonc May 17, 2021
09d6307
Minor tweaks
gerzonc May 17, 2021
4859014
Auto-join tweak
diegolmello May 17, 2021
2fa4ebe
Minor tweaks
gerzonc May 18, 2021
30caba1
Minor tweak on search
gerzonc May 18, 2021
96d6ef0
Merge branch 'new.add-remove-channel-teams' into new.delete-team
gerzonc May 18, 2021
2939775
Merge branch 'develop' into new.delete-team
gerzonc May 20, 2021
43c31b3
Minor refactor to ListItem, add SelectListView to ModalStack, update …
gerzonc May 21, 2021
38c2637
Minor tweaks
gerzonc May 21, 2021
2ef6c70
Update SelectListView
gerzonc May 21, 2021
28e46b7
Update handleLeaveTeam, remove unnecessary method, add story
gerzonc May 21, 2021
3d4370f
Minor tweak
gerzonc May 21, 2021
94a8764
Merge branch 'new.delete-team' into new.delete-teams
gerzonc May 24, 2021
003a272
Minor visual tweaks
diegolmello May 24, 2021
d1a4a05
Merge branch 'new.delete-team' into new.add-remove-users-teams
gerzonc May 24, 2021
4deffca
Update SelectListView.js
gerzonc May 24, 2021
517d15e
Update index.js
gerzonc May 24, 2021
29122cb
Update RoomMembersView
gerzonc May 24, 2021
3f8a647
Updated SelectListView, RoomActionsView, leaveTeam method and string …
gerzonc May 24, 2021
a70c699
Update SelectListVIew
gerzonc May 24, 2021
5fd6514
Minor tweak
gerzonc May 24, 2021
d5912d3
Update SelectListView
gerzonc May 24, 2021
ec5bdb1
Minor tweak
gerzonc May 24, 2021
501a878
Merge branch 'new.delete-team' into new.add-remove-users-teams
gerzonc May 24, 2021
919ef34
Minor tweaks
gerzonc May 24, 2021
cbea5fb
Fix for List.Item subtitles being pushed down by title's flex
diegolmello May 25, 2021
f0e573a
Minor tweaks
gerzonc May 25, 2021
03eb3d9
Update RoomActionsView
gerzonc May 25, 2021
2006146
Merge branch 'new.delete-team' into new.add-remove-users-teams
gerzonc May 25, 2021
1fc4122
Use showConfirmationAlert and showErrorAlert
diegolmello May 25, 2021
92ef166
Merge branch 'new.delete-team' of github.com:RocketChat/Rocket.Chat.R…
diegolmello May 25, 2021
53b6cf4
Merge branch 'new.delete-team' into new.add-remove-users-teams
gerzonc May 25, 2021
d478c51
Merge branch 'develop' into new.add-remove-users-teams
gerzonc May 25, 2021
f021aee
Remove addTeamMember, update removeTeamMember
gerzonc May 25, 2021
f138e10
Update Alert
gerzonc May 25, 2021
98d5f0e
Minor tweaks
gerzonc May 25, 2021
6399269
Minor tweaks
gerzonc May 25, 2021
3844471
Minor tweak
gerzonc May 25, 2021
6a16add
Update showActionSheet on RoomMembersView
gerzonc May 25, 2021
ec0df16
Merge branch 'new.delete-team' into new.delete-teams
gerzonc May 25, 2021
750e21a
Remove team main from query and move code around
diegolmello May 25, 2021
a08a24d
Fetch roles
gerzonc May 26, 2021
55aa294
Update RoomMembersView and SelectListView
gerzonc May 26, 2021
427831a
Merge branch 'develop' into new.add-remove-users-teams
gerzonc May 26, 2021
01a7222
Merge branch 'new.add-remove-users-teams' into new.delete-teams
gerzonc May 26, 2021
b1bde5e
Update rocketchat.js
gerzonc May 26, 2021
c9266f6
Updated leaveTeam and handleRemoveFromTeam
gerzonc May 26, 2021
0469772
Fix validation
gerzonc May 26, 2021
f1815ce
Remove unnecessary function
gerzonc May 26, 2021
ca6a2f8
Merge branch 'new.add-remove-users-teams' into new.delete-teams
gerzonc May 26, 2021
1765107
Merge branch 'develop' into new.delete-teams
gerzonc May 26, 2021
a70a747
Update RoomActionsView
gerzonc May 26, 2021
9c33263
Update en.json
gerzonc May 26, 2021
72e6162
Merge branch 'develop' into new.delete-teams
gerzonc May 27, 2021
a77906c
updated deleteTeam function and permissions
gerzonc May 27, 2021
139a31b
Added showConfirmationAlert
gerzonc May 27, 2021
cc6b13d
Added string translations for teams
gerzonc May 27, 2021
ad12ea0
Fix permission
gerzonc May 27, 2021
786583a
Added moveChannelToTeam and convertToTeam functionality
gerzonc May 27, 2021
70e62fc
Merge branch 'develop' into new.convert-move-channel-teams
gerzonc May 27, 2021
88ab8ad
Fix SelectListView RadioButton
gerzonc May 27, 2021
587d20e
Fix moveToTeam
gerzonc May 27, 2021
e0e14ef
Added searchBar to SelectListVIew
gerzonc May 27, 2021
0d942a2
Merge branch 'develop' into new.convert-move-channel-teams
gerzonc May 27, 2021
c67b5e8
Merge branch 'develop' into new.convert-move-channel-teams
gerzonc May 28, 2021
a85d69d
Merge branch 'develop' into new.convert-move-channel-teams
gerzonc May 28, 2021
eaced3c
Merge branch 'develop' into new.convert-move-channel-teams
diegolmello May 28, 2021
540a2b2
Update RoomView , SelectListVIew and string translation for error
gerzonc May 31, 2021
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
15,445 changes: 7,164 additions & 8,281 deletions __tests__/__snapshots__/Storyshots.test.js.snap

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion app/containers/List/ListItem.js
Original file line number Diff line number Diff line change
@@ -83,7 +83,8 @@ const Button = React.memo(({
}) => (
<Touch
onPress={() => onPress(props.title)}
style={({ pressed }) => [{ backgroundColor: pressed ? underlayColor || themes[props.theme].bannerBackground : backgroundColor || themes[props.theme].backgroundColor }]}
style={{ backgroundColor: backgroundColor || themes[props.theme].backgroundColor }}
underlayColor={underlayColor}
enabled={!props.disabled}
theme={props.theme}
>
5 changes: 3 additions & 2 deletions app/containers/LoginServices.js
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@ import { connect } from 'react-redux';
import { Base64 } from 'js-base64';
import * as AppleAuthentication from 'expo-apple-authentication';

import { transparentize } from 'color2k';
import { withTheme } from '../theme';
import sharedStyles from '../views/Styles';
import { themes } from '../constants/colors';
@@ -345,8 +344,10 @@ class LoginServices extends React.PureComponent {
<Touch
key={service.name}
onPress={onPress}
style={({ pressed }) => [styles.serviceButton, { backgroundColor: pressed ? transparentize(themes[theme].buttonText, 0.5) : backgroundColor }]}
style={[styles.serviceButton, { backgroundColor }]}
theme={theme}
activeOpacity={0.5}
underlayColor={themes[theme].buttonText}
>
<View style={styles.serviceButtonContainer}>
{service.authType === 'oauth' || service.authType === 'apple' ? <CustomIcon name={icon} size={24} color={themes[theme].titleText} style={styles.serviceIcon} /> : null}
2 changes: 1 addition & 1 deletion app/containers/Passcode/Base/Button.js
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ const Button = React.memo(({

return (
<Touch
style={({ pressed }) => [styles.buttonView, { backgroundColor: pressed ? 'transparent' : themes[theme].bannerBackground }]}
style={[styles.buttonView, { backgroundColor: 'transparent' }]}
underlayColor={themes[theme].passcodeButtonActive}
rippleColor={themes[theme].passcodeButtonActive}
enabled={!disabled}
10 changes: 4 additions & 6 deletions app/lib/methods/loadMessagesForRoom.js
Original file line number Diff line number Diff line change
@@ -5,16 +5,14 @@ async function load({
rid: roomId, latest, t, team
}) {
let params = { roomId: roomId || team.roomId, count: 50 };
let apiType;

if (latest) {
params = { ...params, latest: new Date(latest).toISOString() };
}

if (team.type) {
apiType = this.roomTypeToApiType('p');
} else {
apiType = this.roomTypeToApiType(t || 'c');
}
const teamType = team?.type ? 'p' : 'c';
const apiType = this.roomTypeToApiType(teamType || t);

if (!apiType) {
return [];
}
15 changes: 12 additions & 3 deletions app/lib/rocketchat.js
Original file line number Diff line number Diff line change
@@ -94,10 +94,19 @@ const RocketChat = {
},
canOpenRoom,
createChannel({
name, users, type, readOnly, broadcast, encrypted
name, users, type, readOnly, broadcast, encrypted, teamId
}) {
// RC 0.51.0
return this.methodCallWrapper(type ? 'createPrivateGroup' : 'createChannel', name, users, readOnly, {}, { broadcast, encrypted });
const params = {
name,
members: users,
readOnly,
extraData: {
broadcast,
encrypted,
...(teamId && { teamId })
}
};
return this.post(type ? 'groups.create' : 'channels.create', params);
},
async getWebsocketInfo({ server }) {
const sdk = new RocketchatClient({ host: server, protocol: 'ddp', useSsl: useSsl(server) });
3 changes: 3 additions & 0 deletions app/presentation/RoomItem/RoomItem.js
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ const RoomItem = ({
status,
useRealName,
theme,
isFocused,
isGroupChat,
isRead,
date,
@@ -60,6 +61,7 @@ const RoomItem = ({
testID={testID}
type={type}
theme={theme}
isFocused={isFocused}
swipeEnabled={swipeEnabled}
>
<Wrapper
@@ -161,6 +163,7 @@ RoomItem.propTypes = {
status: PropTypes.string,
useRealName: PropTypes.bool,
theme: PropTypes.string,
isFocused: PropTypes.bool,
isGroupChat: PropTypes.bool,
isRead: PropTypes.bool,
teamMain: PropTypes.bool,
99 changes: 56 additions & 43 deletions app/presentation/RoomItem/Touchable.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Animated } from 'react-native';
import { PanGestureHandler, State } from 'react-native-gesture-handler';
import { LongPressGestureHandler, PanGestureHandler, State } from 'react-native-gesture-handler';

import Touch from '../../utils/touch';
import {
@@ -28,6 +28,7 @@ class Touchable extends React.Component {
hideChannel: PropTypes.func,
children: PropTypes.element,
theme: PropTypes.string,
isFocused: PropTypes.bool,
swipeEnabled: PropTypes.bool
}

@@ -59,6 +60,12 @@ class Touchable extends React.Component {
}
}

onLongPressHandlerStateChange = ({ nativeEvent }) => {
if (nativeEvent.state === State.ACTIVE) {
this.onLongPress();
}
}


_handleRelease = (nativeEvent) => {
const { translationX } = nativeEvent;
@@ -209,59 +216,65 @@ class Touchable extends React.Component {
this.close();
return;
}
const { onLongPress } = this.props;
if (onLongPress) {
onLongPress();
const { onLongPress, onPress } = this.props;
if (!onLongPress) {
onPress();
}

onLongPress();
};

render() {
const {
testID, isRead, width, favorite, children, theme, swipeEnabled
testID, isRead, width, favorite, children, theme, isFocused, swipeEnabled
} = this.props;

return (

<PanGestureHandler
minDeltaX={20}
onGestureEvent={this._onGestureEvent}
onHandlerStateChange={this._onHandlerStateChange}
enabled={swipeEnabled}
>
<LongPressGestureHandler onHandlerStateChange={this.onLongPressHandlerStateChange}>
<Animated.View>
<LeftActions
transX={this.transXReverse}
isRead={isRead}
width={width}
onToggleReadPress={this.onToggleReadPress}
theme={theme}
/>
<RightActions
transX={this.transXReverse}
favorite={favorite}
width={width}
toggleFav={this.toggleFav}
onHidePress={this.onHidePress}
theme={theme}
/>
<Animated.View
style={{
transform: [{ translateX: this.transX }]
}}
<PanGestureHandler
minDeltaX={20}
onGestureEvent={this._onGestureEvent}
onHandlerStateChange={this._onHandlerStateChange}
enabled={swipeEnabled}
>
<Touch
onPress={this.onPress}
onLongPress={this.onLongPress}
theme={theme}
testID={testID}
style={({ pressed }) => [{ backgroundColor: pressed ? themes[theme].chatComponentBackground : themes[theme].backgroundColor }]}
>
{children}
</Touch>
</Animated.View>
</Animated.View>
<Animated.View>
<LeftActions
transX={this.transXReverse}
isRead={isRead}
width={width}
onToggleReadPress={this.onToggleReadPress}
theme={theme}
/>
<RightActions
transX={this.transXReverse}
favorite={favorite}
width={width}
toggleFav={this.toggleFav}
onHidePress={this.onHidePress}
theme={theme}
/>
<Animated.View
style={{
transform: [{ translateX: this.transX }]
}}
>
<Touch
onPress={this.onPress}
theme={theme}
testID={testID}
style={{
backgroundColor: isFocused ? themes[theme].chatComponentBackground : themes[theme].backgroundColor
}}
>
{children}
</Touch>
</Animated.View>
</Animated.View>

</PanGestureHandler>
</PanGestureHandler>
</Animated.View>
</LongPressGestureHandler>
);
}
}
4 changes: 4 additions & 0 deletions app/presentation/RoomItem/index.js
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ const attrs = [
'status',
'connected',
'theme',
'isFocused',
'forceUpdate',
'showLastMessage'
];
@@ -36,6 +37,7 @@ class RoomItemContainer extends React.Component {
getUserPresence: PropTypes.func,
connected: PropTypes.bool,
theme: PropTypes.string,
isFocused: PropTypes.bool,
getRoomTitle: PropTypes.func,
getRoomAvatar: PropTypes.func,
getIsGroupChat: PropTypes.func,
@@ -127,6 +129,7 @@ class RoomItemContainer extends React.Component {
toggleRead,
hideChannel,
theme,
isFocused,
avatarSize,
status,
showLastMessage,
@@ -176,6 +179,7 @@ class RoomItemContainer extends React.Component {
type={item.t}
theme={theme}
size={avatarSize}
isFocused={isFocused}
prid={item.prid}
status={status}
hideUnreadStatus={item.hideUnreadStatus}
11 changes: 3 additions & 8 deletions app/sagas/createChannel.js
Original file line number Diff line number Diff line change
@@ -71,14 +71,9 @@ const handleRequest = function* handleRequest({ data }) {
encrypted
});
sub = yield call(createChannel, data);

if (data.teamId) {
if (sub.teamId) {
logEvent(events.CT_ADD_ROOM_TO_TEAM);
const channels = yield call(addTeamRoom, { rooms: sub.rid, teamId: data.teamId });
if (channels.success) {
sub.teamId = channels.rooms[0].teamId;
sub.isTeamChannel = true;
}
yield call(addTeamRoom, { rooms: sub.rid, teamId: sub.teamId });
}
}
try {
@@ -106,7 +101,7 @@ const handleSuccess = function* handleSuccess({ data }) {
if (isMasterDetail) {
Navigation.navigate('DrawerNavigator');
}
goRoom({ item: data.team ? data.team : data, isMasterDetail });
goRoom({ item: data.success ? data.team : data, isMasterDetail });
};

const handleFailure = function handleFailure({ err }) {
41 changes: 11 additions & 30 deletions app/utils/goRoom.js
Original file line number Diff line number Diff line change
@@ -8,36 +8,17 @@ const navigate = ({ item, isMasterDetail, ...props }) => {
navigationMethod = Navigation.replace;
}

if (item.isTeamChannel) {
// TODO: Refactor
Navigation.navigate('TeamChannelsView');
Navigation.push('RoomView', {
rid: item.roomId || item.rid,
name: RocketChat.getRoomTitle(item),
t: item.type ? 'p' : item.t,
prid: item.prid,
room: item,
search: item.search,
visitor: item.visitor,
roomUserId: RocketChat.getUidDirectMessage(item),
teamId: item.teamId,
...props
});
} else if (item.rooms) {
Navigation.navigate('TeamChannelsView');
} else {
navigationMethod('RoomView', {
rid: item.roomId || item.rid,
name: RocketChat.getRoomTitle(item),
t: item.type ? 'p' : item.t,
prid: item.prid,
room: item,
search: item.search,
visitor: item.visitor,
roomUserId: RocketChat.getUidDirectMessage(item),
...props
});
}
navigationMethod('RoomView', {
rid: item.roomId || item.rid,
name: RocketChat.getRoomTitle(item),
t: item?.type ? 'p' : 'c' || item.t,
prid: item.prid,
room: item,
search: item.search,
visitor: item.visitor,
roomUserId: RocketChat.getUidDirectMessage(item),
...props
});
};

export const goRoom = async({ item = {}, isMasterDetail = false, ...props }) => {
16 changes: 7 additions & 9 deletions app/utils/touch.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { RectButton } from 'react-native-gesture-handler';

import { Pressable } from 'react-native';
import { themes } from '../constants/colors';

class Touch extends React.Component {
@@ -15,32 +15,30 @@ class Touch extends React.Component {

render() {
const {
children, onPress, onLongPress, theme, style, ...props
children, onPress, theme, underlayColor, ...props
} = this.props;

return (
<Pressable
<RectButton
ref={this.getRef}
onPress={onPress}
onLongPress={onLongPress}
activeOpacity={1}
style={style}
android_ripple={{ color: themes[theme].bannerBackground }}
underlayColor={underlayColor || themes[theme].bannerBackground}
rippleColor={themes[theme].bannerBackground}
{...props}
>
{children}
</Pressable>
</RectButton>
);
}
}

Touch.propTypes = {
children: PropTypes.node,
onPress: PropTypes.func,
onLongPress: PropTypes.func,
theme: PropTypes.string,
underlayColor: PropTypes.string,
style: PropTypes.object
underlayColor: PropTypes.string
};

export default Touch;
Loading