Merge pull request #1996 from mattermost/release-1.11

Merge Release 1.11 into master
This commit is contained in:
Elias Nahum 2018-08-11 12:37:36 -04:00 committed by GitHub
commit f5bff0680d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 121 additions and 1183 deletions

View file

@ -113,7 +113,7 @@ android {
applicationId "com.mattermost.rnbeta"
minSdkVersion 21
targetSdkVersion 23
versionCode 129
versionCode 130
versionName "1.11.0"
ndk {
abiFilters "armeabi-v7a", "x86"

View file

@ -3,10 +3,11 @@
import {getDataRetentionPolicy} from 'mattermost-redux/actions/general';
import {GeneralTypes} from 'mattermost-redux/action_types';
import {getSessions} from 'mattermost-redux/actions/users';
import {autoUpdateTimezone} from 'mattermost-redux/actions/timezone';
import {Client4} from 'mattermost-redux/client';
import {getConfig, getLicense} from 'mattermost-redux/selectors/entities/general';
import {getCurrentUserId, getSessions} from 'mattermost-redux/selectors/entities/users';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
import {ViewTypes} from 'app/constants';
import {app} from 'app/mattermost';
@ -70,26 +71,25 @@ export function getSession() {
return async (dispatch, getState) => {
const state = getState();
const {currentUserId} = state.entities.users;
const {credentials} = state.entities.general;
const token = credentials && credentials.token;
const {deviceToken} = state.entities.general;
if (!currentUserId || !token) {
if (!currentUserId || !deviceToken) {
return 0;
}
let sessions;
try {
sessions = await getSessions(currentUserId);
sessions = await dispatch(getSessions(currentUserId));
} catch (e) {
console.warn('Failed to get current session', e); // eslint-disable-line no-console
return 0;
}
if (!Array.isArray(sessions)) {
if (!Array.isArray(sessions.data)) {
return 0;
}
const session = sessions.find((s) => s.token === token);
const session = sessions.data.find((s) => s.device_id === deviceToken);
return session && session.expires_at ? session.expires_at : 0;
};

View file

@ -18,22 +18,41 @@ export default class FormattedTime extends React.PureComponent {
intl: intlShape.isRequired,
};
render() {
getFormattedTime = () => {
const {intl} = this.context;
const {
value,
children,
timeZone,
hour12,
} = this.props;
const {intl} = this.context;
const timezoneProps = timeZone ? {timeZone} : {};
const formattedTime = intl.formatDate(value, {
...timezoneProps,
hour: 'numeric',
minute: 'numeric',
hour12,
});
if (timeZone) {
return intl.formatDate(value, {
timeZone,
hour: 'numeric',
minute: 'numeric',
hour12,
});
}
// If no timezone is defined fallback to the previous implementation
const date = new Date(value);
const militaryTime = !hour12;
const hour = militaryTime ? date.getHours() : (date.getHours() % 12 || 12);
let minute = date.getMinutes();
minute = minute >= 10 ? minute : ('0' + minute);
let time = '';
if (!militaryTime) {
time = (date.getHours() >= 12 ? ' PM' : ' AM');
}
return hour + ':' + minute + time;
};
render() {
const {children} = this.props;
const formattedTime = this.getFormattedTime();
if (typeof children === 'function') {
return children(formattedTime);

View file

@ -1,153 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`LoadingPlaceholder should match snapshot 1`] = `
ShallowWrapper {
"length": 1,
Symbol(enzyme.__root__): [Circular],
Symbol(enzyme.__unrendered__): <LoadingPlaceholder />,
Symbol(enzyme.__renderer__): Object {
"batchedUpdates": [Function],
"getNode": [Function],
"render": [Function],
"simulateEvent": [Function],
"unmount": [Function],
},
Symbol(enzyme.__node__): Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"props": Object {
"accessible": true,
"allowFontScaling": true,
"children": Array [
<InjectIntl(FormattedText)
defaultMessage="Loading"
id="loading_screen.loading"
/>,
<AnimatedEllipsis
animationDelay={300}
minOpacity={0.4}
numberOfDots={3}
style={
Object {
"fontSize": 28,
"letterSpacing": -3,
"lineHeight": 30,
"marginLeft": 5,
}
}
/>,
],
"ellipsizeMode": "tail",
},
"ref": null,
"rendered": Array [
Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"props": Object {
"defaultMessage": "Loading",
"id": "loading_screen.loading",
},
"ref": null,
"rendered": null,
"type": [Function],
},
Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"props": Object {
"animationDelay": 300,
"minOpacity": 0.4,
"numberOfDots": 3,
"style": Object {
"fontSize": 28,
"letterSpacing": -3,
"lineHeight": 30,
"marginLeft": 5,
},
},
"ref": null,
"rendered": null,
"type": [Function],
},
],
"type": [Function],
},
Symbol(enzyme.__nodes__): Array [
Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"props": Object {
"accessible": true,
"allowFontScaling": true,
"children": Array [
<InjectIntl(FormattedText)
defaultMessage="Loading"
id="loading_screen.loading"
/>,
<AnimatedEllipsis
animationDelay={300}
minOpacity={0.4}
numberOfDots={3}
style={
Object {
"fontSize": 28,
"letterSpacing": -3,
"lineHeight": 30,
"marginLeft": 5,
}
}
/>,
],
"ellipsizeMode": "tail",
},
"ref": null,
"rendered": Array [
Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"props": Object {
"defaultMessage": "Loading",
"id": "loading_screen.loading",
},
"ref": null,
"rendered": null,
"type": [Function],
},
Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"props": Object {
"animationDelay": 300,
"minOpacity": 0.4,
"numberOfDots": 3,
"style": Object {
"fontSize": 28,
"letterSpacing": -3,
"lineHeight": 30,
"marginLeft": 5,
},
},
"ref": null,
"rendered": null,
"type": [Function],
},
],
"type": [Function],
},
],
Symbol(enzyme.__options__): Object {
"adapter": ReactSixteenAdapter {
"options": Object {
"enableComponentDidUpdateOnSetState": true,
},
},
},
}
`;

View file

@ -1,28 +0,0 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import AnimatedEllipsis from 'react-native-animated-ellipsis';
import FormattedText from 'app/components/formatted_text';
import {Text} from 'react-native';
const LoadingPlaceholder = () => (
<Text>
<FormattedText
id='loading_screen.loading'
defaultMessage='Loading'
/>
<AnimatedEllipsis
minOpacity={0.4}
style={{
fontSize: 28,
lineHeight: 30,
letterSpacing: -3,
marginLeft: 5,
}}
/>
</Text>
);
export default LoadingPlaceholder;

View file

@ -1,19 +0,0 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import {configure, shallow} from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
configure({adapter: new Adapter()});
import LoadingPlaceholder from './index.js';
describe('LoadingPlaceholder', () => {
test('should match snapshot', () => {
const wrapper = shallow(
<LoadingPlaceholder/>
);
expect(wrapper).toMatchSnapshot();
});
});

View file

@ -4,6 +4,7 @@
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
Alert,
Image,
Linking,
Platform,
@ -13,6 +14,7 @@ import {
View,
} from 'react-native';
import {YouTubeStandaloneAndroid, YouTubeStandaloneIOS} from 'react-native-youtube';
import {intlShape} from 'react-intl';
import ProgressiveImage from 'app/components/progressive_image';
@ -53,6 +55,10 @@ export default class PostBodyAdditionalContent extends PureComponent {
onLongPress: emptyFunction,
};
static contextTypes = {
intl: intlShape.isRequired,
};
constructor(props) {
super(props);
@ -348,7 +354,9 @@ export default class PostBodyAdditionalContent extends PureComponent {
const startTime = this.getYouTubeTime(link);
if (Platform.OS === 'ios') {
YouTubeStandaloneIOS.playVideo(videoId, startTime);
YouTubeStandaloneIOS.
playVideo(videoId, startTime).
catch(this.playYouTubeVideoError);
} else {
const {config} = this.props;
@ -358,13 +366,30 @@ export default class PostBodyAdditionalContent extends PureComponent {
videoId,
autoplay: true,
startTime,
});
}).catch(this.playYouTubeVideoError);
} else {
Linking.openURL(link);
}
}
};
playYouTubeVideoError = (errorMessage) => {
const {formatMessage} = this.context.intl;
Alert.alert(
formatMessage({
id: 'mobile.youtube_playback_error.title',
defaultMessage: 'YouTube playback error',
}),
formatMessage({
id: 'mobile.youtube_playback_error.description',
defaultMessage: 'An error occurred while trying to play the YouTube video.\nDetails: {details}',
}, {
details: errorMessage,
}),
);
};
render() {
const {link, openGraphData, postProps} = this.props;
const {linkLoadError} = this.state;

View file

@ -121,9 +121,7 @@ ShallowWrapper {
},
]
}
>
<LoadingPlaceholder />
</Text>
/>
</Component>
</Component>
</TouchableHighlight>,
@ -202,9 +200,7 @@ ShallowWrapper {
},
]
}
>
<LoadingPlaceholder />
</Text>
/>
</Component>
</Component>,
"delayPressOut": 100,
@ -275,9 +271,7 @@ ShallowWrapper {
},
]
}
>
<LoadingPlaceholder />
</Text>
/>
</Component>,
],
"style": Array [
@ -340,9 +334,7 @@ ShallowWrapper {
},
]
}
>
<LoadingPlaceholder />
</Text>,
/>,
undefined,
],
"style": Array [
@ -390,7 +382,7 @@ ShallowWrapper {
"props": Object {
"accessible": true,
"allowFontScaling": true,
"children": <LoadingPlaceholder />,
"children": undefined,
"ellipsizeMode": "tail",
"numberOfLines": 1,
"style": Array [
@ -410,15 +402,7 @@ ShallowWrapper {
],
},
"ref": null,
"rendered": Object {
"instance": null,
"key": undefined,
"nodeType": "function",
"props": Object {},
"ref": null,
"rendered": null,
"type": [Function],
},
"rendered": null,
"type": [Function],
},
undefined,
@ -512,9 +496,7 @@ ShallowWrapper {
},
]
}
>
<LoadingPlaceholder />
</Text>
/>
</Component>
</Component>
</TouchableHighlight>,
@ -593,9 +575,7 @@ ShallowWrapper {
},
]
}
>
<LoadingPlaceholder />
</Text>
/>
</Component>
</Component>,
"delayPressOut": 100,
@ -666,9 +646,7 @@ ShallowWrapper {
},
]
}
>
<LoadingPlaceholder />
</Text>
/>
</Component>,
],
"style": Array [
@ -731,9 +709,7 @@ ShallowWrapper {
},
]
}
>
<LoadingPlaceholder />
</Text>,
/>,
undefined,
],
"style": Array [
@ -781,7 +757,7 @@ ShallowWrapper {
"props": Object {
"accessible": true,
"allowFontScaling": true,
"children": <LoadingPlaceholder />,
"children": undefined,
"ellipsizeMode": "tail",
"numberOfLines": 1,
"style": Array [
@ -801,15 +777,7 @@ ShallowWrapper {
],
},
"ref": null,
"rendered": Object {
"instance": null,
"key": undefined,
"nodeType": "function",
"props": Object {},
"ref": null,
"rendered": null,
"type": [Function],
},
"rendered": null,
"type": [Function],
},
undefined,
@ -850,854 +818,3 @@ ShallowWrapper {
},
}
`;
exports[`ChannelItem should match snapshot for no displayName 1`] = `
ShallowWrapper {
"length": 1,
Symbol(enzyme.__root__): [Circular],
Symbol(enzyme.__unrendered__): <ChannelItem
channelId="channel_id"
currentChannelId="current_channel_id"
displayName=""
fake={false}
isArchived={false}
isChannelMuted={false}
isMyUser={true}
isUnread={true}
mentions={0}
navigator={
Object {
"push": [Function],
}
}
onSelectChannel={[Function]}
shouldHideChannel={false}
showUnreadForMsgs={true}
status="online"
teammateDeletedAt={0}
theme={
Object {
"sidebarText": "#aaa",
"sidebarTextActiveBorder": "#aaa",
"sidebarTextActiveColor": "#aaa",
"sidebarTextHoverBg": "#aaa",
}
}
type="O"
unreadMsgs={1}
/>,
Symbol(enzyme.__renderer__): Object {
"batchedUpdates": [Function],
"getNode": [Function],
"render": [Function],
"simulateEvent": [Function],
"unmount": [Function],
},
Symbol(enzyme.__node__): Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"props": Object {
"children": <TouchableHighlight
activeOpacity={0.85}
delayPressOut={100}
onLongPress={[Function]}
onPress={[Function]}
underlayColor="rgba(170,170,170,0.5)"
>
<Component
style={
Array [
Object {
"flex": 1,
"flexDirection": "row",
"height": 44,
},
undefined,
]
}
>
<Component
style={
Array [
Object {
"alignItems": "center",
"flex": 1,
"flexDirection": "row",
"paddingLeft": 16,
},
undefined,
]
}
>
<ChannelIcon
channelId="channel_id"
isActive={false}
isArchived={false}
isInfo={false}
isUnread={true}
membersCount={1}
size={16}
status="online"
teammateDeletedAt={0}
theme={
Object {
"sidebarText": "#aaa",
"sidebarTextActiveBorder": "#aaa",
"sidebarTextActiveColor": "#aaa",
"sidebarTextHoverBg": "#aaa",
}
}
type="O"
/>
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
numberOfLines={1}
style={
Array [
Object {
"color": "rgba(170,170,170,0.4)",
"flex": 1,
"fontSize": 14,
"fontWeight": "600",
"height": "100%",
"lineHeight": 44,
"paddingRight": 40,
"textAlignVertical": "center",
},
Object {
"color": undefined,
},
]
}
>
<LoadingPlaceholder />
</Text>
</Component>
</Component>
</TouchableHighlight>,
},
"ref": [Function],
"rendered": Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"props": Object {
"activeOpacity": 0.85,
"children": <Component
style={
Array [
Object {
"flex": 1,
"flexDirection": "row",
"height": 44,
},
undefined,
]
}
>
<Component
style={
Array [
Object {
"alignItems": "center",
"flex": 1,
"flexDirection": "row",
"paddingLeft": 16,
},
undefined,
]
}
>
<ChannelIcon
channelId="channel_id"
isActive={false}
isArchived={false}
isInfo={false}
isUnread={true}
membersCount={1}
size={16}
status="online"
teammateDeletedAt={0}
theme={
Object {
"sidebarText": "#aaa",
"sidebarTextActiveBorder": "#aaa",
"sidebarTextActiveColor": "#aaa",
"sidebarTextHoverBg": "#aaa",
}
}
type="O"
/>
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
numberOfLines={1}
style={
Array [
Object {
"color": "rgba(170,170,170,0.4)",
"flex": 1,
"fontSize": 14,
"fontWeight": "600",
"height": "100%",
"lineHeight": 44,
"paddingRight": 40,
"textAlignVertical": "center",
},
Object {
"color": undefined,
},
]
}
>
<LoadingPlaceholder />
</Text>
</Component>
</Component>,
"delayPressOut": 100,
"onLongPress": [Function],
"onPress": [Function],
"underlayColor": "rgba(170,170,170,0.5)",
},
"ref": null,
"rendered": Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"props": Object {
"children": Array [
undefined,
<Component
style={
Array [
Object {
"alignItems": "center",
"flex": 1,
"flexDirection": "row",
"paddingLeft": 16,
},
undefined,
]
}
>
<ChannelIcon
channelId="channel_id"
isActive={false}
isArchived={false}
isInfo={false}
isUnread={true}
membersCount={1}
size={16}
status="online"
teammateDeletedAt={0}
theme={
Object {
"sidebarText": "#aaa",
"sidebarTextActiveBorder": "#aaa",
"sidebarTextActiveColor": "#aaa",
"sidebarTextHoverBg": "#aaa",
}
}
type="O"
/>
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
numberOfLines={1}
style={
Array [
Object {
"color": "rgba(170,170,170,0.4)",
"flex": 1,
"fontSize": 14,
"fontWeight": "600",
"height": "100%",
"lineHeight": 44,
"paddingRight": 40,
"textAlignVertical": "center",
},
Object {
"color": undefined,
},
]
}
>
<LoadingPlaceholder />
</Text>
</Component>,
],
"style": Array [
Object {
"flex": 1,
"flexDirection": "row",
"height": 44,
},
undefined,
],
},
"ref": null,
"rendered": Array [
undefined,
Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"props": Object {
"children": Array [
<ChannelIcon
channelId="channel_id"
isActive={false}
isArchived={false}
isInfo={false}
isUnread={true}
membersCount={1}
size={16}
status="online"
teammateDeletedAt={0}
theme={
Object {
"sidebarText": "#aaa",
"sidebarTextActiveBorder": "#aaa",
"sidebarTextActiveColor": "#aaa",
"sidebarTextHoverBg": "#aaa",
}
}
type="O"
/>,
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
numberOfLines={1}
style={
Array [
Object {
"color": "rgba(170,170,170,0.4)",
"flex": 1,
"fontSize": 14,
"fontWeight": "600",
"height": "100%",
"lineHeight": 44,
"paddingRight": 40,
"textAlignVertical": "center",
},
Object {
"color": undefined,
},
]
}
>
<LoadingPlaceholder />
</Text>,
undefined,
],
"style": Array [
Object {
"alignItems": "center",
"flex": 1,
"flexDirection": "row",
"paddingLeft": 16,
},
undefined,
],
},
"ref": null,
"rendered": Array [
Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"props": Object {
"channelId": "channel_id",
"isActive": false,
"isArchived": false,
"isInfo": false,
"isUnread": true,
"membersCount": 1,
"size": 16,
"status": "online",
"teammateDeletedAt": 0,
"theme": Object {
"sidebarText": "#aaa",
"sidebarTextActiveBorder": "#aaa",
"sidebarTextActiveColor": "#aaa",
"sidebarTextHoverBg": "#aaa",
},
"type": "O",
},
"ref": null,
"rendered": null,
"type": [Function],
},
Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"props": Object {
"accessible": true,
"allowFontScaling": true,
"children": <LoadingPlaceholder />,
"ellipsizeMode": "tail",
"numberOfLines": 1,
"style": Array [
Object {
"color": "rgba(170,170,170,0.4)",
"flex": 1,
"fontSize": 14,
"fontWeight": "600",
"height": "100%",
"lineHeight": 44,
"paddingRight": 40,
"textAlignVertical": "center",
},
Object {
"color": undefined,
},
],
},
"ref": null,
"rendered": Object {
"instance": null,
"key": undefined,
"nodeType": "function",
"props": Object {},
"ref": null,
"rendered": null,
"type": [Function],
},
"type": [Function],
},
undefined,
],
"type": [Function],
},
],
"type": [Function],
},
"type": [Function],
},
"type": [Function],
},
Symbol(enzyme.__nodes__): Array [
Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"props": Object {
"children": <TouchableHighlight
activeOpacity={0.85}
delayPressOut={100}
onLongPress={[Function]}
onPress={[Function]}
underlayColor="rgba(170,170,170,0.5)"
>
<Component
style={
Array [
Object {
"flex": 1,
"flexDirection": "row",
"height": 44,
},
undefined,
]
}
>
<Component
style={
Array [
Object {
"alignItems": "center",
"flex": 1,
"flexDirection": "row",
"paddingLeft": 16,
},
undefined,
]
}
>
<ChannelIcon
channelId="channel_id"
isActive={false}
isArchived={false}
isInfo={false}
isUnread={true}
membersCount={1}
size={16}
status="online"
teammateDeletedAt={0}
theme={
Object {
"sidebarText": "#aaa",
"sidebarTextActiveBorder": "#aaa",
"sidebarTextActiveColor": "#aaa",
"sidebarTextHoverBg": "#aaa",
}
}
type="O"
/>
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
numberOfLines={1}
style={
Array [
Object {
"color": "rgba(170,170,170,0.4)",
"flex": 1,
"fontSize": 14,
"fontWeight": "600",
"height": "100%",
"lineHeight": 44,
"paddingRight": 40,
"textAlignVertical": "center",
},
Object {
"color": undefined,
},
]
}
>
<LoadingPlaceholder />
</Text>
</Component>
</Component>
</TouchableHighlight>,
},
"ref": [Function],
"rendered": Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"props": Object {
"activeOpacity": 0.85,
"children": <Component
style={
Array [
Object {
"flex": 1,
"flexDirection": "row",
"height": 44,
},
undefined,
]
}
>
<Component
style={
Array [
Object {
"alignItems": "center",
"flex": 1,
"flexDirection": "row",
"paddingLeft": 16,
},
undefined,
]
}
>
<ChannelIcon
channelId="channel_id"
isActive={false}
isArchived={false}
isInfo={false}
isUnread={true}
membersCount={1}
size={16}
status="online"
teammateDeletedAt={0}
theme={
Object {
"sidebarText": "#aaa",
"sidebarTextActiveBorder": "#aaa",
"sidebarTextActiveColor": "#aaa",
"sidebarTextHoverBg": "#aaa",
}
}
type="O"
/>
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
numberOfLines={1}
style={
Array [
Object {
"color": "rgba(170,170,170,0.4)",
"flex": 1,
"fontSize": 14,
"fontWeight": "600",
"height": "100%",
"lineHeight": 44,
"paddingRight": 40,
"textAlignVertical": "center",
},
Object {
"color": undefined,
},
]
}
>
<LoadingPlaceholder />
</Text>
</Component>
</Component>,
"delayPressOut": 100,
"onLongPress": [Function],
"onPress": [Function],
"underlayColor": "rgba(170,170,170,0.5)",
},
"ref": null,
"rendered": Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"props": Object {
"children": Array [
undefined,
<Component
style={
Array [
Object {
"alignItems": "center",
"flex": 1,
"flexDirection": "row",
"paddingLeft": 16,
},
undefined,
]
}
>
<ChannelIcon
channelId="channel_id"
isActive={false}
isArchived={false}
isInfo={false}
isUnread={true}
membersCount={1}
size={16}
status="online"
teammateDeletedAt={0}
theme={
Object {
"sidebarText": "#aaa",
"sidebarTextActiveBorder": "#aaa",
"sidebarTextActiveColor": "#aaa",
"sidebarTextHoverBg": "#aaa",
}
}
type="O"
/>
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
numberOfLines={1}
style={
Array [
Object {
"color": "rgba(170,170,170,0.4)",
"flex": 1,
"fontSize": 14,
"fontWeight": "600",
"height": "100%",
"lineHeight": 44,
"paddingRight": 40,
"textAlignVertical": "center",
},
Object {
"color": undefined,
},
]
}
>
<LoadingPlaceholder />
</Text>
</Component>,
],
"style": Array [
Object {
"flex": 1,
"flexDirection": "row",
"height": 44,
},
undefined,
],
},
"ref": null,
"rendered": Array [
undefined,
Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"props": Object {
"children": Array [
<ChannelIcon
channelId="channel_id"
isActive={false}
isArchived={false}
isInfo={false}
isUnread={true}
membersCount={1}
size={16}
status="online"
teammateDeletedAt={0}
theme={
Object {
"sidebarText": "#aaa",
"sidebarTextActiveBorder": "#aaa",
"sidebarTextActiveColor": "#aaa",
"sidebarTextHoverBg": "#aaa",
}
}
type="O"
/>,
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
numberOfLines={1}
style={
Array [
Object {
"color": "rgba(170,170,170,0.4)",
"flex": 1,
"fontSize": 14,
"fontWeight": "600",
"height": "100%",
"lineHeight": 44,
"paddingRight": 40,
"textAlignVertical": "center",
},
Object {
"color": undefined,
},
]
}
>
<LoadingPlaceholder />
</Text>,
undefined,
],
"style": Array [
Object {
"alignItems": "center",
"flex": 1,
"flexDirection": "row",
"paddingLeft": 16,
},
undefined,
],
},
"ref": null,
"rendered": Array [
Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"props": Object {
"channelId": "channel_id",
"isActive": false,
"isArchived": false,
"isInfo": false,
"isUnread": true,
"membersCount": 1,
"size": 16,
"status": "online",
"teammateDeletedAt": 0,
"theme": Object {
"sidebarText": "#aaa",
"sidebarTextActiveBorder": "#aaa",
"sidebarTextActiveColor": "#aaa",
"sidebarTextHoverBg": "#aaa",
},
"type": "O",
},
"ref": null,
"rendered": null,
"type": [Function],
},
Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"props": Object {
"accessible": true,
"allowFontScaling": true,
"children": <LoadingPlaceholder />,
"ellipsizeMode": "tail",
"numberOfLines": 1,
"style": Array [
Object {
"color": "rgba(170,170,170,0.4)",
"flex": 1,
"fontSize": 14,
"fontWeight": "600",
"height": "100%",
"lineHeight": 44,
"paddingRight": 40,
"textAlignVertical": "center",
},
Object {
"color": undefined,
},
],
},
"ref": null,
"rendered": Object {
"instance": null,
"key": undefined,
"nodeType": "function",
"props": Object {},
"ref": null,
"rendered": null,
"type": [Function],
},
"type": [Function],
},
undefined,
],
"type": [Function],
},
],
"type": [Function],
},
"type": [Function],
},
"type": [Function],
},
],
Symbol(enzyme.__options__): Object {
"adapter": ReactSixteenAdapter {
"options": Object {
"enableComponentDidUpdateOnSetState": true,
},
},
"context": Object {
"intl": Object {
"formatMessage": [MockFunction] {
"calls": Array [
Array [
Object {
"defaultMessage": "{displayName} (you)",
"id": "channel_header.directchannel.you",
},
Object {
"displayname": "",
},
],
],
},
},
},
},
}
`;

View file

@ -14,7 +14,6 @@ import {intlShape} from 'react-intl';
import Badge from 'app/components/badge';
import ChannelIcon from 'app/components/channel_icon';
import LoadingPlaceholder from 'app/components/loading_placeholder';
import {preventDoubleTap} from 'app/utils/tap';
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
@ -112,8 +111,20 @@ export default class ChannelItem extends PureComponent {
return null;
}
if (!this.props.displayName) {
return null;
}
const {intl} = this.context;
let channelDisplayName = displayName;
if (isMyUser) {
channelDisplayName = intl.formatMessage({
id: 'channel_header.directchannel.you',
defaultMessage: '{displayName} (you)',
}, {displayname: displayName});
}
const style = getStyleSheet(theme);
const isActive = channelId === currentChannelId;
@ -133,20 +144,6 @@ export default class ChannelItem extends PureComponent {
extraTextStyle = style.textUnread;
}
let channelDisplayName = displayName;
if (isMyUser) {
channelDisplayName = intl.formatMessage({
id: 'channel_header.directchannel.you',
defaultMessage: '{displayName} (you)',
}, {displayname: displayName});
}
if (!channelDisplayName) {
channelDisplayName = (
<LoadingPlaceholder/>
);
}
let badge;
if (mentions) {
badge = (

View file

@ -45,18 +45,4 @@ describe('ChannelItem', () => {
expect(wrapper).toMatchSnapshot();
});
test('should match snapshot for no displayName', () => {
const props = {
...baseProps,
displayName: '',
};
const wrapper = shallow(
<ChannelItem {...props}/>,
{context: {intl: {formatMessage: jest.fn()}}},
);
expect(wrapper).toMatchSnapshot();
});
});

View file

@ -139,16 +139,13 @@ export default class ChannelSidebar extends Component {
drawerOpened: false,
});
this.resetDrawer();
Keyboard.dismiss();
};
handleDrawerOpen = () => {
this.setState({
drawerOpened: true,
});
if (this.state.openDrawerOffset !== 0) {
Keyboard.dismiss();
}
};
handleUpdateTitle = (channel) => {

View file

@ -243,7 +243,7 @@ export default class About extends PureComponent {
platform: (
<FormattedText
id='mobile.notice_platform_link'
defaultMessage='platform'
defaultMessage='server'
style={style.noticeLink}
onPress={this.handlePlatformNotice}
/>
@ -265,20 +265,20 @@ export default class About extends PureComponent {
<FormattedText
id='about.hash'
defaultMessage='Build Hash:'
style={style.footerText}
style={style.footerTitleText}
/>
<Text style={style.footerText}>
{'\u00a0' + config.BuildHash}
{config.BuildHash}
</Text>
</View>
<View style={style.footerGroup}>
<FormattedText
id='about.hashee'
defaultMessage='EE Build Hash:'
style={style.footerText}
style={style.footerTitleText}
/>
<Text style={style.footerText}>
{'\u00a0' + config.BuildHashEnterprise}
{config.BuildHashEnterprise}
</Text>
</View>
</View>
@ -286,10 +286,10 @@ export default class About extends PureComponent {
<FormattedText
id='about.date'
defaultMessage='Build Date:'
style={style.footerText}
style={style.footerTitleText}
/>
<Text style={style.footerText}>
{'\u00a0' + config.BuildDate}
{config.BuildDate}
</Text>
</View>
</View>
@ -325,7 +325,6 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => {
},
titleContainer: {
flex: 1,
flexDirection: 'row',
marginBottom: 20,
},
title: {
@ -375,7 +374,12 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => {
},
footerGroup: {
flex: 1,
flexDirection: 'row',
},
footerTitleText: {
color: changeOpacity(theme.centerChannelColor, 0.5),
fontSize: 11,
fontWeight: '600',
lineHeight: 13,
},
footerText: {
color: changeOpacity(theme.centerChannelColor, 0.5),

View file

@ -6,7 +6,6 @@ import {connect} from 'react-redux';
import {getChannel as getChannelAction, joinChannel, markChannelAsRead, markChannelAsViewed} from 'mattermost-redux/actions/channels';
import {getPostsAfter, getPostsBefore, getPostThread, selectPost} from 'mattermost-redux/actions/posts';
import {Posts} from 'mattermost-redux/constants';
import {makeGetChannel, getMyChannelMemberships} from 'mattermost-redux/selectors/entities/channels';
import {makeGetPostIdsAroundPost, getPost} from 'mattermost-redux/selectors/entities/posts';
import {getTheme} from 'mattermost-redux/selectors/entities/preferences';
@ -34,7 +33,7 @@ function makeMapStateToProps() {
let channel;
let postIds;
if (post && post.delete_at === 0 && post.state !== Posts.POST_DELETED) {
if (post) {
channel = getChannel(state, {id: post.channel_id});
postIds = getPostIdsAroundPost(state, currentFocusedPostId, post.channel_id, {
postsBeforeCount: 10,

View file

@ -114,10 +114,6 @@ export default class Permalink extends PureComponent {
}
componentWillReceiveProps(nextProps) {
if (nextProps.channelId === '' && this.mounted) {
this.handleClose();
}
if (this.props.channelName !== nextProps.channelName && this.mounted) {
this.setState({title: nextProps.channelName});
}

View file

@ -94,10 +94,14 @@ class SSO extends PureComponent {
}
componentDidMount() {
InteractionManager.runAfterInteractions(() => {
InteractionManager.runAfterInteractions(this.clearPreviousCookies);
}
clearPreviousCookies = () => {
CookieManager.clearAll().then(() => {
this.setState({renderWebView: true});
});
}
};
goToLoadTeam = (expiresAt) => {
const {intl, navigator} = this.props;
@ -197,7 +201,7 @@ class SSO extends PureComponent {
onLoadEndError = (e) => {
console.warn('Failed to set store from local data', e); // eslint-disable-line no-console
this.setState({error: e.message});
}
};
renderLoading = () => {
return <Loading/>;

View file

@ -2482,7 +2482,7 @@
"mobile.more_dms.title": "New Conversation",
"mobile.more_dms.you": "(@{username} - you)",
"mobile.notice_mobile_link": "mobile apps",
"mobile.notice_platform_link": "platform",
"mobile.notice_platform_link": "server",
"mobile.notice_text": "Mattermost is made possible by the open source software used in our {platform} and {mobile}.",
"mobile.notification.in": " in ",
"mobile.notification_settings.auto_responder": "Automatic Direct Message Replies",
@ -2631,6 +2631,8 @@
"mobile.video.save_error_title": "Save Video Error",
"mobile.video_playback.failed_description": "An error occurred while trying to play the video.\n",
"mobile.video_playback.failed_title": "Video playback failed",
"mobile.youtube_playback_error.title": "YouTube playback error",
"mobile.youtube_playback_error.description": "An error occurred while trying to play the YouTube video.\nDetails: {details}",
"modal.manual_status.ask": "Do not ask me again",
"modal.manual_status.auto_responder.message_": "Would you like to switch your status to \"{status}\" and disable Automatic Replies?",
"modal.manual_status.auto_responder.message_away": "Would you like to switch your status to \"Away\" and disable Automatic Replies?",

View file

@ -2531,7 +2531,7 @@
CODE_SIGN_ENTITLEMENTS = Mattermost/Mattermost.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 129;
CURRENT_PROJECT_VERSION = 130;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = UQ8HT4Q2XM;
ENABLE_BITCODE = NO;
@ -2581,7 +2581,7 @@
CODE_SIGN_ENTITLEMENTS = Mattermost/Mattermost.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 129;
CURRENT_PROJECT_VERSION = 130;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = UQ8HT4Q2XM;
ENABLE_BITCODE = NO;

View file

@ -34,7 +34,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>129</string>
<string>130</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>

View file

@ -23,7 +23,7 @@
<key>CFBundleShortVersionString</key>
<string>1.11.0</string>
<key>CFBundleVersion</key>
<string>129</string>
<string>130</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>

View file

@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>129</string>
<string>130</string>
</dict>
</plist>

11
package-lock.json generated
View file

@ -10128,8 +10128,8 @@
}
},
"mattermost-redux": {
"version": "github:mattermost/mattermost-redux#f13022064f1ed24a0d1c085f433490f9d40cfc2f",
"from": "github:mattermost/mattermost-redux#f13022064f1ed24a0d1c085f433490f9d40cfc2f",
"version": "github:mattermost/mattermost-redux#0394a5b74c038e59ed4b80d2bea5f2327dc7e156",
"from": "github:mattermost/mattermost-redux#0394a5b74c038e59ed4b80d2bea5f2327dc7e156",
"requires": {
"deep-equal": "1.0.1",
"eslint-plugin-header": "1.2.0",
@ -14641,13 +14641,6 @@
"prop-types": "^15.5.10"
}
},
"react-native-animated-ellipsis": {
"version": "github:sudheerDev/react-native-animated-ellipsis#326167b8e0fa3b6f0422c06be412bf177b725666",
"from": "github:sudheerDev/react-native-animated-ellipsis#326167b8e0fa3b6f0422c06be412bf177b725666",
"requires": {
"prop-types": "^15.5.10"
}
},
"react-native-bottom-sheet": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/react-native-bottom-sheet/-/react-native-bottom-sheet-1.0.3.tgz",

View file

@ -15,14 +15,13 @@
"intl": "1.2.5",
"jail-monkey": "1.0.0",
"jsc-android": "216113.0.3",
"mattermost-redux": "github:mattermost/mattermost-redux#f13022064f1ed24a0d1c085f433490f9d40cfc2f",
"mattermost-redux": "github:mattermost/mattermost-redux#0394a5b74c038e59ed4b80d2bea5f2327dc7e156",
"mime-db": "1.33.0",
"prop-types": "15.6.1",
"react": "16.3.2",
"react-intl": "2.4.0",
"react-native": "github:enahum/react-native#mm",
"react-native-animatable": "1.2.4",
"react-native-animated-ellipsis": "sudheerDev/react-native-animated-ellipsis.git#326167b8e0fa3b6f0422c06be412bf177b725666",
"react-native-bottom-sheet": "1.0.3",
"react-native-button": "2.3.0",
"react-native-circular-progress": "0.2.0",