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

2.4.9 #3323

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
778bb69
Fix viewing new profiles on mobile
mxstbr Jun 12, 2018
d6f8204
Use built-in react-navigation getParam method
mxstbr Jun 12, 2018
fc63099
Fix edge case when uploading community profile photo
brianlovin Jun 13, 2018
6e590b5
More photo uploading edge case fixes
brianlovin Jun 13, 2018
287e643
Enable reducer hot reloading
brianlovin Jun 13, 2018
94890c2
Prevent users with null username from being clickable in thread messages
brianlovin Jun 13, 2018
04827a9
Dont destructure a permissions check in sidebar channels
brianlovin Jun 13, 2018
5451c11
Ensure node exists before focusing or bluring
brianlovin Jun 13, 2018
b7ef270
Add safety checks for image previews during upload
brianlovin Jun 13, 2018
44b1b11
Update apollo client version
brianlovin Jun 13, 2018
f28d315
Fix typo
brianlovin Jun 13, 2018
d023ff2
Add more search protections to prevent threads from being returned in…
brianlovin Jun 13, 2018
5cf6070
Merge pull request #3298 from withspectrum/mobile-fix-profile-viewing…
brianlovin Jun 13, 2018
023619c
Merge pull request #3308 from withspectrum/bug-basheroo
mxstbr Jun 13, 2018
7feb0ba
Fixes ToC reference to background jobs
morkro Jun 13, 2018
2056b0d
Merge pull request #3315 from morkro/patch-1
mxstbr Jun 13, 2018
b9456f9
Fix e2e test
brianlovin Jun 13, 2018
0d1af0f
Clean up signed out menu, accessible login button
brianlovin Jun 13, 2018
f00c95f
Clean up PR template
mxstbr Jun 13, 2018
6056db7
Merge pull request #3319 from withspectrum/cleanup-pr-template
brianlovin Jun 13, 2018
a96cdd6
Fix t param redirect on client
brianlovin Jun 13, 2018
c4d2078
Merge pull request #3317 from withspectrum/fix-e2e-test
brianlovin Jun 13, 2018
9bdef35
Merge pull request #3318 from withspectrum/fix-login-on-mobile-menu
brianlovin Jun 13, 2018
0dabf71
Merge pull request #3320 from withspectrum/fix-thread-redirect
brianlovin Jun 13, 2018
89964f0
Remove amplitude console warns
brianlovin Jun 13, 2018
fe9785c
Merge pull request #3322 from withspectrum/remove-console-warn-amplitude
brianlovin Jun 13, 2018
f2cca0e
Merge branch 'alpha' of github.com:withspectrum/spectrum into 2.4.9
brianlovin Jun 13, 2018
f51ba5c
Version
brianlovin Jun 13, 2018
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
12 changes: 5 additions & 7 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ YES

**Release notes for users (delete if codebase-only change)**
-
<!--
If your pull request introduces changes to the user interface on Spectrum, please share before and after screenshots of the changes (gifs or videos are encouraged for interaction changes). Please include screenshots of desktop and mobile viewports to ensure that all responsive cases are reviewed.
-->

**Related issues (delete if you don't know any existing issue(s) that could be related to this PR)**
<!--
If your PR closes an existing issue you can write "Closes #issue_number" or if it's related to another issue you can write "Related to #issue_number"
-->
**Related issues (delete if you don't know of any)**
Closes #

<!-- If there are UI changes please share mobile and desktop screenshots or recordings. -->

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Spectrum has been under full-time development since March, 2017. See [the roadma
- [Roadmap](https://github.com/withspectrum/spectrum/projects/19)
- [Technical](docs/)
- [Testing](docs/testing/intro.md)
- [Background Jobs](docs/backend/background-jobs.md)
- [Background Jobs](docs/workers/background-jobs.md)
- [Deployment](docs/deployments.md)
- [API](docs/backend/api/)
- [Fragments](docs/backend/api/fragments.md)
Expand Down
4 changes: 2 additions & 2 deletions api/models/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ const channelsByCommunitiesQuery = (...communityIds: string[]) =>
db
.table('channels')
.getAll(...communityIds, { index: 'communityId' })
.filter(channel => db.not(channel.hasFields('deletedAt')));
.filter(channel => channel.hasFields('deletedAt').not());

const channelsByIdsQuery = (...channelIds: string[]) =>
db
.table('channels')
.getAll(...channelIds)
.filter(channel => db.not(channel.hasFields('deletedAt')));
.filter(channel => channel.hasFields('deletedAt').not());

const threadsByChannelsQuery = (...channelIds: string[]) =>
channelsByIdsQuery(...channelIds)
Expand Down
10 changes: 8 additions & 2 deletions api/models/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ export const getUsersJoinedChannels = (userId: string): Promise<Array<string>> =
.table('usersChannels')
.getAll(userId, { index: 'userId' })
.filter({ isMember: true })
.eqJoin('channelId', db.table('channels'))
.filter(row => row('right').hasFields('deletedAt').not())
.zip()
.map(row => row('channelId'))
.run();
};
Expand All @@ -101,6 +104,9 @@ export const getUsersJoinedCommunities = (userId: string): Promise<Array<string>
.table('usersCommunities')
.getAll(userId, { index: 'userId' })
.filter({ isMember: true })
.eqJoin('communityId', db.table('communities'))
.filter(row => row('right').hasFields('deletedAt').not())
.zip()
.map(row => row('communityId'))
.run();
};
Expand All @@ -112,7 +118,7 @@ export const getUsersJoinedPrivateChannelIds = (userId: string): Promise<Array<s
.getAll(userId, { index: 'userId' })
.filter({ isMember: true })
.eqJoin('channelId', db.table('channels'))
.filter(row => row('right')('isPrivate').eq(true))
.filter(row => row('right')('isPrivate').eq(true).and(row('right').hasFields('deletedAt').not()))
.without({ left: ['id'] })
.zip()
.map(row => row('id'))
Expand All @@ -126,7 +132,7 @@ export const getUsersJoinedPrivateCommunityIds = (userId: string): Promise<Array
.getAll(userId, { index: 'userId' })
.filter({ isMember: true })
.eqJoin('communityId', db.table('communities'))
.filter(row => row('right')('isPrivate').eq(true))
.filter(row => row('right')('isPrivate').eq(true).and(row('right').hasFields('deletedAt').not()))
.without({ left: ['id'] })
.zip()
.map(row => row('id'))
Expand Down
18 changes: 10 additions & 8 deletions api/queries/search/searchThreads.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export default async (args: Args, { loaders, user }: GraphQLContext) => {
);

return loaders.thread
.loadMany(searchResultThreads.map(t => t.threadId))
.loadMany(searchResultThreads.map(t => t && t.threadId))
.then(data => data.filter(thread => thread && !thread.deletedAt));
}

Expand Down Expand Up @@ -168,7 +168,7 @@ export default async (args: Args, { loaders, user }: GraphQLContext) => {
.filter(t => t.communityId === searchFilter.communityId);

return loaders.thread
.loadMany(searchResultThreads.map(t => t.threadId))
.loadMany(searchResultThreads.map(t => t && t.threadId))
.then(data => data.filter(thread => thread && !thread.deletedAt));
}

Expand Down Expand Up @@ -239,7 +239,7 @@ export default async (args: Args, { loaders, user }: GraphQLContext) => {
.filter(t => t.creatorId === searchFilter.creatorId);

return loaders.thread
.loadMany(searchResultThreads.map(t => t.threadId))
.loadMany(searchResultThreads.map(t => t && t.threadId))
.then(data => data.filter(thread => thread && !thread.deletedAt));
}

Expand Down Expand Up @@ -269,7 +269,7 @@ export default async (args: Args, { loaders, user }: GraphQLContext) => {
.filter(t => availableCommunitiesForSearch.indexOf(t.communityId) >= 0);

return loaders.thread
.loadMany(searchResultThreads.map(t => t.threadId))
.loadMany(searchResultThreads.map(t => t && t.threadId))
.then(data => data.filter(thread => thread && !thread.deletedAt));
}

Expand All @@ -282,11 +282,11 @@ export default async (args: Args, { loaders, user }: GraphQLContext) => {

// first, lets get the channels where the thread results were posted
const channelsOfThreads = await getChannels(
searchResultThreads.map(t => t.channelId)
searchResultThreads.map(t => t && t.channelId)
);

const communitiesOfThreads = await getCommunities(
searchResultThreads.map(t => t.communityId)
searchResultThreads.map(t => t && t.communityId)
);

// see if any channels where thread results were found are private
Expand All @@ -305,7 +305,7 @@ export default async (args: Args, { loaders, user }: GraphQLContext) => {
(!privateCommunityIds || privateCommunityIds.length === 0)
) {
return loaders.thread
.loadMany(searchResultThreads.map(t => t.threadId))
.loadMany(searchResultThreads.map(t => t && t.threadId))
.then(data => data.filter(thread => thread && !thread.deletedAt));
} else {
// otherwise here we know that the user found threads where some of them are
Expand All @@ -332,6 +332,8 @@ export default async (args: Args, { loaders, user }: GraphQLContext) => {
// for each thread in the search results, determine if it was posted in
// a private channel. if yes, is the current user a member?
searchResultThreads = searchResultThreads.filter(thread => {
if (!thread) return null;

if (privateChannelIds.indexOf(thread.channelId) >= 0) {
return availablePrivateChannels.indexOf(thread.channelId) >= 0;
}
Expand All @@ -344,7 +346,7 @@ export default async (args: Args, { loaders, user }: GraphQLContext) => {
});

return loaders.thread
.loadMany(searchResultThreads.map(t => t.threadId))
.loadMany(searchResultThreads.map(t => t && t.threadId))
.then(data => data.filter(thread => thread && !thread.deletedAt));
}
};
4 changes: 3 additions & 1 deletion api/queries/thread/rootThread.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export default async (
]);

// if the channel is private, don't return any thread data
if (channel.isPrivate || community.isPrivate) return null;
if (!channel || !community || channel.isPrivate || community.isPrivate)
return null;
return thread;
} else {
// if the user is signed in, we need to check if the channel is private as well as the user's permission in that channel
Expand All @@ -38,6 +39,7 @@ export default async (
]);

// if the thread is in a private channel where the user is not a member, don't return any thread data
if (!channel || !community) return null;
if (
channel.isPrivate &&
(!channelPermissions || !channelPermissions.isMember)
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/thread/action_bar_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ describe('action bar renders', () => {
cy.get('[data-cy="thread-notifications-toggle"]').should('be.visible');
cy.get('[data-cy="thread-facebook-button"]').should('not.be.visible');
cy.get('[data-cy="thread-tweet-button"]').should('not.be.visible');
cy.get('[data-cy="thread-copy-link-button"]').should('not.be.visible');
cy.get('[data-cy="thread-copy-link-button"]').should('be.visible');
cy
.get('[data-cy="thread-actions-dropdown-trigger"]')
.should('not.be.visible');
Expand Down
2 changes: 1 addition & 1 deletion mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"dependencies": {
"@expo/react-native-action-sheet": "^1.0.2",
"apollo-cache-inmemory": "^1.1.12",
"apollo-client": "^2.2.8",
"apollo-client": "^2.3.2",
"apollo-link": "^1.2.2",
"apollo-link-error": "^1.0.9",
"apollo-link-http": "^1.5.4",
Expand Down
3 changes: 2 additions & 1 deletion mobile/views/Channel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ class Channel extends Component<Props> {
} else {
title = 'Loading channel...';
}
if (navigation.state.params.title === title) return;
const oldTitle = navigation.getParam('title', null);
if (oldTitle && oldTitle === title) return;
navigation.setParams({ title });
};

Expand Down
3 changes: 2 additions & 1 deletion mobile/views/Community/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ class Community extends Component<Props> {
} else {
title = 'Loading community...';
}
if (navigation.state.params.title === title) return;
const oldTitle = navigation.getParam('title', null);
if (oldTitle && oldTitle === title) return;
navigation.setParams({ title });
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ class DirectMessageThread extends Component<Props> {
let title = directMessageThread
? sentencify(directMessageThread.participants.map(({ name }) => name))
: 'Loading thread...';
if (navigation.state.params.title === title) return;
const oldTitle = navigation.getParam('title', null);
if (oldTitle && oldTitle === title) return;
navigation.setParams({ title });
};

Expand Down
3 changes: 1 addition & 2 deletions mobile/views/DirectMessageThread/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// @flow
import React from 'react';
import compose from 'recompose/compose';
import idx from 'idx';
import Text from '../../components/Text';
import { withCurrentUser } from '../../components/WithCurrentUser';
import DirectMessageThread from './components/DirectMessageThread';
Expand All @@ -17,8 +16,8 @@ type Props = {

class DirectMessageThreadView extends React.Component<Props> {
render() {
const id = idx(this.props, props => props.navigation.state.params.id);
const { currentUser, navigation } = this.props;
const id = navigation.getParam('id', null);
if (!id) return <Text>Non-existant DM thread</Text>;

if (!currentUser) return null;
Expand Down
8 changes: 4 additions & 4 deletions mobile/views/TabBar/BaseStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@ const BaseStack = {
Thread: {
screen: withMappedNavigationProps(Thread),
navigationOptions: ({ navigation }: NavigationScreenConfigProps) => ({
headerTitle: navigation.state.params.title || null,
headerTitle: navigation.getParam('title', null),
tabBarVisible: false,
}),
},
Community: {
screen: withMappedNavigationProps(Community),
navigationOptions: ({ navigation }: NavigationScreenConfigProps) => ({
headerTitle: navigation.state.params.title || null,
headerTitle: navigation.getParam('title', null),
}),
},
Channel: {
screen: withMappedNavigationProps(Channel),
navigationOptions: ({ navigation }: NavigationScreenConfigProps) => ({
headerTitle: navigation.state.params.title || null,
headerTitle: navigation.getParam('title', null),
}),
},
User: {
screen: withMappedNavigationProps(User),
navigationOptions: ({ navigation }: NavigationScreenConfigProps) => ({
headerTitle: navigation.state.params.title || null,
headerTitle: navigation.getParam('title', null),
}),
},
};
Expand Down
5 changes: 2 additions & 3 deletions mobile/views/TabBar/DirectMessageStack.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// @flow
import { createStackNavigator } from 'react-navigation';
import idx from 'idx';
import BaseStack from './BaseStack';
import DirectMessages from '../DirectMessages';
import DirectMessageThread from '../DirectMessageThread';
Expand All @@ -10,13 +9,13 @@ const DMStack = createStackNavigator(
DirectMessages: {
screen: DirectMessages,
navigationOptions: ({ navigation }) => ({
headerTitle: idx(navigation, _ => _.state.params.title) || 'Messages',
headerTitle: navigation.getParam('title', 'Messages'),
}),
},
DirectMessageThread: {
screen: DirectMessageThread,
navigationOptions: ({ navigation }) => ({
headerTitle: idx(navigation, _ => _.state.params.title) || '',
headerTitle: navigation.getParam('title', null),
tabBarVisible: false,
}),
},
Expand Down
3 changes: 2 additions & 1 deletion mobile/views/Thread/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ class Thread extends Component<Props> {
} else {
title = 'Loading thread...';
}
if (navigation.state.params.title === title) return;
const oldTitle = navigation.getParam('title', null);
if (oldTitle && oldTitle === title) return;
navigation.setParams({ title });
};

Expand Down
4 changes: 3 additions & 1 deletion mobile/views/User/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ class User extends Component<Props, State> {
} else {
title = 'Loading user...';
}
if (navigation.state.params.title === title) return;

const oldTitle = navigation.getParam('title', null);
if (oldTitle && oldTitle === title) return;
navigation.setParams({ title });
};

Expand Down
34 changes: 20 additions & 14 deletions mobile/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -564,9 +564,9 @@
component-type "^1.2.1"
join-component "^1.1.0"

"@types/async@2.0.47":
version "2.0.47"
resolved "https://registry.yarnpkg.com/@types/async/-/async-2.0.47.tgz#f49ba1dd1f189486beb6e1d070a850f6ab4bd521"
"@types/async@2.0.49":
version "2.0.49"
resolved "https://registry.yarnpkg.com/@types/async/-/async-2.0.49.tgz#92e33d13f74c895cb9a7f38ba97db8431ed14bc0"

"@types/graphql@0.12.6":
version "0.12.6"
Expand Down Expand Up @@ -732,19 +732,25 @@ apollo-cache@^1.1.7:
dependencies:
apollo-utilities "^1.0.11"

apollo-client@^2.2.8:
version "2.2.8"
resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-2.2.8.tgz#b604d31ab2d2dd00db3105d8793b93ee02ce567e"
apollo-cache@^1.1.9:
version "1.1.9"
resolved "https://registry.yarnpkg.com/apollo-cache/-/apollo-cache-1.1.9.tgz#90426f25c43bc66ae02808af01194d78fd15ea40"
dependencies:
apollo-utilities "^1.0.13"

apollo-client@^2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-2.3.2.tgz#0c4c06eba0aedc63d2d988f247a9310cb2152c2e"
dependencies:
"@types/zen-observable" "^0.5.3"
apollo-cache "^1.1.7"
apollo-cache "^1.1.9"
apollo-link "^1.0.0"
apollo-link-dedup "^1.0.0"
apollo-utilities "^1.0.11"
apollo-utilities "^1.0.13"
symbol-observable "^1.0.2"
zen-observable "^0.7.0"
zen-observable "^0.8.0"
optionalDependencies:
"@types/async" "2.0.47"
"@types/async" "2.0.49"

apollo-link-dedup@^1.0.0:
version "1.0.5"
Expand Down Expand Up @@ -790,6 +796,10 @@ apollo-utilities@^1.0.0, apollo-utilities@^1.0.11:
version "1.0.11"
resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.0.11.tgz#cd36bfa6e5c04eea2caf0c204a0f38a0ad550802"

apollo-utilities@^1.0.13:
version "1.0.13"
resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.0.13.tgz#793c858bb42243f7254d3c2961c64a7158e51022"

append-transform@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-0.4.0.tgz#d76ebf8ca94d276e247a36bad44a4b74ab611991"
Expand Down Expand Up @@ -8122,10 +8132,6 @@ zen-observable-ts@^0.8.9:
dependencies:
zen-observable "^0.8.0"

zen-observable@^0.7.0:
version "0.7.1"
resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.7.1.tgz#f84075c0ee085594d3566e1d6454207f126411b3"

zen-observable@^0.8.0:
version "0.8.8"
resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.8.8.tgz#1ea93995bf098754a58215a1e0a7309e5749ec42"
Loading