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

Commit 8a1ec71

Browse files
authored
Merge pull request #5069 from withspectrum/3.1.8
3.1.8
2 parents c07d41a + d7f06cd commit 8a1ec71

File tree

6 files changed

+19
-15
lines changed

6 files changed

+19
-15
lines changed

api/models/channel.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const getChannelsByCommunity = (communityId: string): Promise<Array<DBChannel>>
4646
const getPublicChannelsByCommunity = (communityId: string): Promise<Array<string>> => {
4747
return channelsByCommunitiesQuery(communityId)
4848
.filter({ isPrivate: false })
49+
.filter(row => row.hasFields('archivedAt').not())
4950
.map(c => c('id'))
5051
.run();
5152
};
@@ -59,8 +60,10 @@ const getPublicChannelsByCommunity = (communityId: string): Promise<Array<string
5960
*/
6061
// prettier-ignore
6162
const getChannelsByUserAndCommunity = async (communityId: string, userId: string): Promise<Array<string>> => {
62-
const channelIds = await channelsByCommunitiesQuery(communityId)('id').run();
63-
63+
const channels = await channelsByCommunitiesQuery(communityId).run();
64+
const unarchived = channels.filter(channel => !channel.archivedAt)
65+
const channelIds = unarchived.map(channel => channel.id)
66+
6467
return db
6568
.table('usersChannels')
6669
.getAll(...channelIds.map(id => ([userId, id])), {

api/models/test/__snapshots__/channel.test.js.snap

-2
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ exports[`models/channel getChannelsByUserAndCommunity returns correct set of cha
177177
Array [
178178
"2",
179179
"1",
180-
"5",
181180
]
182181
`;
183182

@@ -227,7 +226,6 @@ Array [
227226

228227
exports[`models/channel getPublicChannelsByCommunity returns correct set of channels 1`] = `
229228
Array [
230-
"5",
231229
"1",
232230
"8",
233231
]

api/test/__snapshots__/community.test.js.snap

-7
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ Object {
2727
},
2828
},
2929
},
30-
Object {
31-
"node": Object {
32-
"content": Object {
33-
"title": "Yet another thread",
34-
},
35-
},
36-
},
3730
Object {
3831
"node": Object {
3932
"content": Object {

cypress/integration/community/view/profile_spec.js

+3
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ describe('public community signed out', () => {
7878
.filter(channel => channel.communityId === publicCommunity.id)
7979
.filter(channel => !channel.isPrivate)
8080
.filter(channel => !channel.deletedAt)
81+
.filter(channel => !channel.archivedAt)
8182
.forEach(channel => {
8283
cy.contains(channel.name)
8384
.scrollIntoView()
@@ -140,6 +141,7 @@ describe('public community signed in without permission', () => {
140141
.filter(channel => channel.communityId === publicCommunity.id)
141142
.filter(channel => !channel.isPrivate)
142143
.filter(channel => !channel.deletedAt)
144+
.filter(channel => !channel.archivedAt)
143145
.forEach(channel => {
144146
cy.contains(channel.name)
145147
.scrollIntoView()
@@ -271,6 +273,7 @@ describe('private community signed in with permissions', () => {
271273
.filter(channel => channel.communityId === privateCommunity.id)
272274
.filter(channel => !channel.isPrivate)
273275
.filter(channel => !channel.deletedAt)
276+
.filter(channel => !channel.archivedAt)
274277
.forEach(channel => {
275278
cy.get('[data-cy="channel-list"]')
276279
.contains(channel.name)

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Spectrum",
3-
"version": "3.1.7",
3+
"version": "3.1.8",
44
"license": "BSD-3-Clause",
55
"devDependencies": {
66
"@babel/preset-flow": "^7.0.0",

src/views/community/components/channelsList.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// @flow
22
import * as React from 'react';
33
import { connect } from 'react-redux';
4-
import { Route, Link } from 'react-router-dom';
4+
import { Route, Link, withRouter, type Location } from 'react-router-dom';
55
import compose from 'recompose/compose';
66
import type { Dispatch } from 'redux';
77
import { Query, Mutation } from 'react-apollo';
@@ -39,9 +39,10 @@ type Props = {
3939
dispatch: Dispatch<Object>,
4040
currentUser: Object,
4141
communitySlug: string,
42+
location: Location,
4243
};
4344

44-
const ChatTab = ({ community, currentUser }) =>
45+
const ChatTab = ({ location, community, currentUser }) =>
4546
!community.watercoolerId ? null : (
4647
<Route exact path={`/${community.slug}`}>
4748
{({ match }) => {
@@ -161,6 +162,7 @@ class Component extends React.Component<Props> {
161162
isLoading,
162163
currentUser,
163164
data: { community },
165+
location,
164166
} = this.props;
165167

166168
if (isLoading) {
@@ -206,7 +208,11 @@ class Component extends React.Component<Props> {
206208
</SidebarSectionHeader>
207209

208210
<List data-cy="channel-list">
209-
<ChatTab community={community} currentUser={currentUser} />
211+
<ChatTab
212+
location={location}
213+
community={community}
214+
currentUser={currentUser}
215+
/>
210216
<Route exact path={`/${community.slug}`}>
211217
{({ match }) => (
212218
<Link to={`/${community.slug}?tab=posts`}>
@@ -260,5 +266,6 @@ export const ChannelsList = compose(
260266
getCommunityChannels,
261267
viewNetworkHandler,
262268
withCurrentUser,
269+
withRouter,
263270
connect()
264271
)(Component);

0 commit comments

Comments
 (0)