MM-11974, MM-11980 Add deactivated user to LHS search (#2080)
* MM-11974, MM-11980 Add deactivated user to LHS search * Add (you) to current user in jumpto search * Change to use old format of objects for non-search results * Remove deactivated when searched using JumpTo * Use archive icon in JumpTo Search for deactivates users * Update snapshots * Change snapshots to use getElement * Fix snapshot
This commit is contained in:
parent
63196936d0
commit
a6e15320d4
5 changed files with 115 additions and 12 deletions
|
|
@ -43,8 +43,8 @@ export default class ChannelIcon extends React.PureComponent {
|
|||
membersCount,
|
||||
size,
|
||||
status,
|
||||
teammateDeletedAt,
|
||||
theme,
|
||||
teammateDeletedAt,
|
||||
type,
|
||||
isArchived,
|
||||
} = this.props;
|
||||
|
|
|
|||
|
|
@ -80,3 +80,84 @@ exports[`ChannelItem should match snapshot 1`] = `
|
|||
</TouchableHighlight>
|
||||
</AnimatedComponent>
|
||||
`;
|
||||
|
||||
exports[`ChannelItem should match snapshot for deactivated user 1`] = `
|
||||
<AnimatedComponent>
|
||||
<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={100}
|
||||
theme={
|
||||
Object {
|
||||
"sidebarText": "#aaa",
|
||||
"sidebarTextActiveBorder": "#aaa",
|
||||
"sidebarTextActiveColor": "#aaa",
|
||||
"sidebarTextHoverBg": "#aaa",
|
||||
}
|
||||
}
|
||||
type="D"
|
||||
/>
|
||||
<Component
|
||||
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,
|
||||
},
|
||||
]
|
||||
}
|
||||
/>
|
||||
</Component>
|
||||
</Component>
|
||||
</TouchableHighlight>
|
||||
</AnimatedComponent>
|
||||
`;
|
||||
|
|
|
|||
|
|
@ -43,4 +43,17 @@ describe('ChannelItem', () => {
|
|||
|
||||
expect(wrapper.getElement()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('should match snapshot for deactivated user', () => {
|
||||
const newProps = {
|
||||
...baseProps,
|
||||
teammateDeletedAt: 100,
|
||||
type: 'D',
|
||||
};
|
||||
const wrapper = shallow(
|
||||
<ChannelItem {...newProps}/>,
|
||||
{context: {intl: {formatMessage: jest.fn()}}},
|
||||
);
|
||||
expect(wrapper.getElement()).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -28,14 +28,21 @@ function makeMapStateToProps() {
|
|||
let isMyUser = false;
|
||||
let teammateDeletedAt = 0;
|
||||
let displayName = channel.display_name;
|
||||
if (channel.type === General.DM_CHANNEL && channel.teammate_id) {
|
||||
isMyUser = channel.teammate_id === currentUserId;
|
||||
const teammate = getUser(state, channel.teammate_id);
|
||||
if (teammate && teammate.delete_at) {
|
||||
teammateDeletedAt = teammate.delete_at;
|
||||
let isArchived = false;
|
||||
if (channel.type === General.DM_CHANNEL) {
|
||||
if (ownProps.isSearchResult) {
|
||||
isMyUser = channel.id === currentUserId;
|
||||
teammateDeletedAt = channel.delete_at;
|
||||
} else {
|
||||
isMyUser = channel.teammate_id === currentUserId;
|
||||
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;
|
||||
}
|
||||
const teammateNameDisplay = getTeammateNameDisplaySetting(state);
|
||||
displayName = displayUsername(teammate, teammateNameDisplay, false);
|
||||
}
|
||||
|
||||
const currentChannelId = getCurrentChannelId(state);
|
||||
|
|
@ -62,6 +69,7 @@ function makeMapStateToProps() {
|
|||
showUnreadForMsgs = member.notify_props.mark_unread !== General.MENTION;
|
||||
}
|
||||
return {
|
||||
channel,
|
||||
currentChannelId,
|
||||
displayName,
|
||||
fake: channel.fake,
|
||||
|
|
@ -75,7 +83,7 @@ function makeMapStateToProps() {
|
|||
theme: getTheme(state),
|
||||
type: channel.type,
|
||||
unreadMsgs,
|
||||
isArchived: channel.delete_at > 0,
|
||||
isArchived,
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ class FilteredList extends Component {
|
|||
const pastDirectMessageUsers = pastDirectMessages.map((p) => profiles[p]).filter((p) => typeof p !== 'undefined');
|
||||
|
||||
const dms = [...directChannelUsers, ...pastDirectMessageUsers].map((u) => {
|
||||
const displayName = displayUsername(u, teammateNameDisplay);
|
||||
const displayName = displayUsername(u, teammateNameDisplay, false);
|
||||
|
||||
return {
|
||||
id: u.id,
|
||||
|
|
@ -211,11 +211,11 @@ class FilteredList extends Component {
|
|||
display_name: displayName,
|
||||
username: u.username,
|
||||
email: u.email,
|
||||
name: displayName,
|
||||
type: General.DM_CHANNEL,
|
||||
fake: true,
|
||||
nickname: u.nickname,
|
||||
fullname: `${u.first_name} ${u.last_name}`,
|
||||
delete_at: u.delete_at,
|
||||
};
|
||||
});
|
||||
|
||||
|
|
@ -244,7 +244,7 @@ class FilteredList extends Component {
|
|||
const userNotInDirectOrGroupChannels = Object.values(profilesToUse).filter((u) => directAndGroupChannelMembers.indexOf(u.id) === -1 && pastDirectMessages.indexOf(u.id) === -1 && u.id !== currentUserId);
|
||||
|
||||
const members = userNotInDirectOrGroupChannels.map((u) => {
|
||||
const displayName = displayUsername(u, teammateNameDisplay);
|
||||
const displayName = displayUsername(u, teammateNameDisplay, false);
|
||||
|
||||
return {
|
||||
id: u.id,
|
||||
|
|
@ -257,6 +257,7 @@ class FilteredList extends Component {
|
|||
fake: true,
|
||||
nickname: u.nickname,
|
||||
fullname: `${u.first_name} ${u.last_name}`,
|
||||
delete_at: u.delete_at,
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue