static contextTypes = {
router: PropTypes.object,
+ identity: PropTypes.object,
};
static propTypes = {
componentDidMount () {
const { dispatch, onlyMedia } = this.props;
+ const { signedIn } = this.context.identity;
dispatch(expandCommunityTimeline({ onlyMedia }));
- this.disconnect = dispatch(connectCommunityStream({ onlyMedia }));
+
+ if (signedIn) {
+ this.disconnect = dispatch(connectCommunityStream({ onlyMedia }));
+ }
}
componentDidUpdate (prevProps) {
+ const { signedIn } = this.context.identity;
+
if (prevProps.onlyMedia !== this.props.onlyMedia) {
const { dispatch, onlyMedia } = this.props;
- this.disconnect();
+ if (this.disconnect) {
+ this.disconnect();
+ }
+
dispatch(expandCommunityTimeline({ onlyMedia }));
- this.disconnect = dispatch(connectCommunityStream({ onlyMedia }));
+
+ if (signedIn) {
+ this.disconnect = dispatch(connectCommunityStream({ onlyMedia }));
+ }
}
}
}
_subscribe (dispatch, id, tags = {}, local) {
+ const { signedIn } = this.context.identity;
+
+ if (!signedIn) {
+ return;
+ }
+
let any = (tags.any || []).map(tag => tag.value);
let all = (tags.all || []).map(tag => tag.value);
let none = (tags.none || []).map(tag => tag.value);
static contextTypes = {
router: PropTypes.object,
+ identity: PropTypes.object,
};
static propTypes = {
componentDidMount () {
const { dispatch, onlyMedia, onlyRemote, allowLocalOnly } = this.props;
+ const { signedIn } = this.context.identity;
dispatch(expandPublicTimeline({ onlyMedia, onlyRemote, allowLocalOnly }));
- this.disconnect = dispatch(connectPublicStream({ onlyMedia, onlyRemote, allowLocalOnly }));
+ if (signedIn) {
+ this.disconnect = dispatch(connectPublicStream({ onlyMedia, onlyRemote, allowLocalOnly }));
+ }
}
componentDidUpdate (prevProps) {
+ const { signedIn } = this.context.identity;
+
if (prevProps.onlyMedia !== this.props.onlyMedia || prevProps.onlyRemote !== this.props.onlyRemote || prevProps.allowLocalOnly !== this.props.allowLocalOnly) {
const { dispatch, onlyMedia, onlyRemote, allowLocalOnly } = this.props;
- this.disconnect();
+ if (this.disconnect) {
+ this.disconnect();
+ }
+
dispatch(expandPublicTimeline({ onlyMedia, onlyRemote, allowLocalOnly }));
- this.disconnect = dispatch(connectPublicStream({ onlyMedia, onlyRemote, allowLocalOnly }));
+
+ if (signedIn) {
+ this.disconnect = dispatch(connectPublicStream({ onlyMedia, onlyRemote, allowLocalOnly }));
+ }
}
}