Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/components/composer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,17 @@ class ComposerWithData extends Component<Props, State> {

let { storedBody, storedTitle } = this.getTitleAndBody();

const { activeCommunitySlug, activeChannelSlug } = queryString.parse(
props.location.search
);

this.state = {
title: storedTitle || '',
body: storedBody || fromPlainText(''),
availableCommunities: [],
availableChannels: [],
activeCommunity: '',
activeChannel: '',
activeCommunity: activeCommunitySlug || '',
activeChannel: activeChannelSlug || '',
isPublishing: false,
postWasPublished: false,
};
Expand Down Expand Up @@ -149,7 +153,7 @@ class ComposerWithData extends Component<Props, State> {
handleIncomingProps = props => {
const { user } = props.data;
// if the user doesn't exist, bust outta here
if (!user || !user.id) return;
if (!user || !user.id || !user.communityConnection) return;

const hasCommunities =
user.communityConnection.edges &&
Expand Down
2 changes: 2 additions & 0 deletions src/views/channel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ class ChannelView extends React.Component<Props, State> {
provideBack={true}
backRoute={`/${communitySlug}`}
noComposer={!isMember}
activeCommunitySlug={communitySlug}
activeChannelSlug={channel.slug}
/>
<Grid id="main">
<CoverPhoto src={community.coverPhoto} />
Expand Down
3 changes: 2 additions & 1 deletion src/views/community/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class CommunityView extends React.Component<Props, State> {
title={community.name}
provideBack={true}
backRoute={'/'}
noComposer={!community.communityPermissions.isMember}
noComposer
/>

<Head
Expand Down Expand Up @@ -271,6 +271,7 @@ class CommunityView extends React.Component<Props, State> {
provideBack={true}
backRoute={'/'}
noComposer={!community.communityPermissions.isMember}
activeCommunitySlug={community.slug}
/>
<Grid id="main">
<CoverPhoto src={community.coverPhoto} />
Expand Down
20 changes: 0 additions & 20 deletions src/views/compose/index.js

This file was deleted.

10 changes: 0 additions & 10 deletions src/views/compose/style.js

This file was deleted.

12 changes: 11 additions & 1 deletion src/views/titlebar/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { Component } from 'react';
import compose from 'recompose/compose';
import { withRouter } from 'react-router';
import queryString from 'query-string';
import Link from 'src/components/link';
import ThreadSearch from '../dashboard/components/threadSearch';
import Icon from '../../components/icons';
Expand Down Expand Up @@ -55,7 +56,16 @@ class Titlebar extends Component {
filter,
children,
messageComposer,
activeCommunitySlug,
activeChannelSlug,
} = this.props;
const query =
activeChannelSlug || activeCommunitySlug
? `?${queryString.stringify({
activeChannelSlug,
activeCommunitySlug,
})}`
: '';
return (
<TitleBar>
{provideBack ? (
Expand All @@ -80,7 +90,7 @@ class Titlebar extends Component {
<IconButton glyph="message-new" color="text.reverse" />
</Link>
) : (
<Link to={`/new/thread`}>
<Link to={`/new/thread${query}`}>
<IconButton glyph="post" color="text.reverse" />
</Link>
)}
Expand Down