diff --git a/app/components/channel_icon.js b/app/components/channel_icon.js
index 558a625630..f448f557b4 100644
--- a/app/components/channel_icon.js
+++ b/app/components/channel_icon.js
@@ -23,7 +23,6 @@ export default class ChannelIcon extends React.PureComponent {
membersCount: PropTypes.number,
size: PropTypes.number,
status: PropTypes.string,
- teammateDeletedAt: PropTypes.number,
theme: PropTypes.object.isRequired,
type: PropTypes.string.isRequired,
isArchived: PropTypes.bool.isRequired,
@@ -46,7 +45,6 @@ export default class ChannelIcon extends React.PureComponent {
size,
status,
theme,
- teammateDeletedAt,
type,
isArchived,
} = this.props;
@@ -116,13 +114,6 @@ export default class ChannelIcon extends React.PureComponent {
);
- } else if (type === General.DM_CHANNEL && teammateDeletedAt) {
- icon = (
-
- );
} else if (type === General.DM_CHANNEL) {
switch (status) {
case General.AWAY:
diff --git a/app/components/sidebars/main/channels_list/channel_item/__snapshots__/channel_item.test.js.snap b/app/components/sidebars/main/channels_list/channel_item/__snapshots__/channel_item.test.js.snap
index 0d7c6afcf0..d15d5a4956 100644
--- a/app/components/sidebars/main/channels_list/channel_item/__snapshots__/channel_item.test.js.snap
+++ b/app/components/sidebars/main/channels_list/channel_item/__snapshots__/channel_item.test.js.snap
@@ -44,7 +44,6 @@ exports[`ChannelItem should match snapshot 1`] = `
membersCount={1}
size={16}
status="online"
- teammateDeletedAt={0}
theme={
Object {
"awayIndicator": "#ffbc42",
@@ -102,7 +101,9 @@ exports[`ChannelItem should match snapshot 1`] = `
`;
-exports[`ChannelItem should match snapshot for deactivated user 1`] = `
+exports[`ChannelItem should match snapshot for deactivated user 1`] = `null`;
+
+exports[`ChannelItem should match snapshot for deactivated user and is searchResult 1`] = `
`;
+exports[`ChannelItem should match snapshot if channel is archived 1`] = `null`;
+
+exports[`ChannelItem should match snapshot if channel is archived and is currentChannel 1`] = `
+
+
+
+
+
+
+
+
+
+
+
+`;
+
exports[`ChannelItem should match snapshot with draft 1`] = `
{
shouldHideChannel: false,
showUnreadForMsgs: true,
status: 'online',
- teammateDeletedAt: 0,
type: 'O',
theme: Preferences.THEMES.default,
unreadMsgs: 1,
@@ -45,8 +44,22 @@ describe('ChannelItem', () => {
test('should match snapshot for deactivated user', () => {
const newProps = {
...baseProps,
- teammateDeletedAt: 100,
type: 'D',
+ isArchived: true,
+ };
+ const wrapper = shallow(
+ ,
+ {context: {intl: {formatMessage: jest.fn()}}},
+ );
+ expect(wrapper.getElement()).toMatchSnapshot();
+ });
+
+ test('should match snapshot for deactivated user and is searchResult', () => {
+ const newProps = {
+ ...baseProps,
+ type: 'D',
+ isArchived: true,
+ isSearchResult: true,
};
const wrapper = shallow(
,
@@ -66,4 +79,29 @@ describe('ChannelItem', () => {
expect(wrapper.getElement()).toMatchSnapshot();
});
+
+ test('should match snapshot if channel is archived', () => {
+ const wrapper = shallow(
+ ,
+ {context: {intl: {formatMessage: jest.fn()}}},
+ );
+
+ expect(wrapper.getElement()).toMatchSnapshot();
+ });
+
+ test('should match snapshot if channel is archived and is currentChannel', () => {
+ const wrapper = shallow(
+ ,
+ {context: {intl: {formatMessage: jest.fn()}}},
+ );
+
+ expect(wrapper.getElement()).toMatchSnapshot();
+ });
});
diff --git a/app/components/sidebars/main/channels_list/channel_item/index.js b/app/components/sidebars/main/channels_list/channel_item/index.js
index dc16c8d7ea..9a2d0ea907 100644
--- a/app/components/sidebars/main/channels_list/channel_item/index.js
+++ b/app/components/sidebars/main/channels_list/channel_item/index.js
@@ -29,22 +29,16 @@ function makeMapStateToProps() {
const channelDraft = getDraftForChannel(state, channel.id);
let isMyUser = false;
- let teammateDeletedAt = 0;
let displayName = channel.display_name;
- let isArchived = false;
+ const isArchived = channel.delete_at > 0;
+
if (channel.type === General.DM_CHANNEL) {
- if (ownProps.isSearchResult) {
- isMyUser = channel.id === currentUserId;
- teammateDeletedAt = channel.delete_at;
- } else {
- isMyUser = channel.teammate_id === currentUserId;
+ isMyUser = channel.id === currentUserId;
+
+ if (!ownProps.isSearchResult) {
const teammate = getUser(state, channel.teammate_id);
- if (teammate && teammate.delete_at) {
- teammateDeletedAt = teammate.delete_at;
- }
const teammateNameDisplay = getTeammateNameDisplaySetting(state);
displayName = displayUsername(teammate, teammateNameDisplay, false);
- isArchived = channel.delete_at > 0;
}
}
@@ -83,7 +77,6 @@ function makeMapStateToProps() {
shouldHideChannel,
showUnreadForMsgs,
status: channel.status,
- teammateDeletedAt,
theme: getTheme(state),
type: channel.type,
unreadMsgs,