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

2.4.26 #3792

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
810231c
Fix thread meta image title
mxstbr Aug 14, 2018
597bcf3
Fix thread meta images
mxstbr Aug 14, 2018
a677f18
Update debounce to version 1.2.0
depfu[bot] Aug 14, 2018
4b1675d
Update electron-log to version 2.2.17
depfu[bot] Aug 14, 2018
1c88639
Merge pull request #3768 from withspectrum/fix-thread-meta-image-title
brianlovin Aug 14, 2018
0b667f6
Merge pull request #3769 from withspectrum/depfu/update/api/yarn/debo…
brianlovin Aug 14, 2018
e07c173
Update bull to version 3.4.7
depfu[bot] Aug 15, 2018
b05eb0c
Update bull to version 3.4.7
depfu[bot] Aug 15, 2018
d2b3d5d
Enable apollo engine again
mxstbr Aug 16, 2018
ffc3ab3
Update shortid to version 2.2.13
depfu[bot] Aug 16, 2018
ddee60e
Configure Engine to cache Community.metaData responses
mxstbr Aug 16, 2018
5bc6b08
Remove unnecessary config
mxstbr Aug 16, 2018
f0d56d3
Update shortid to version 2.2.13
depfu[bot] Aug 16, 2018
eee4088
Add reportUser mutation
mxstbr Aug 16, 2018
97bd69b
First handling of sendUserReportedEmail queue from hermes
mxstbr Aug 16, 2018
37cf92a
Merge pull request #3779 from withspectrum/depfu/update/pluto/yarn/sh…
brianlovin Aug 16, 2018
181968b
Merge pull request #3776 from withspectrum/depfu/update/pluto/yarn/bu…
brianlovin Aug 16, 2018
57cec1d
Merge pull request #3775 from withspectrum/depfu/update/mercury/yarn/…
brianlovin Aug 16, 2018
fd7d9a8
Merge pull request #3770 from withspectrum/depfu/update/desktop/yarn/…
brianlovin Aug 16, 2018
48348f1
Merge pull request #3778 from withspectrum/apollo-engine-caching-once…
brianlovin Aug 16, 2018
55d1c2f
Merge pull request #3777 from withspectrum/depfu/update/api/yarn/shor…
brianlovin Aug 16, 2018
30c9f98
Hide pricing link on signed out navbar
brianlovin Aug 16, 2018
cf5eb2a
Small code cleanups
brianlovin Aug 16, 2018
a85ab6d
Clean up queue naming, add to hermes index
brianlovin Aug 16, 2018
4537881
Add email template
brianlovin Aug 16, 2018
ff71224
Fix tests
brianlovin Aug 16, 2018
1d823ec
Add tracking
brianlovin Aug 17, 2018
bcf2dc4
Add tracking events
brianlovin Aug 17, 2018
27860b5
Add graphql mutation
brianlovin Aug 17, 2018
cc15b8c
Clientside implementation
brianlovin Aug 17, 2018
5c3a4a2
Emoji to sort emails
brianlovin Aug 17, 2018
2399675
Update validator to version 10.6.0
depfu[bot] Aug 17, 2018
3d57bfd
Merge pull request #3780 from withspectrum/report-users
brianlovin Aug 17, 2018
4a4163b
Merge pull request #3781 from withspectrum/remove-pricing-link-from-s…
brianlovin Aug 17, 2018
54d0a1d
Merge pull request #3784 from withspectrum/depfu/update/hermes/yarn/v…
brianlovin Aug 17, 2018
db7e2f8
Update apollo-client to version 2.4.0
depfu[bot] Aug 17, 2018
f4a87bf
Merge pull request #3789 from withspectrum/depfu/update/mobile/yarn/a…
brianlovin Aug 17, 2018
bad4efe
Update apollo-cache-inmemory to version 1.2.8
depfu[bot] Aug 17, 2018
9ce191f
Fix thread url in notifications card
brianlovin Aug 17, 2018
5872697
Add spacing to narrow viewport slack channel settings list
brianlovin Aug 17, 2018
8c5a349
Merge pull request #3788 from withspectrum/depfu/update/mobile/yarn/a…
brianlovin Aug 17, 2018
e069987
Merge pull request #3790 from withspectrum/fix-notification-link
brianlovin Aug 17, 2018
8c8c24d
Merge pull request #3791 from withspectrum/fix-space-in-slack-channel…
brianlovin Aug 17, 2018
e216bcf
Merge branch 'alpha' of github.com:withspectrum/spectrum into 2.4.26
brianlovin Aug 17, 2018
9a2bee4
2.4.26
brianlovin Aug 17, 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
46 changes: 27 additions & 19 deletions api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,25 +94,33 @@ import createSubscriptionsServer from './routes/create-subscription-server';
const subscriptionsServer = createSubscriptionsServer(server, '/websocket');

// Start API wrapped in Apollo Engine
// const engine = new ApolloEngine({
// logging: {
// level: 'WARN',
// },
// apiKey: process.env.APOLLO_ENGINE_API_KEY,
// // Only send perf data to the remote server in production
// reporting: {
// disabled: process.env.NODE_ENV !== 'production',
// hostname: process.env.NOW_URL || undefined,
// privateHeaders: ['authorization', 'Authorization', 'AUTHORIZATION'],
// },
// });

// engine.listen({
// port: PORT,
// httpServer: server,
// graphqlPaths: ['/api'],
// });
server.listen(PORT);
const engine = new ApolloEngine({
logging: {
level: 'WARN',
},
apiKey: process.env.APOLLO_ENGINE_API_KEY,
// Only send perf data to the remote server in production
reporting: {
disabled: process.env.NODE_ENV !== 'production',
hostname: process.env.NOW_URL || undefined,
privateHeaders: ['authorization', 'Authorization', 'AUTHORIZATION'],
},
queryCache: {
// Don't cache logged-in user responses
privateFullQueryStore: 'disabled',
},
sessionAuth: {
cookie: 'session',
// TODO(@mxstbr): Ping Apollo to note that we need both of those
// header: 'Authorization'
},
});

engine.listen({
port: PORT,
httpServer: server,
graphqlPaths: ['/api'],
});
debug(`GraphQL server running at http://localhost:${PORT}/api`);

process.on('unhandledRejection', async err => {
Expand Down
2 changes: 2 additions & 0 deletions api/mutations/user/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import unsubscribeWebPush from './unsubscribeWebPush';
import updateUserEmail from './updateUserEmail';
import deleteCurrentUser from './deleteCurrentUser';
import subscribeExpoPush from './subscribeExpoPush';
import reportUser from './reportUser';

module.exports = {
Mutation: {
Expand All @@ -24,5 +25,6 @@ module.exports = {
updateUserEmail,
deleteCurrentUser,
subscribeExpoPush,
reportUser,
},
};
64 changes: 64 additions & 0 deletions api/mutations/user/reportUser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// @flow
import { isAuthedResolver } from '../../utils/permissions';
import UserError from '../../utils/UserError';
import { _adminProcessUserReportedQueue } from 'shared/bull/queues';
import type { GraphQLContext } from '../../';
import { events } from 'shared/analytics';
import { trackQueue } from 'shared/bull/queues';

type ReportUserInput = {
input: {
userId: string,
reason: string,
},
};

export default isAuthedResolver(
async (_: any, args: ReportUserInput, ctx: GraphQLContext) => {
const {
input: { userId, reason },
} = args;
const { loaders, user: currentUser } = ctx;

if (currentUser.id === userId) {
return new UserError('You cannot report yourself.');
}

const reportedUser = await loaders.user.load(userId);

if (!reportedUser) {
return new UserError(`User with ID ${userId} does not exist.`);
}

try {
trackQueue.add({
userId,
event: events.USER_WAS_REPORTED,
properties: {
reason,
reportedBy: currentUser.id,
},
});

trackQueue.add({
userId: currentUser.id,
event: events.USER_REPORTED_USER,
properties: {
reason,
reportedUser: userId,
},
});

await _adminProcessUserReportedQueue.add({
userId,
reason,
reportedBy: currentUser.id,
reportedAt: new Date(),
});
} catch (err) {
console.error(err);
return false;
}
return true;
}
);
4 changes: 2 additions & 2 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"cors": "^2.8.3",
"cryptr": "^3.0.0",
"dataloader": "^1.4.0",
"debounce": "^1.1.0",
"debounce": "^1.2.0",
"debug": "^2.6.8",
"draft-js": "^0.10.5",
"draft-js-code-editor-plugin": "0.2.1",
Expand Down Expand Up @@ -113,7 +113,7 @@
"sanitize-filename": "^1.6.1",
"serialize-javascript": "^1.5.0",
"session-rethinkdb": "^2.0.0",
"shortid": "^2.2.12",
"shortid": "^2.2.13",
"slate": "^0.20.1",
"slate-markdown": "0.1.0",
"slugg": "^1.1.0",
Expand Down
1 change: 1 addition & 0 deletions api/queries/community/metaData.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default async (root: DBCommunity, _: any, ctx: GraphQLContext) => {
return {
channels: 0,
members: 0,
onlineMembers: 0,
};
}

Expand Down
3 changes: 3 additions & 0 deletions api/routes/api/graphql.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export default graphqlExpress(req => {
return {
schema,
formatError: createErrorFormatter(req),
tracing: true,
cacheControl: true,
engine: false,
context: {
loaders,
user: currentUser,
Expand Down
2 changes: 1 addition & 1 deletion api/types/Community.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const Community = /* GraphQL */ `
node: Thread!
}

type CommunityMetaData {
type CommunityMetaData @cacheControl(maxAge: 1800) {
members: Int
channels: Int
onlineMembers: Int
Expand Down
Loading