diff --git a/app/screens/channel/channel_nav_bar/channel_title/__snapshots__/channel_title.test.js.snap b/app/screens/channel/channel_nav_bar/channel_title/__snapshots__/channel_title.test.js.snap
index cda04d782..6e5502cc5 100644
--- a/app/screens/channel/channel_nav_bar/channel_title/__snapshots__/channel_title.test.js.snap
+++ b/app/screens/channel/channel_nav_bar/channel_title/__snapshots__/channel_title.test.js.snap
@@ -51,6 +51,133 @@ exports[`ChannelTitle should match snapshot 1`] = `
`;
+exports[`ChannelTitle should match snapshot when is DM and has guests and the teammate is the guest (when can show subtitles) 1`] = `
+
+
+
+ Other user
+
+
+
+
+
+
+
+`;
+
+exports[`ChannelTitle should match snapshot when is DM and has guests but the teammate is not the guest (when can show subtitles) 1`] = `
+
+
+
+ Other user
+
+
+
+
+`;
+
exports[`ChannelTitle should match snapshot when isSelfDMChannel is true 1`] = `
{
expect(wrapper.getElement()).toMatchSnapshot();
});
+
+ test('should match snapshot when is DM and has guests but the teammate is not the guest (when can show subtitles)', () => {
+ const props = {
+ ...baseProps,
+ displayName: 'Other user',
+ channelType: General.DM_CHANNEL,
+ isGuest: false,
+ hasGuests: true,
+ canHaveSubtitle: true,
+ };
+ const wrapper = shallow(
+ ,
+ {context: {intl: {formatMessage: (intlId) => intlId.defaultMessage}}},
+ );
+
+ expect(wrapper.getElement()).toMatchSnapshot();
+ });
+
+ test('should match snapshot when is DM and has guests and the teammate is the guest (when can show subtitles)', () => {
+ const props = {
+ ...baseProps,
+ displayName: 'Other user',
+ channelType: General.DM_CHANNEL,
+ isGuest: true,
+ hasGuests: true,
+ canHaveSubtitle: true,
+ };
+ const wrapper = shallow(
+ ,
+ {context: {intl: {formatMessage: (intlId) => intlId.defaultMessage}}},
+ );
+
+ expect(wrapper.getElement()).toMatchSnapshot();
+ });
});
diff --git a/app/screens/channel_info/__snapshots__/channel_info.test.js.snap b/app/screens/channel_info/__snapshots__/channel_info.test.js.snap
index c2003eb01..5982e5be3 100644
--- a/app/screens/channel_info/__snapshots__/channel_info.test.js.snap
+++ b/app/screens/channel_info/__snapshots__/channel_info.test.js.snap
@@ -27,6 +27,7 @@ exports[`channel_info should match snapshot 1`] = `
isArchived={false}
isBot={false}
isGroupConstrained={false}
+ isTeammateGuest={false}
memberCount={2}
onPermalinkPress={[Function]}
purpose="Purpose"
diff --git a/app/screens/channel_info/__snapshots__/channel_info_header.test.js.snap b/app/screens/channel_info/__snapshots__/channel_info_header.test.js.snap
index 1c745ee44..f2a9dcaf3 100644
--- a/app/screens/channel_info/__snapshots__/channel_info_header.test.js.snap
+++ b/app/screens/channel_info/__snapshots__/channel_info_header.test.js.snap
@@ -408,7 +408,7 @@ exports[`channel_info_header should match snapshot 1`] = `
`;
-exports[`channel_info_header should match snapshot when DM and hasGuests 1`] = `
+exports[`channel_info_header should match snapshot when DM and hasGuests and is the teammate 1`] = `
`;
+exports[`channel_info_header should match snapshot when DM and hasGuests but its me and not the teammate 1`] = `
+
+
+
+
+
+ Channel name
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+`;
+
exports[`channel_info_header should match snapshot when GM and hasGuests 1`] = `
0}
isGroupConstrained={currentChannel.group_constrained}
/>
diff --git a/app/screens/channel_info/channel_info.test.js b/app/screens/channel_info/channel_info.test.js
index 3aac0d3dc..9e431bc52 100644
--- a/app/screens/channel_info/channel_info.test.js
+++ b/app/screens/channel_info/channel_info.test.js
@@ -60,6 +60,7 @@ describe('channel_info', () => {
status: 'status',
theme: Preferences.THEMES.default,
isBot: false,
+ isTeammateGuest: false,
isLandscape: false,
actions: {
clearPinnedPosts: jest.fn(),
diff --git a/app/screens/channel_info/channel_info_header.js b/app/screens/channel_info/channel_info_header.js
index 9389822eb..e77f874d2 100644
--- a/app/screens/channel_info/channel_info_header.js
+++ b/app/screens/channel_info/channel_info_header.js
@@ -40,6 +40,7 @@ export default class ChannelInfoHeader extends React.PureComponent {
type: PropTypes.string.isRequired,
isArchived: PropTypes.bool.isRequired,
isBot: PropTypes.bool.isRequired,
+ isTeammateGuest: PropTypes.bool.isRequired,
hasGuests: PropTypes.bool.isRequired,
isGroupConstrained: PropTypes.bool,
timeZone: PropTypes.string,
@@ -50,10 +51,13 @@ export default class ChannelInfoHeader extends React.PureComponent {
};
renderHasGuestText = (style) => {
- const {type, hasGuests} = this.props;
+ const {type, hasGuests, isTeammateGuest} = this.props;
if (!hasGuests) {
return null;
}
+ if (type === General.DM_CHANNEL && !isTeammateGuest) {
+ return null;
+ }
let messageId;
let defaultMessage;
diff --git a/app/screens/channel_info/channel_info_header.test.js b/app/screens/channel_info/channel_info_header.test.js
index 82456fa30..c865d1b3f 100644
--- a/app/screens/channel_info/channel_info_header.test.js
+++ b/app/screens/channel_info/channel_info_header.test.js
@@ -40,6 +40,7 @@ describe('channel_info_header', () => {
type: General.OPEN_CHANNEL,
isArchived: false,
isBot: false,
+ isTeammateGuest: false,
hasGuests: false,
isGroupConstrained: false,
};
@@ -76,12 +77,26 @@ describe('channel_info_header', () => {
expect(wrapper.getElement()).toMatchSnapshot();
});
- test('should match snapshot when DM and hasGuests', async () => {
+ test('should match snapshot when DM and hasGuests but its me and not the teammate', async () => {
const wrapper = shallow(
,
+ {context: {intl: intlMock}},
+ );
+ expect(wrapper.getElement()).toMatchSnapshot();
+ });
+
+ test('should match snapshot when DM and hasGuests and is the teammate', async () => {
+ const wrapper = shallow(
+ ,
{context: {intl: intlMock}},
);
diff --git a/app/screens/channel_info/index.js b/app/screens/channel_info/index.js
index 03cfd499f..f59603e0e 100644
--- a/app/screens/channel_info/index.js
+++ b/app/screens/channel_info/index.js
@@ -71,6 +71,7 @@ function mapStateToProps(state) {
let status;
let isBot = false;
+ let isTeammateGuest = false;
if (currentChannel.type === General.DM_CHANNEL) {
const teammateId = getUserIdFromChannelName(currentUserId, currentChannel.name);
const teammate = getUser(state, teammateId);
@@ -79,6 +80,7 @@ function mapStateToProps(state) {
isBot = true;
}
if (isGuest(teammate)) {
+ isTeammateGuest = true;
currentChannelGuestCount = 1;
}
}
@@ -116,6 +118,7 @@ function mapStateToProps(state) {
theme: getTheme(state),
canManageUsers,
isBot,
+ isTeammateGuest,
isLandscape: isLandscape(state),
timeZone,
};