Merge branch 'develop' into feat.jitsi-ios-webview
This commit is contained in:
commit
b29a18e854
|
@ -18,7 +18,7 @@ exports[`Storyshots Avatar Custom Style 1`] = `"{\\"type\\":\\"View\\",\\"props\
|
|||
|
||||
exports[`Storyshots Avatar Direct 1`] = `"{\\"type\\":\\"View\\",\\"props\\":{\\"style\\":[{\\"width\\":56,\\"height\\":56,\\"borderRadius\\":4},null],\\"testID\\":\\"avatar\\"},\\"children\\":[{\\"type\\":\\"View\\",\\"props\\":{\\"style\\":[{\\"overflow\\":\\"hidden\\"},{\\"width\\":56,\\"height\\":56,\\"borderRadius\\":4}]},\\"children\\":[{\\"type\\":\\"FastImageView\\",\\"props\\":{\\"style\\":{\\"position\\":\\"absolute\\",\\"left\\":0,\\"right\\":0,\\"top\\":0,\\"bottom\\":0},\\"source\\":{\\"uri\\":\\"https://open.rocket.chat/avatar/diego.mello?format=png&size=112\\",\\"headers\\":{\\"User-Agent\\":\\"RC Mobile; ios unknown; vunknown (unknown)\\"},\\"priority\\":\\"high\\"},\\"resizeMode\\":\\"cover\\"},\\"children\\":null}]}]}"`;
|
||||
|
||||
exports[`Storyshots Avatar Emoji 1`] = `"{\\"type\\":\\"View\\",\\"props\\":{\\"style\\":[{\\"width\\":56,\\"height\\":56,\\"borderRadius\\":4},null],\\"testID\\":\\"avatar\\"},\\"children\\":[{\\"type\\":\\"View\\",\\"props\\":{\\"style\\":[{\\"overflow\\":\\"hidden\\"},[{\\"width\\":30,\\"height\\":30},{\\"width\\":56,\\"height\\":56,\\"borderRadius\\":4}]]},\\"children\\":[{\\"type\\":\\"FastImageView\\",\\"props\\":{\\"style\\":{\\"position\\":\\"absolute\\",\\"left\\":0,\\"right\\":0,\\"top\\":0,\\"bottom\\":0},\\"source\\":{\\"uri\\":\\"https://open.rocket.chat/emoji-custom/troll.jpg\\",\\"priority\\":\\"high\\"},\\"resizeMode\\":\\"contain\\"},\\"children\\":null}]}]}"`;
|
||||
exports[`Storyshots Avatar Emoji 1`] = `"{\\"type\\":\\"View\\",\\"props\\":{\\"style\\":[{\\"width\\":56,\\"height\\":56,\\"borderRadius\\":4},null],\\"testID\\":\\"avatar\\"},\\"children\\":[{\\"type\\":\\"View\\",\\"props\\":{\\"style\\":[{\\"overflow\\":\\"hidden\\"},[{\\"width\\":30,\\"height\\":30}]]},\\"children\\":[{\\"type\\":\\"FastImageView\\",\\"props\\":{\\"style\\":{\\"position\\":\\"absolute\\",\\"left\\":0,\\"right\\":0,\\"top\\":0,\\"bottom\\":0},\\"source\\":{\\"uri\\":\\"https://open.rocket.chat/emoji-custom/troll.jpg\\",\\"priority\\":\\"high\\"},\\"resizeMode\\":\\"contain\\"},\\"children\\":null}]}]}"`;
|
||||
|
||||
exports[`Storyshots Avatar Static 1`] = `"{\\"type\\":\\"View\\",\\"props\\":{\\"style\\":[{\\"width\\":56,\\"height\\":56,\\"borderRadius\\":4},null],\\"testID\\":\\"avatar\\"},\\"children\\":[{\\"type\\":\\"View\\",\\"props\\":{\\"style\\":[{\\"overflow\\":\\"hidden\\"},{\\"width\\":56,\\"height\\":56,\\"borderRadius\\":4}]},\\"children\\":[{\\"type\\":\\"FastImageView\\",\\"props\\":{\\"style\\":{\\"position\\":\\"absolute\\",\\"left\\":0,\\"right\\":0,\\"top\\":0,\\"bottom\\":0},\\"source\\":{\\"uri\\":\\"https://user-images.githubusercontent.com/29778115/89444446-14738480-d728-11ea-9412-75fd978d95fb.jpg\\",\\"headers\\":{\\"User-Agent\\":\\"RC Mobile; ios unknown; vunknown (unknown)\\"},\\"priority\\":\\"high\\"},\\"resizeMode\\":\\"cover\\"},\\"children\\":null}]}]}"`;
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -21,7 +21,7 @@ const Emoji = React.memo(({ literal, isMessageContainsOnlyEmoji, getCustomEmoji,
|
|||
const emojiUnicode = shortnameToUnicode(literal);
|
||||
const emoji: any = getCustomEmoji && getCustomEmoji(literal.replace(/:/g, ''));
|
||||
if (emoji && customEmojis) {
|
||||
return <CustomEmoji style={[isMessageContainsOnlyEmoji ? styles.customEmojiBig : styles.customEmoji, style]} emoji={emoji} />;
|
||||
return <CustomEmoji style={[isMessageContainsOnlyEmoji ? styles.customEmojiBig : styles.customEmoji]} emoji={emoji} />;
|
||||
}
|
||||
return (
|
||||
<Text style={[{ color: colors.bodyText }, isMessageContainsOnlyEmoji ? styles.textBig : styles.text, style]}>
|
||||
|
|
|
@ -3,6 +3,7 @@ import { StyleSheet, Text, View } from 'react-native';
|
|||
|
||||
import { TSupportedThemes } from '../../theme';
|
||||
import { themes } from '../../lib/constants';
|
||||
import styles from './styles';
|
||||
|
||||
const style = StyleSheet.create({
|
||||
container: {
|
||||
|
@ -43,7 +44,7 @@ const ListItem = React.memo(({ children, level, bulletWidth, continue: _continue
|
|||
return (
|
||||
<View style={style.container}>
|
||||
<View style={[{ width: bulletWidth }, style.bullet]}>
|
||||
<Text style={{ color: themes[theme].bodyText }}>{bullet}</Text>
|
||||
<Text style={[styles.text, styles.listPrefix, { color: themes[theme].bodyText }]}>{bullet}</Text>
|
||||
</View>
|
||||
<View style={style.contents}>{children}</View>
|
||||
</View>
|
||||
|
|
|
@ -16,8 +16,8 @@ const OrderedList = ({ value }: IOrderedListProps): React.ReactElement => {
|
|||
<View>
|
||||
{value.map(item => (
|
||||
<View style={styles.row} key={item.number?.toString()}>
|
||||
<Text style={[styles.text, { color: colors.bodyText }]}>{item.number}. </Text>
|
||||
<Text style={[styles.inline, { color: colors.bodyText }]}>
|
||||
<Text style={[styles.text, styles.listPrefix, { color: colors.bodyText }]}>{item.number}. </Text>
|
||||
<Text style={[styles.text, styles.inline, { color: colors.bodyText }]}>
|
||||
<Inline value={item.value} />
|
||||
</Text>
|
||||
</View>
|
||||
|
|
|
@ -17,8 +17,8 @@ const UnorderedList = ({ value }: IUnorderedListProps) => {
|
|||
<View>
|
||||
{value.map(item => (
|
||||
<View style={styles.row}>
|
||||
<Text style={[styles.text, { color: themes[theme].bodyText }]}>- </Text>
|
||||
<Text style={[styles.inline, { color: themes[theme].bodyText }]}>
|
||||
<Text style={[styles.text, styles.listPrefix, { color: themes[theme].bodyText }]}>- </Text>
|
||||
<Text style={[styles.text, styles.inline, { color: themes[theme].bodyText }]}>
|
||||
<Inline value={item.value} />
|
||||
</Text>
|
||||
</View>
|
||||
|
|
|
@ -162,5 +162,8 @@ export default StyleSheet.create({
|
|||
},
|
||||
inline: {
|
||||
flexShrink: 1
|
||||
},
|
||||
listPrefix: {
|
||||
fontVariant: ['tabular-nums']
|
||||
}
|
||||
});
|
||||
|
|
|
@ -508,6 +508,24 @@ export const MessageWithReply = () => (
|
|||
}
|
||||
]}
|
||||
/>
|
||||
<Message
|
||||
msg='Yes, I am'
|
||||
attachments={[
|
||||
{
|
||||
author_name: 'rocket.cat',
|
||||
attachments: [
|
||||
{
|
||||
author_name: 'rocket.cat',
|
||||
ts: date,
|
||||
timeFormat: 'LT',
|
||||
description: 'Are you seeing this mario :marioparty: ?',
|
||||
image_url: 'https://octodex.github.com/images/yaktocat.png'
|
||||
}
|
||||
],
|
||||
text: ''
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
|
|
|
@ -102,6 +102,7 @@ export interface ISubscription {
|
|||
onHold?: boolean;
|
||||
source?: IOmnichannelSource;
|
||||
hideMentionStatus?: boolean;
|
||||
usersCount?: number;
|
||||
// https://nozbe.github.io/WatermelonDB/Relation.html#relation-api
|
||||
messages: RelationModified<TMessageModel>;
|
||||
threads: RelationModified<TThreadModel>;
|
||||
|
|
|
@ -137,5 +137,7 @@ export default class Subscription extends Model {
|
|||
|
||||
@field('on_hold') onHold;
|
||||
|
||||
@field('users_count') usersCount;
|
||||
|
||||
@json('source', sanitizer) source;
|
||||
}
|
||||
|
|
|
@ -257,6 +257,15 @@ export default schemaMigrations({
|
|||
columns: [{ name: 'e2e_suggested_key', type: 'string', isOptional: true }]
|
||||
})
|
||||
]
|
||||
},
|
||||
{
|
||||
toVersion: 21,
|
||||
steps: [
|
||||
addColumns({
|
||||
table: 'subscriptions',
|
||||
columns: [{ name: 'users_count', type: 'string', isOptional: true }]
|
||||
})
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { appSchema, tableSchema } from '@nozbe/watermelondb';
|
||||
|
||||
export default appSchema({
|
||||
version: 20,
|
||||
version: 21,
|
||||
tables: [
|
||||
tableSchema({
|
||||
name: 'subscriptions',
|
||||
|
@ -63,7 +63,8 @@ export default appSchema({
|
|||
{ name: 'team_main', type: 'boolean', isOptional: true }, // Use `Q.notEq(true)` to get false or null
|
||||
{ name: 'on_hold', type: 'boolean', isOptional: true },
|
||||
{ name: 'source', type: 'string', isOptional: true },
|
||||
{ name: 'hide_mention_status', type: 'boolean', isOptional: true }
|
||||
{ name: 'hide_mention_status', type: 'boolean', isOptional: true },
|
||||
{ name: 'users_count', type: 'number', isOptional: true }
|
||||
]
|
||||
}),
|
||||
tableSchema({
|
||||
|
|
|
@ -85,6 +85,9 @@ export const merge = (
|
|||
if (room && 'source' in room) {
|
||||
mergedSubscription.source = room?.source;
|
||||
}
|
||||
if (room && 'usersCount' in room) {
|
||||
mergedSubscription.usersCount = room.usersCount;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mergedSubscription.name) {
|
||||
|
|
|
@ -86,7 +86,7 @@ interface IRoomActionsViewProps extends IActionSheetProvider, IBaseScreen<ChatsS
|
|||
|
||||
interface IRoomActionsViewState {
|
||||
room: TSubscriptionModel;
|
||||
membersCount: number;
|
||||
membersCount?: number;
|
||||
member: Partial<IUser>;
|
||||
joined: boolean;
|
||||
canViewMembers: boolean;
|
||||
|
@ -153,10 +153,12 @@ class RoomActionsView extends React.Component<IRoomActionsViewProps, IRoomAction
|
|||
this.roomObservable = room.observe();
|
||||
this.subscription = this.roomObservable.subscribe(changes => {
|
||||
if (this.mounted) {
|
||||
this.setState({ room: changes });
|
||||
this.setState({ room: changes, membersCount: changes.usersCount });
|
||||
} else {
|
||||
// @ts-ignore
|
||||
this.state.room = changes;
|
||||
// @ts-ignore
|
||||
this.state.membersCount = changes.usersCount;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -191,7 +193,8 @@ class RoomActionsView extends React.Component<IRoomActionsViewProps, IRoomAction
|
|||
try {
|
||||
const counters = await Services.getRoomCounters(room.rid, room.t as any);
|
||||
if (counters.success) {
|
||||
this.setState({ membersCount: counters.members, joined: counters.joined });
|
||||
await this.updateUsersCount(counters.members);
|
||||
this.setState({ joined: counters.joined });
|
||||
}
|
||||
} catch (e) {
|
||||
log(e);
|
||||
|
@ -231,6 +234,23 @@ class RoomActionsView extends React.Component<IRoomActionsViewProps, IRoomAction
|
|||
return room.t === 'l' && room.status === 'queued' && !this.joined;
|
||||
}
|
||||
|
||||
updateUsersCount = async (members: number) => {
|
||||
const { room } = this.state;
|
||||
if (members === room.usersCount) return;
|
||||
try {
|
||||
const db = database.active;
|
||||
await db.write(async () => {
|
||||
await room.update(
|
||||
protectedFunction((r: TSubscriptionModel) => {
|
||||
r.usersCount = members;
|
||||
})
|
||||
);
|
||||
});
|
||||
} catch {
|
||||
//
|
||||
}
|
||||
};
|
||||
|
||||
onPressTouchable: IOnPressTouch = (item: {
|
||||
route?: keyof ChatsStackParamList;
|
||||
params?: ChatsStackParamList[keyof ChatsStackParamList];
|
||||
|
@ -1052,7 +1072,7 @@ class RoomActionsView extends React.Component<IRoomActionsViewProps, IRoomAction
|
|||
<>
|
||||
<List.Item
|
||||
title='Members'
|
||||
subtitle={membersCount > 0 ? `${membersCount} ${I18n.t('members')}` : undefined}
|
||||
subtitle={membersCount && membersCount > 0 ? `${membersCount} ${I18n.t('members')}` : undefined}
|
||||
onPress={() => this.onPressTouchable({ route: 'RoomMembersView', params: { rid, room, joined: this.joined } })}
|
||||
testID='room-actions-members'
|
||||
left={() => <List.Icon name='team' />}
|
||||
|
|
|
@ -103,6 +103,7 @@ describe('Room actions screen', () => {
|
|||
|
||||
it('should have members', async () => {
|
||||
await expect(element(by.id('room-actions-members'))).toExist();
|
||||
await expect(element(by[textMatcher]('1 members'))).toExist();
|
||||
});
|
||||
|
||||
it('should have files', async () => {
|
||||
|
@ -338,6 +339,9 @@ describe('Room actions screen', () => {
|
|||
await element(by.id('selected-users-view-submit')).tap();
|
||||
await sleep(300);
|
||||
await backToActions();
|
||||
await waitFor(element(by[textMatcher]('3 members')))
|
||||
.toExist()
|
||||
.withTimeout(5000);
|
||||
});
|
||||
|
||||
describe('Room Members', () => {
|
||||
|
|
Loading…
Reference in New Issue