Display image and channel title in `ChannelHeader` for direct messaging (DM) channel
Motivation
Provide a consistent behavior between different types of channels as well as with ChannelPreview component in ChannelList. Currently the image (Avatar) is displayed in ChannelHeader only if the value is set on channel.data.image, meanwhile the ChannelPreview takes a look and channel.data.image and if not available tries to use other user's image.
Proposed solution
Use the same util functions getDisplayTitle and getDisplayImage already used in ChannelPreview to determine the channel title and image in ChannelHeader. The state may be held in ChannelHeader.
Optional: allow for customGetDisplayTitle and customGetDisplayImage functions that can be passed to ChannelPreview and ChannelHeader to customize the logic of determining the channel's title and display image.
Acceptance Criteria
ChannelHeader by default:
- displays image provided by
channel.data.imageand if not available and the channel is DM channel, display other user's image (otherMember.user.image) - displays title provided by
channel.data.nameand if not available and the channel is DM channel, display other user's name (otherMember.user.name) - Update the displayed image resp. name upon
user.updated/channel.updatedevent received via the websocket connection