Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Commit 640a811

Browse files
authored
Merge pull request #3219 from yakotika/alpha
Refactoring
2 parents c5ab598 + 7398ac8 commit 640a811

File tree

3 files changed

+10
-22
lines changed

3 files changed

+10
-22
lines changed

src/views/community/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class CommunityView extends React.Component<Props, State> {
124124

125125
const isNewAndOwned =
126126
community.communityPermissions.isOwner && community.metaData.members < 2;
127-
return this.setState({ showComposerUpsell: isNewAndOwned ? true : false });
127+
return this.setState({ showComposerUpsell: isNewAndOwned });
128128
};
129129

130130
handleSegmentClick = label => {

src/views/dashboard/index.js

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -112,23 +112,12 @@ class Dashboard extends React.Component<Props, State> {
112112
} = this.props;
113113
const { activeChannelObject } = this.state;
114114

115-
let searchFilter = {};
116-
if (activeChannel) {
117-
searchFilter.everythingFeed = false;
118-
searchFilter.communityId = null;
119-
searchFilter.creatorId = null;
120-
searchFilter.channelId = activeChannel;
121-
} else if (activeCommunity) {
122-
searchFilter.everythingFeed = false;
123-
searchFilter.channelId = null;
124-
searchFilter.creatorId = null;
125-
searchFilter.communityId = activeCommunity;
126-
} else {
127-
searchFilter.channelId = null;
128-
searchFilter.communityId = null;
129-
searchFilter.creatorId = null;
130-
searchFilter.everythingFeed = false;
131-
}
115+
const searchFilter = {
116+
everythingFeed: false,
117+
creatorId: null,
118+
channelId: activeChannel || null,
119+
communityId: activeChannel ? null : activeCommunity || null
120+
};
132121
const { title, description } = generateMetaInfo();
133122

134123
if (user) {
@@ -145,9 +134,9 @@ class Dashboard extends React.Component<Props, State> {
145134

146135
// at this point we have succesfully validated a user, and the user has both a username and joined communities - we can show their thread feed!
147136
const communities = user.communityConnection.edges.map(c => c && c.node);
148-
const activeCommunityObject = communities.filter(
137+
const activeCommunityObject = communities.find(
149138
c => c && c.id === activeCommunity
150-
)[0];
139+
);
151140

152141
return (
153142
<DashboardWrapper data-cy="inbox-view" id="main">

src/views/pages/terms/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ import {
1313
import { PrivacyTermsList } from './style';
1414

1515
class Terms extends React.Component<{}> {
16-
componentDidMount() {}
17-
16+
1817
render() {
1918
return (
2019
<Wrapper data-cy="terms-page">

0 commit comments

Comments
 (0)