Skip to content

Commit

Permalink
Hide the muted streams & topics from Unread. Show Private icon on str…
Browse files Browse the repository at this point in the history
…eams (#1037)
  • Loading branch information
borisyankov authored Aug 14, 2017
1 parent 74e626a commit 96d06c9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
43 changes: 24 additions & 19 deletions src/unread/UnreadStreamsCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { streamNarrow, topicNarrow } from '../utils/narrow';
import StreamItem from '../streams/StreamItem';
import TopicItem from '../streams/TopicItem';

export default class UnreadStreamsContainer extends PureComponent {
export default class UnreadStreamsCard extends PureComponent {
static contextTypes = {
styles: () => null,
};
Expand All @@ -33,25 +33,30 @@ export default class UnreadStreamsContainer extends PureComponent {
initialNumToRender={20}
sections={unreadStreamsAndTopics}
renderSectionHeader={({ section }) =>
<StreamItem
style={styles.groupHeader}
name={section.streamName}
iconSize={16}
isMuted={section.isMuted}
color={section.color}
backgroundColor={section.color}
unreadCount={section.unread}
onPress={this.handleStreamPress}
/>}
section.isMuted
? null
: <StreamItem
style={styles.groupHeader}
name={section.streamName}
iconSize={16}
isMuted={section.isMuted}
isPrivate={section.isPrivate}
color={section.color}
backgroundColor={section.color}
unreadCount={section.unread}
onPress={this.handleStreamPress}
/>}
renderItem={({ item, section }) =>
<TopicItem
name={item.topic}
stream={section.streamName}
isMuted={section.isMuted || item.isMuted}
isSelected={false}
unreadCount={item.unread}
onPress={this.handleTopicPress}
/>}
section.isMuted || item.isMuted
? null
: <TopicItem
name={item.topic}
stream={section.streamName}
isMuted={section.isMuted || item.isMuted}
isSelected={false}
unreadCount={item.unread}
onPress={this.handleTopicPress}
/>}
/>
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/unread/unreadSelectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,15 @@ export const getUnreadStreamsAndTopics = createSelector(
getMute,
(subscriptionsById, unreadStreams, mute) => {
const unreadMap = unreadStreams.reduce((totals, stream) => {
const { name, color, in_home_view } =
const { name, color, in_home_view, invite_only } =
subscriptionsById[stream.stream_id] || NULL_SUBSCRIPTION;

if (!totals[stream.stream_id]) {
totals[stream.stream_id] = {
key: name,
streamName: name,
isMuted: !in_home_view, // eslint-disable-line
isPrivate: invite_only,
color,
unread: 0,
data: [],
Expand Down

0 comments on commit 96d06c9

Please sign in to comment.