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

Commit e63c167

Browse files
authored
Merge pull request #4847 from withspectrum/2.8.4
2.8.4
2 parents 489e89c + 73303e8 commit e63c167

38 files changed

+510
-147
lines changed

.circleci/config.yml

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# CircleCI configuration for Spectrum
1+
# CircleCI configuration for Spectrum
2+
version: 2.1
23

34
# Aliases
45
aliases:
@@ -63,7 +64,6 @@ js_defaults: &js_defaults
6364
docker:
6465
- image: circleci/node:8
6566

66-
version: 2
6767
jobs:
6868

6969
# Set up environment and install required dependencies
@@ -72,9 +72,9 @@ jobs:
7272
steps:
7373
- checkout
7474

75-
- restore-cache: *restore-yarn-cache
75+
- restore_cache: *restore-yarn-cache
7676
- run: *yarn
77-
- save-cache: *save-yarn-cache
77+
- save_cache: *save-yarn-cache
7878

7979
- persist_to_workspace:
8080
root: .
@@ -112,15 +112,19 @@ jobs:
112112

113113

114114
# Start db and servers, then run e2e and unit tests
115-
test_e2e:
115+
test_integration:
116116
<<: *defaults
117117
docker:
118118
- image: circleci/node:8-browsers
119119
- image: redis:3.2.7
120120
- image: cypress/base:6
121121
- image: rethinkdb:2.3.5
122-
parallel: true
123-
parallelism: 9
122+
parameters:
123+
parallelism:
124+
type: integer
125+
default: 1
126+
description: Number of boxes to use to run this job
127+
parallelism: <<parameters.parallelism>>
124128
environment:
125129
TERM: xterm
126130
steps:
@@ -144,6 +148,14 @@ jobs:
144148
yarn run test:e2e
145149
fi
146150
151+
# This runs after the above and is only here to hack around missing support for varying jobs based on external vs internal PRs
152+
# See https://github.com/withspectrum/spectrum/pull/4820
153+
test_e2e:
154+
docker:
155+
- image: cypress/base:10
156+
steps:
157+
- run: echo "pass"
158+
147159
# Run eslint, flow etc.
148160
test_static_js:
149161
<<: *js_defaults
@@ -158,8 +170,6 @@ jobs:
158170
command: yarn run lint
159171

160172
workflows:
161-
version: 2
162-
163173
test:
164174
jobs:
165175
- checkout_environment
@@ -172,6 +182,26 @@ workflows:
172182
- build_web:
173183
requires:
174184
- checkout_environment
175-
- test_e2e:
185+
# Run pull requests from internal contributors in parallel
186+
- test_integration:
187+
name: test_e2e_internal
188+
requires:
189+
- build_web
190+
parallelism: 4
191+
filters:
192+
branches:
193+
ignore: /pull.*/
194+
# Run pull requests from external contributors on one machine
195+
- test_integration:
196+
name: test_e2e_external
176197
requires:
177198
- build_web
199+
parallelism: 1
200+
filters:
201+
branches:
202+
only: /pull.*/
203+
# If either of the test_e2e_* jobs pass, this one passes so we can mark it as required on GitHub
204+
- test_e2e:
205+
requires:
206+
- test_e2e_internal
207+
- test_e2e_external

api/mutations/directMessageThread/createDirectMessageThread.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import type { FileUpload } from 'shared/types';
1717
import { events } from 'shared/analytics';
1818
import { trackQueue } from 'shared/bull/queues';
1919
import { isAuthedResolver as requireAuth } from '../../utils/permissions';
20-
import { messageTypeObj } from 'shared/draft-utils/process-message-content';
21-
import type { MessageType } from 'shared/draft-utils/process-message-content';
20+
import { messageTypeObj } from 'shared/draft-utils/message-types';
21+
import type { MessageType } from 'shared/draft-utils/message-types';
2222

2323
export type CreateDirectMessageThreadInput = {
2424
input: {

api/mutations/message/addMessage.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { validateRawContentState } from '../../utils/validate-draft-js-input';
2222
import processMessageContent, {
2323
messageTypeObj,
2424
} from 'shared/draft-utils/process-message-content';
25-
import type { MessageType } from 'shared/draft-utils/process-message-content';
25+
import type { MessageType } from 'shared/draft-utils/message-types';
2626

2727
type Input = {
2828
message: {
@@ -34,6 +34,7 @@ type Input = {
3434
},
3535
parentId?: string,
3636
file?: FileUpload,
37+
bot?: boolean,
3738
},
3839
};
3940

api/mutations/message/editMessage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { validateRawContentState } from '../../utils/validate-draft-js-input';
1919
import processMessageContent, {
2020
messageTypeObj,
2121
} from 'shared/draft-utils/process-message-content';
22-
import type { MessageType } from 'shared/draft-utils/process-message-content';
22+
import type { MessageType } from 'shared/draft-utils/message-types';
2323

2424
type Args = {
2525
input: {

api/mutations/thread/publishThread.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -348,22 +348,24 @@ export default requireAuth(
348348
await createParticipantInThread(dbThread.id, user.id);
349349

350350
// Post a new message with a link to the new thread to the watercooler thread if one exists
351-
// if (community.watercoolerId && !channel.isPrivate) {
352-
// const identifier = user.username ? `@${user.username}` : user.name;
353-
// await addMessage(
354-
// {
355-
// content: {
356-
// body: `${identifier} just posted a new thread 📝 https://spectrum.chat/${
357-
// community.slug
358-
// }/${channel.slug}/${slugg(dbThread.content.title)}~${dbThread.id}`,
359-
// },
360-
// messageType: 'text',
361-
// threadId: community.watercoolerId,
362-
// threadType: 'story',
363-
// },
364-
// 'sam'
365-
// );
366-
// }
351+
if (community.watercoolerId && !channel.isPrivate) {
352+
await addMessage(
353+
{
354+
content: {
355+
body: `${
356+
user.name
357+
} just posted a new thread 📝 https://spectrum.chat/${
358+
community.slug
359+
}/${channel.slug}/${slugg(dbThread.content.title)}~${dbThread.id}`,
360+
},
361+
messageType: 'text',
362+
threadId: community.watercoolerId,
363+
threadType: 'story',
364+
bot: true,
365+
},
366+
user.id
367+
);
368+
}
367369

368370
if (!thread.filesToUpload || thread.filesToUpload.length === 0) {
369371
return dbThread;

api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
"sanitize-filename": "^1.6.1",
123123
"serialize-javascript": "^1.6.1",
124124
"session-rethinkdb": "^2.0.0",
125-
"slate": "^0.44.10",
125+
"slate": "^0.44.11",
126126
"slate-markdown": "0.1.0",
127127
"slugg": "^1.1.0",
128128
"string-replace-to-array": "^1.0.3",

api/queries/thread/channel.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,16 @@
22
import type { GraphQLContext } from '../../';
33
import type { DBThread } from 'shared/types';
44

5-
export default ({ channelId }: DBThread, _: any, { loaders }: GraphQLContext) =>
6-
loaders.channel.load(channelId);
5+
export default async (root: DBThread, _: any, ctx: GraphQLContext) => {
6+
const { channelId, id } = root;
7+
const { loaders } = ctx;
8+
const channel = await loaders.channel.load(channelId);
9+
if (!channel) {
10+
console.error(
11+
'User queried thread of non-existent/deleted channel: ',
12+
channelId
13+
);
14+
console.error('Thread queried: ', id);
15+
}
16+
return channel;
17+
};

api/queries/thread/community.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@
22
import type { GraphQLContext } from '../../';
33
import type { DBThread } from 'shared/types';
44

5-
export default (
6-
{ communityId }: DBThread,
7-
_: any,
8-
{ loaders }: GraphQLContext
9-
) => loaders.community.load(communityId);
5+
export default async (root: DBThread, _: any, ctx: GraphQLContext) => {
6+
const { communityId, id } = root;
7+
const { loaders } = ctx;
8+
const community = await loaders.community.load(communityId);
9+
if (!community) {
10+
console.error(
11+
'User queried thread of non-existent/deleted community: ',
12+
communityId
13+
);
14+
console.error('Thread queried: ', id);
15+
}
16+
return community;
17+
};

api/types/Message.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const Message = /* GraphQL */ `
3030
messageType: MessageTypes!
3131
parent: Message
3232
modifiedAt: Date
33+
bot: Boolean
3334
sender: User! @deprecated(reason: "Use Message.author field instead")
3435
}
3536

api/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8726,10 +8726,10 @@ [email protected]:
87268726
react "^0.14.0 || ^15.0.0"
87278727
styled-components "^2.0.0"
87288728

8729-
slate@^0.44.10:
8730-
version "0.44.10"
8731-
resolved "https://registry.yarnpkg.com/slate/-/slate-0.44.10.tgz#ac7c3e3cf85570a8723a64a8a7807c881ddbfa8a"
8732-
integrity sha512-2jMPgOjExjeWfHrYUsYTMLo/ykbXjCwLUFwG3G34Q0vwRsmf4yOf3b0Zx5LoUaNlyvQDdBsOGsF1qi6yTx53DA==
8729+
slate@^0.44.11:
8730+
version "0.44.11"
8731+
resolved "https://registry.yarnpkg.com/slate/-/slate-0.44.11.tgz#0cdf454726a6d45a6dbf3174ea3f6261ad1a0428"
8732+
integrity sha512-ZtNCxHtGMuWXwUb6vmbrLR73MbHeEQ1LRJNIIyEpj1Kixk0Sd0T+zSKI+cBWCXlOOITqFEfBcJOWaSppiID+1A==
87338733
dependencies:
87348734
debug "^3.1.0"
87358735
direction "^0.1.5"

0 commit comments

Comments
 (0)