Skip to content
Merged
Show file tree
Hide file tree
Changes from 71 commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
a0eecdc
Add Discussions to RoomActionsView
gerzonc Jul 16, 2021
659f2c8
Add Discussions to ThreadMessagesView
gerzonc Jul 19, 2021
c066c20
Update DiscussionMessagesView and add to stacks
gerzonc Jul 20, 2021
daba3b4
Fix DiscussionMessagesView
gerzonc Jul 21, 2021
da3bdd4
Fix search
gerzonc Jul 21, 2021
9ad45f0
Add E2E test
gerzonc Jul 21, 2021
fc59b74
Remove old changes from ThreadMessagesView
gerzonc Jul 21, 2021
b4c55b3
Merge develop
gerzonc Jul 21, 2021
82b306b
Minor tweak
gerzonc Jul 22, 2021
7feb509
Add discussions for channels
gerzonc Aug 23, 2021
e6e6c9e
Merge branch 'develop' into new.add-discusions-roomactionsview
gerzonc Aug 23, 2021
618eb53
Merge branch 'develop' into new.add-discusions-roomactionsview
gerzonc Aug 23, 2021
2d89d07
Minor tweak
gerzonc Sep 1, 2021
cc404b1
Merge branch 'develop' into new.add-discusions-roomactionsview
gerzonc Sep 1, 2021
330ab40
Fix navToRoomInfo
gerzonc Sep 2, 2021
2b1f78f
Fix search
gerzonc Sep 3, 2021
7429e4b
Add getDiscussions endpoint
gerzonc Sep 3, 2021
ad612e6
Merge branch 'develop' into new.add-discusions-roomactionsview
gerzonc Sep 3, 2021
91dedfb
Convert SearchHeader to reusable component and minor tweaks to Discus…
gerzonc Sep 8, 2021
f4c86ec
Merge develop into branch
gerzonc Sep 14, 2021
cc2a34c
Merge branch 'develop' into new.add-discusions-roomactionsview
gerzonc Sep 14, 2021
565f5d7
Merge branch 'develop' into new.add-discusions-roomactionsview
gerzonc Sep 15, 2021
f88a6fa
Fix lint
gerzonc Sep 15, 2021
191e71c
Merge branch 'develop' into new.add-discusions-roomactionsview
diegolmello Sep 15, 2021
8ccce58
Minor tweaks
gerzonc Sep 16, 2021
ecee12c
Migrate to TypeScript, update interfaces and some changes to containe…
gerzonc Sep 17, 2021
55b89e6
Merge branch 'develop' into new.add-discusions-roomactionsview
gerzonc Sep 17, 2021
6128bc4
Migrate SearchHeader to TS
gerzonc Sep 17, 2021
88dbf34
Update e2e tests
gerzonc Sep 17, 2021
9473bf4
Minor tweaks
gerzonc Sep 17, 2021
c641bf5
Fix threads
gerzonc Sep 17, 2021
cc07128
Remove unused params
gerzonc Sep 17, 2021
ec665e0
Simplify logic
gerzonc Sep 17, 2021
5379109
Rollback interfaces changes
gerzonc Sep 17, 2021
df480fb
Update property type rule
gerzonc Sep 17, 2021
d1d35c7
Minor tweak
gerzonc Sep 17, 2021
f9dc2a9
Merge branch 'develop' into new.add-discusions-roomactionsview
gerzonc Oct 4, 2021
eedfd42
Minor tweak
gerzonc Oct 4, 2021
b48a189
Update Storyshots.test.js.snap
gerzonc Oct 4, 2021
89a2381
test commit
gerzonc Oct 4, 2021
a226cad
Undo changes, add timeFormat prop
gerzonc Oct 5, 2021
da7f954
Merge branch 'develop' into new.add-discusions-roomactionsview
gerzonc Oct 5, 2021
1d40c3b
Update snapshots
gerzonc Oct 6, 2021
dcb79b1
Merge branch 'develop' into new.add-discusions-roomactionsview
gerzonc Oct 6, 2021
714608c
Merge branch 'develop' into new.add-discusions-roomactionsview
gerzonc Oct 13, 2021
0242fb1
Fix en.json
gerzonc Oct 13, 2021
086d13b
Remove no-non-null-assertion
gerzonc Oct 13, 2021
35d869d
Update types and onCancelSearchPress
gerzonc Oct 13, 2021
8e064a5
Fix lint
gerzonc Oct 13, 2021
5dc0a0a
Merge branch 'develop' into new.add-discusions-roomactionsview
gerzonc Oct 20, 2021
f911100
Fix lint
gerzonc Oct 20, 2021
47f7ee8
Merge branch 'develop' into new.add-discusions-roomactionsview
gerzonc Oct 27, 2021
ffb17d6
Minor tweaks
gerzonc Oct 29, 2021
a1c8ce0
Minor tweak
gerzonc Oct 29, 2021
767637b
Merge branch 'develop' into new.add-discusions-roomactionsview
AlexAlexandre Nov 1, 2021
0a3bdb6
Update index.tsx
gerzonc Nov 4, 2021
bd534f5
Minor tweak
gerzonc Nov 4, 2021
184799e
Update 04-discussion.spec.js
gerzonc Nov 8, 2021
c858218
Minor tweak
gerzonc Nov 8, 2021
2b7f589
Merge branch 'develop' into new.add-discusions-roomactionsview
gerzonc Nov 23, 2021
dc70bf6
Add DiscussionDetails and Item for DiscussionsView; update ThreadDeta…
gerzonc Jan 14, 2022
e010d80
Merge branch 'develop' into new.add-discusions-roomactionsview
gerzonc Jan 17, 2022
18da04b
update definitions
gerzonc Jan 17, 2022
eb1712e
minor tweak
gerzonc Jan 17, 2022
89ae430
add storybooks, update snapshots and DiscussionsView
gerzonc Jan 17, 2022
680476a
Merge branch 'develop' into new.add-discusions-roomactionsview
gerzonc Jan 17, 2022
6c9a3f9
Minor tweaks
gerzonc Jan 17, 2022
23244e3
Fix lint
gerzonc Jan 17, 2022
79eeb55
Remove unused import
gerzonc Jan 17, 2022
6be5b7e
Merge branch 'develop' into new.add-discusions-roomactionsview
diegolmello Jan 20, 2022
ea9a2da
Merge branch 'develop' into new.add-discusions-roomactionsview
diegolmello Jan 21, 2022
0a6e5d3
Move onDiscussionpress logic on message, update SearchHeader and Disc…
gerzonc Jan 24, 2022
ce8a208
Update interfaces and minor tweaks to DiscussionsView screen and comp…
gerzonc Jan 24, 2022
bce775d
Fix navigation logic and update interfaces
gerzonc Jan 24, 2022
5d84468
Minor tweaks
gerzonc Jan 24, 2022
4995df2
Undo change on project.pbxproj
gerzonc Jan 24, 2022
67e034c
Update project.pbxproj
gerzonc Jan 24, 2022
42946c1
Update project.pbxproj
gerzonc Jan 24, 2022
4f9460b
Remove style.ts
gerzonc Jan 24, 2022
e0d7cbb
Minor tweak
gerzonc Jan 24, 2022
a1a2e5c
update snapshots
gerzonc Jan 24, 2022
5a320a8
Merge branch 'develop' into new.add-discusions-roomactionsview
gerzonc Jan 28, 2022
a093af3
test
gerzonc Jan 31, 2022
350a20d
remove console.log
gerzonc Jan 31, 2022
89613bb
Merge branch 'develop' into new.add-discusions-roomactionsview
gerzonc Jan 31, 2022
67541ba
Add missing DiscussionsView snapshot
gerzonc Jan 31, 2022
c0e7f43
fix build and useless done and async generator
dnlsilva Feb 1, 2022
93edb9b
update snapshot
dnlsilva Feb 1, 2022
04f3c7e
Merge branch 'fix-ci-limiter-and-test' into new.add-discusions-roomac…
gerzonc Feb 1, 2022
7278241
Merge branch 'develop' into new.add-discusions-roomactionsview
gerzonc Feb 1, 2022
9caff40
Merge branch 'develop' into new.add-discusions-roomactionsview
gerzonc Feb 1, 2022
1b6f574
Merge branch 'new.add-discusions-roomactionsview' of https://github.c…
gerzonc Feb 1, 2022
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,432 changes: 2,432 additions & 0 deletions __tests__/__snapshots__/Storyshots.test.js.snap

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/containers/BackgroundContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const styles = StyleSheet.create({
const BackgroundContainer = ({ theme, text, loading }: IBackgroundContainer) => (
<View style={styles.container}>
<ImageBackground source={{ uri: `message_empty_${theme}` }} style={styles.image} />
{text ? <Text style={[styles.text, { color: themes[theme!].auxiliaryTintColor }]}>{text}</Text> : null}
{text && !loading ? <Text style={[styles.text, { color: themes[theme!].auxiliaryTintColor }]}>{text}</Text> : null}
{loading ? <ActivityIndicator style={styles.text} color={themes[theme!].auxiliaryTintColor} /> : null}
</View>
);
Expand Down
22 changes: 11 additions & 11 deletions app/containers/SearchHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { StyleSheet, View } from 'react-native';

import { withTheme } from '../theme';
import { useTheme } from '../theme';
import sharedStyles from '../views/Styles';
import { themes } from '../constants/colors';
import TextInput from '../presentation/TextInput';
Expand All @@ -19,14 +19,14 @@ const styles = StyleSheet.create({
}
});

interface ISearchHeader {
theme?: string;
interface ISearchHeaderProps {
onSearchChangeText?: (text: string) => void;
placeholder: string;
testID: string;
}

// TODO: it might be useful to refactor this component for reusage
const SearchHeader = ({ theme, onSearchChangeText }: ISearchHeader) => {
const titleColorStyle = { color: themes[theme!].headerTitleColor };
const SearchHeader = ({ onSearchChangeText, placeholder, testID }: ISearchHeaderProps) => {
const { theme } = useTheme();
const isLight = theme === 'light';
const { isLandscape } = useOrientation();
const scale = isIOS && isLandscape && !isTablet ? 0.8 : 1;
Expand All @@ -36,14 +36,14 @@ const SearchHeader = ({ theme, onSearchChangeText }: ISearchHeader) => {
<View style={styles.container}>
<TextInput
autoFocus
style={[styles.title, isLight && titleColorStyle, { fontSize: titleFontSize }]}
placeholder='Search'
style={[styles.title, isLight && { color: themes[theme].headerTitleColor }, { fontSize: titleFontSize }]}
placeholder={placeholder}
onChangeText={onSearchChangeText}
theme={theme!}
testID='thread-messages-view-search-header'
theme={theme}
testID={testID}
/>
</View>
);
};

export default withTheme(SearchHeader);
export default SearchHeader;
9 changes: 4 additions & 5 deletions app/containers/ThreadDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Touchable from 'react-native-platform-touchable';
import { CustomIcon } from '../lib/Icons';
import { themes } from '../constants/colors';
import sharedStyles from '../views/Styles';
import { withTheme } from '../theme';
import { useTheme } from '../theme';
import { TThreadModel } from '../definitions/IThread';

const styles = StyleSheet.create({
Expand Down Expand Up @@ -48,10 +48,10 @@ interface IThreadDetails {
badgeColor?: string;
toggleFollowThread: Function;
style: ViewStyle;
theme?: string;
}

const ThreadDetails = ({ item, user, badgeColor, toggleFollowThread, style, theme }: IThreadDetails) => {
const ThreadDetails = ({ item, user, badgeColor, toggleFollowThread, style }: IThreadDetails): JSX.Element => {
const { theme } = useTheme();
let { tcount } = item;
if (tcount! >= 1000) {
tcount = '+999';
Expand Down Expand Up @@ -81,7 +81,6 @@ const ThreadDetails = ({ item, user, badgeColor, toggleFollowThread, style, them
</Text>
</View>
</View>

<View style={styles.badgeContainer}>
{badgeColor ? <View style={[styles.badge, { backgroundColor: badgeColor }]} /> : null}
<Touchable onPress={() => toggleFollowThread?.(isFollowing, item.id)}>
Expand All @@ -96,4 +95,4 @@ const ThreadDetails = ({ item, user, badgeColor, toggleFollowThread, style, them
);
};

export default withTheme(ThreadDetails);
export default ThreadDetails;
4 changes: 2 additions & 2 deletions app/containers/message/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ const MessageTouchable = React.memo((props: IMessageTouchable & IMessage) => {
</View>
);
}
const { onPress, onLongPress } = useContext(MessageContext);
const { onPress, onLongPress, onDiscussionPress } = useContext(MessageContext);
return (
<Touchable
onLongPress={onLongPress}
onPress={onPress}
onPress={() => (props.type === 'discussion-created' ? onDiscussionPress() : onPress())}
Comment thread
gerzonc marked this conversation as resolved.
Outdated
disabled={(props.isInfo && !props.isThreadReply) || props.archived || props.isTemp}
style={{ backgroundColor: props.highlighted ? themes[props.theme].headerBackground : null }}>
<View>
Expand Down
1 change: 0 additions & 1 deletion app/containers/message/Thread.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const Thread = React.memo(
item={{
tcount,
replies,
tlm,
id
}}
user={user}
Expand Down
2 changes: 1 addition & 1 deletion app/containers/message/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export interface IMessageInner
IMessageThread,
IMessageAttachments,
IMessageBroadcast {
type: string;
type: 'discussion-created' | 'jitsi_call_started' | 'c' | 'd' | 'p' | 'l';
Comment thread
gerzonc marked this conversation as resolved.
Outdated
blocks: [];
}

Expand Down
4 changes: 2 additions & 2 deletions app/definitions/IThread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ export interface IThread {
reactions?: IReaction[];
role?: string;
drid?: string;
dcount?: number;
dcount?: number | string;
dlm?: number;
tmid?: string;
tcount: number | string;
tcount?: number | string;
tlm?: string;
replies?: string[];
mentions?: IUserMention[];
Expand Down
1 change: 1 addition & 0 deletions app/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,7 @@
"creating_discussion": "creating discussion",
"Canned_Responses": "Canned Responses",
"No_match_found": "No match found.",
"No_discussions": "No discussions",
"Check_canned_responses": "Check on canned responses.",
"Searching": "Searching",
"Use": "Use",
Expand Down
10 changes: 10 additions & 0 deletions app/lib/rocketchat.js
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,16 @@ const RocketChat = {
encrypted
});
},
getDiscussions({ roomId, offset, count, text }) {
const params = {
roomId,
offset,
count,
...(text && { text })
};
// RC 2.4.0
return this.sdk.get('chat.getDiscussions', params);
},
createTeam({ name, users, type, readOnly, broadcast, encrypted }) {
const params = {
name,
Expand Down
4 changes: 3 additions & 1 deletion app/stacks/InsideStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ import QueueListView from '../ee/omnichannel/views/QueueListView';
import AddChannelTeamView from '../views/AddChannelTeamView';
import AddExistingChannelView from '../views/AddExistingChannelView';
import SelectListView from '../views/SelectListView';
import DiscussionsView from '../views/DiscussionsView';
import {
AdminPanelStackParamList,
ChatsStackParamList,
Expand All @@ -92,7 +93,8 @@ const ChatsStackNavigator = () => {
<ChatsStack.Screen name='SelectListView' component={SelectListView} options={SelectListView.navigationOptions} />
<ChatsStack.Screen name='RoomInfoView' component={RoomInfoView} options={RoomInfoView.navigationOptions} />
<ChatsStack.Screen name='RoomInfoEditView' component={RoomInfoEditView} options={RoomInfoEditView.navigationOptions} />
<ChatsStack.Screen name='RoomMembersView' component={RoomMembersView} />
<ChatsStack.Screen name='RoomMembersView' component={RoomMembersView} options={RoomMembersView.navigationOptions} />
<ChatsStack.Screen name='DiscussionsView' component={DiscussionsView} />
<ChatsStack.Screen
name='SearchMessagesView'
component={SearchMessagesView}
Expand Down
2 changes: 2 additions & 0 deletions app/stacks/MasterDetailStack/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import QueueListView from '../../ee/omnichannel/views/QueueListView';
import AddChannelTeamView from '../../views/AddChannelTeamView';
import AddExistingChannelView from '../../views/AddExistingChannelView';
import SelectListView from '../../views/SelectListView';
import DiscussionsView from '../../views/DiscussionsView';
import { ModalContainer } from './ModalContainer';
import {
MasterDetailChatsStackParamList,
Expand Down Expand Up @@ -167,6 +168,7 @@ const ModalStackNavigator = React.memo(({ navigation }: INavigation) => {
<ModalStack.Screen name='LivechatEditView' component={LivechatEditView} options={LivechatEditView.navigationOptions} />
<ModalStack.Screen name='PickerView' component={PickerView} options={PickerView.navigationOptions} />
<ModalStack.Screen name='ThreadMessagesView' component={ThreadMessagesView} />
<ModalStack.Screen name='DiscussionsView' component={DiscussionsView} />
<ModalStack.Screen name='TeamChannelsView' component={TeamChannelsView} options={TeamChannelsView.navigationOptions} />
<ModalStack.Screen name='MarkdownTableView' component={MarkdownTableView} options={MarkdownTableView.navigationOptions} />
<ModalStack.Screen
Expand Down
3 changes: 3 additions & 0 deletions app/stacks/MasterDetailStack/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ export type ModalStackParamList = {
rid: string;
room: ISubscription;
};
DiscussionsView: {
rid: string;
};
SearchMessagesView: {
rid: string;
t: SubscriptionType;
Expand Down
3 changes: 3 additions & 0 deletions app/stacks/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ export type ChatsStackParamList = {
rid: string;
room: ISubscription;
};
DiscussionsView: {
rid: string;
};
SearchMessagesView: {
rid: string;
t: SubscriptionType;
Expand Down
4 changes: 2 additions & 2 deletions app/views/ChangePasscodeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ const ChangePasscodeView = React.memo(() => {

return (
<Modal useNativeDriver isVisible={visible} hideModalContentWhileAnimating style={styles.modal}>
<PasscodeChoose theme={theme} finishProcess={onSubmit} force={data?.force} />
<PasscodeChoose theme={theme!} finishProcess={onSubmit} force={data?.force} />
{!data?.force ? (
<Touchable onPress={onCancel} style={styles.close}>
<CustomIcon name='close' color={themes[theme].passcodePrimary} size={30} />
<CustomIcon name='close' color={themes[theme!].passcodePrimary} size={30} />
</Touchable>
) : null}
</Modal>
Expand Down
70 changes: 70 additions & 0 deletions app/views/DiscussionsView/DiscussionDetails.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import React from 'react';
import { StyleSheet, Text, View, ViewStyle } from 'react-native';

import { TThreadModel } from '../../definitions/IThread';
import { CustomIcon } from '../../lib/Icons';
import { themes } from '../../constants/colors';
import sharedStyles from '../Styles';
import { useTheme } from '../../theme';

const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'row',
alignItems: 'center'
},
detailsContainer: {
flex: 1,
flexDirection: 'row'
},
detailContainer: {
flexDirection: 'row',
alignItems: 'center',
marginRight: 8
},
detailText: {
fontSize: 10,
marginLeft: 2,
...sharedStyles.textSemibold
}
});

interface IDiscussionDetails {
item: TThreadModel;
user: {
id: string;
};
time: string;
style: ViewStyle;
}

const DiscussionDetails = ({ item, time, style }: IDiscussionDetails) => {
Comment thread
gerzonc marked this conversation as resolved.
Outdated
const { theme } = useTheme();
let { dcount } = item;

if (dcount! >= 1000) {
dcount = '+999';
}

return (
<View style={[styles.container, style]}>
<View style={styles.detailsContainer}>
<View style={styles.detailContainer}>
<CustomIcon name={'discussions'} size={24} color={themes[theme!].auxiliaryText} />
<Text style={[styles.detailText, { color: themes[theme!].auxiliaryText }]} numberOfLines={1}>
{dcount}
</Text>
</View>

<View style={styles.detailContainer}>
<CustomIcon name={'clock'} size={24} color={themes[theme!].auxiliaryText} />
<Text style={[styles.detailText, { color: themes[theme!].auxiliaryText }]} numberOfLines={1}>
{time}
</Text>
</View>
</View>
</View>
);
};

export default DiscussionDetails;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should evaluate this later with UX team if we can reuse it on Message component, like we do with Threads.

96 changes: 96 additions & 0 deletions app/views/DiscussionsView/Item.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions, react/prop-types */
import React from 'react';
import { storiesOf } from '@storybook/react-native';
import { ScrollView } from 'react-native';
import { Provider } from 'react-redux';

import * as List from '../../containers/List';
import { themes } from '../../constants/colors';
import { ThemeContext } from '../../theme';
import { store } from '../../../storybook/stories';
import Item from './Item';

const author = {
_id: 'userid',
username: 'rocket.cat',
name: 'Rocket Cat'
};
const baseUrl = 'https://open.rocket.chat';
const date = new Date(2020, 10, 10, 10);
const longText =
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
const defaultItem = {
msg: 'Message content',
tcount: 1,
replies: [1],
ts: date,
tlm: date,
u: author,
attachments: []
};

const BaseItem = ({ item, ...props }) => (
<Item
baseUrl={baseUrl}
item={{
...defaultItem,
...item
}}
onPress={() => alert('pressed')}
{...props}
/>
);

const listDecorator = story => (
<ScrollView>
<List.Separator />
{story()}
<List.Separator />
</ScrollView>
);

const stories = storiesOf('Discussions.Item', module)
.addDecorator(listDecorator)
.addDecorator(story => <Provider store={store}>{story()}</Provider>);

stories.add('content', () => (
<>
<BaseItem />
<List.Separator />
<BaseItem
item={{
msg: longText
}}
/>
<List.Separator />
<BaseItem
item={{
dcount: 1000,
replies: [...new Array(1000)]
}}
/>
<List.Separator />
<BaseItem
item={{
msg: '',
attachments: [{ title: 'Attachment title' }]
}}
/>
<List.Separator />
<BaseItem useRealName />
</>
));

const ThemeStory = ({ theme }) => (
<ThemeContext.Provider value={{ theme }}>
<BaseItem badgeColor={themes[theme].mentionMeColor} />
</ThemeContext.Provider>
);

stories.add('themes', () => (
<>
<ThemeStory theme='light' />
<ThemeStory theme='dark' />
<ThemeStory theme='black' />
</>
));
Loading