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

Commit 5fd5831

Browse files
authored
Merge pull request #2673 from withspectrum/2.2.1
2.2.1
2 parents 072b810 + 6419137 commit 5fd5831

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2012
-220
lines changed

.eslintrc.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"commonjs": true,
5+
"es6": true,
6+
"node": true
7+
},
8+
"parserOptions": {
9+
"ecmaFeatures": {
10+
"jsx": true
11+
},
12+
"sourceType": "module"
13+
},
14+
"rules": {
15+
"no-const-assign": 1,
16+
"no-extra-semi": 0,
17+
"semi": 0,
18+
"no-fallthrough": 0,
19+
"no-empty": 0,
20+
"no-mixed-spaces-and-tabs": 0,
21+
"no-redeclare": 0,
22+
"no-this-before-super": 1,
23+
"no-undef": 0,
24+
"no-unreachable": 1,
25+
"no-unused-vars": 1,
26+
"no-use-before-define": 0,
27+
"constructor-super": 1,
28+
"curly": 0,
29+
"eqeqeq": 0,
30+
"func-names": 0,
31+
"valid-typeof": 1
32+
}
33+
}

api/migrations/seed/default/channels.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ const {
44
DATE,
55
SPECTRUM_COMMUNITY_ID,
66
PAYMENTS_COMMUNITY_ID,
7+
DELETED_COMMUNITY_ID,
78
SPECTRUM_GENERAL_CHANNEL_ID,
89
SPECTRUM_PRIVATE_CHANNEL_ID,
910
PAYMENTS_GENERAL_CHANNEL_ID,
1011
PAYMENTS_PRIVATE_CHANNEL_ID,
12+
SPECTRUM_ARCHIVED_CHANNEL_ID,
13+
SPECTRUM_DELETED_CHANNEL_ID,
14+
DELETED_COMMUNITY_DELETED_CHANNEL_ID,
15+
MODERATOR_CREATED_CHANNEL_ID,
1116
} = constants;
1217

1318
module.exports = [
@@ -54,4 +59,51 @@ module.exports = [
5459
isPrivate: true,
5560
isDefault: false,
5661
},
62+
63+
{
64+
id: SPECTRUM_ARCHIVED_CHANNEL_ID,
65+
communityId: SPECTRUM_COMMUNITY_ID,
66+
createdAt: new Date(DATE),
67+
name: 'Archived',
68+
description: 'Testing archiving',
69+
slug: 'archived',
70+
isPrivate: false,
71+
isDefault: true,
72+
archivedAt: new Date(DATE),
73+
},
74+
75+
{
76+
id: SPECTRUM_DELETED_CHANNEL_ID,
77+
communityId: SPECTRUM_COMMUNITY_ID,
78+
createdAt: new Date(DATE),
79+
name: 'Deleted',
80+
description: 'Testing deleted channel',
81+
slug: 'deleted',
82+
isPrivate: false,
83+
isDefault: false,
84+
deletedAt: new Date(DATE),
85+
},
86+
87+
{
88+
id: DELETED_COMMUNITY_DELETED_CHANNEL_ID,
89+
communityId: DELETED_COMMUNITY_ID,
90+
createdAt: new Date(DATE),
91+
name: 'Deleted',
92+
description: 'Testing deleted channel',
93+
slug: 'deleted',
94+
isPrivate: false,
95+
isDefault: false,
96+
deletedAt: new Date(DATE),
97+
},
98+
99+
{
100+
id: MODERATOR_CREATED_CHANNEL_ID,
101+
communityId: SPECTRUM_COMMUNITY_ID,
102+
createdAt: new Date(DATE),
103+
name: 'Moderator created',
104+
description: 'Moderator created channel',
105+
slug: 'moderator-created',
106+
isPrivate: false,
107+
isDefault: false,
108+
},
57109
];

api/migrations/seed/default/communities.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
// @flow
22
const constants = require('./constants');
3-
const { DATE, SPECTRUM_COMMUNITY_ID, PAYMENTS_COMMUNITY_ID } = constants;
3+
const {
4+
DATE,
5+
SPECTRUM_COMMUNITY_ID,
6+
PAYMENTS_COMMUNITY_ID,
7+
DELETED_COMMUNITY_ID,
8+
} = constants;
49

510
module.exports = [
611
{
@@ -27,4 +32,17 @@ module.exports = [
2732
'https://spectrum.imgix.net/communities/-Kh6RfPYjmSaIWbkck8i/Twitter Header.png.0.3303118636071434',
2833
slug: 'payments',
2934
},
35+
{
36+
id: DELETED_COMMUNITY_ID,
37+
createdAt: new Date(DATE),
38+
deletedAt: new Date(DATE),
39+
name: 'Deleted',
40+
description: 'Things didnt work out',
41+
website: 'https://spectrum.chat',
42+
profilePhoto:
43+
'https://spectrum.imgix.net/communities/-Kh6RfPYjmSaIWbkck8i/Twitter Profile.png.0.6225566835336693',
44+
coverPhoto:
45+
'https://spectrum.imgix.net/communities/-Kh6RfPYjmSaIWbkck8i/Twitter Header.png.0.3303118636071434',
46+
slug: 'deleted',
47+
},
3048
];

api/migrations/seed/default/constants.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,25 @@ const QUIET_USER_ID = '5';
1313
const PREVIOUS_MEMBER_USER_ID = '6';
1414
// this user is pending in all private channels
1515
const PENDING_USER_ID = '7';
16+
// this user is moderator in all channels, member in all communities
17+
const CHANNEL_MODERATOR_USER_ID = '8';
18+
// this user is moderator in all communities
19+
const COMMUNITY_MODERATOR_USER_ID = '9';
1620

1721
// communities
1822
const SPECTRUM_COMMUNITY_ID = '1';
1923
const PAYMENTS_COMMUNITY_ID = '2';
24+
const DELETED_COMMUNITY_ID = '3';
2025

2126
// channels
2227
const SPECTRUM_GENERAL_CHANNEL_ID = '1';
2328
const SPECTRUM_PRIVATE_CHANNEL_ID = '2';
2429
const PAYMENTS_GENERAL_CHANNEL_ID = '3';
2530
const PAYMENTS_PRIVATE_CHANNEL_ID = '4';
31+
const SPECTRUM_ARCHIVED_CHANNEL_ID = '5';
32+
const SPECTRUM_DELETED_CHANNEL_ID = '6';
33+
const DELETED_COMMUNITY_DELETED_CHANNEL_ID = '7';
34+
const MODERATOR_CREATED_CHANNEL_ID = '8';
2635

2736
module.exports = {
2837
DATE,
@@ -33,10 +42,17 @@ module.exports = {
3342
QUIET_USER_ID,
3443
PREVIOUS_MEMBER_USER_ID,
3544
PENDING_USER_ID,
45+
CHANNEL_MODERATOR_USER_ID,
46+
COMMUNITY_MODERATOR_USER_ID,
3647
SPECTRUM_COMMUNITY_ID,
3748
PAYMENTS_COMMUNITY_ID,
49+
DELETED_COMMUNITY_ID,
3850
SPECTRUM_GENERAL_CHANNEL_ID,
3951
SPECTRUM_PRIVATE_CHANNEL_ID,
4052
PAYMENTS_GENERAL_CHANNEL_ID,
4153
PAYMENTS_PRIVATE_CHANNEL_ID,
54+
SPECTRUM_ARCHIVED_CHANNEL_ID,
55+
SPECTRUM_DELETED_CHANNEL_ID,
56+
DELETED_COMMUNITY_DELETED_CHANNEL_ID,
57+
MODERATOR_CREATED_CHANNEL_ID,
4258
};

api/migrations/seed/default/threads.js

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@ const {
66
BRIAN_ID,
77
MAX_ID,
88
BRYN_ID,
9+
CHANNEL_MODERATOR_USER_ID,
910
SPECTRUM_GENERAL_CHANNEL_ID,
1011
SPECTRUM_PRIVATE_CHANNEL_ID,
1112
PAYMENTS_GENERAL_CHANNEL_ID,
1213
PAYMENTS_PRIVATE_CHANNEL_ID,
14+
SPECTRUM_DELETED_CHANNEL_ID,
15+
DELETED_COMMUNITY_DELETED_CHANNEL_ID,
16+
MODERATOR_CREATED_CHANNEL_ID,
17+
DELETED_COMMUNITY_ID,
1318
SPECTRUM_COMMUNITY_ID,
1419
PAYMENTS_COMMUNITY_ID,
20+
SPECTRUM_ARCHIVED_CHANNEL_ID,
1521
} = constants;
1622

1723
module.exports = [
@@ -196,4 +202,126 @@ module.exports = [
196202
modifiedAt: new Date(DATE + 2),
197203
lastActive: new Date(DATE + 2),
198204
},
205+
{
206+
id: 'thread-7',
207+
createdAt: new Date(DATE + 2),
208+
creatorId: BRYN_ID,
209+
channelId: DELETED_COMMUNITY_DELETED_CHANNEL_ID,
210+
communityId: DELETED_COMMUNITY_ID,
211+
isPublished: true,
212+
isLocked: false,
213+
type: 'DRAFTJS',
214+
content: {
215+
title: 'Yet another thread',
216+
body: JSON.stringify(
217+
toJSON(fromPlainText('This is just another thread'))
218+
),
219+
},
220+
attachments: [],
221+
edits: [
222+
{
223+
timestamp: new Date(DATE + 2),
224+
content: {
225+
title: 'Yet another thread',
226+
body: JSON.stringify(
227+
toJSON(fromPlainText('This is just another thread'))
228+
),
229+
},
230+
},
231+
],
232+
modifiedAt: new Date(DATE + 2),
233+
lastActive: new Date(DATE + 2),
234+
deletedAt: new Date(DATE + 3),
235+
},
236+
{
237+
id: 'thread-8',
238+
createdAt: new Date(DATE + 2),
239+
creatorId: BRYN_ID,
240+
channelId: SPECTRUM_ARCHIVED_CHANNEL_ID,
241+
communityId: SPECTRUM_COMMUNITY_ID,
242+
isPublished: true,
243+
isLocked: false,
244+
type: 'DRAFTJS',
245+
content: {
246+
title: 'Yet another thread',
247+
body: JSON.stringify(
248+
toJSON(fromPlainText('This is just another thread'))
249+
),
250+
},
251+
attachments: [],
252+
edits: [
253+
{
254+
timestamp: new Date(DATE + 2),
255+
content: {
256+
title: 'Yet another thread',
257+
body: JSON.stringify(
258+
toJSON(fromPlainText('This is just another thread'))
259+
),
260+
},
261+
},
262+
],
263+
modifiedAt: new Date(DATE + 2),
264+
lastActive: new Date(DATE + 2),
265+
},
266+
{
267+
id: 'thread-9',
268+
createdAt: new Date(DATE + 2),
269+
creatorId: BRYN_ID,
270+
channelId: SPECTRUM_GENERAL_CHANNEL_ID,
271+
communityId: SPECTRUM_COMMUNITY_ID,
272+
isPublished: true,
273+
isLocked: true,
274+
type: 'DRAFTJS',
275+
content: {
276+
title: 'Yet another thread',
277+
body: JSON.stringify(
278+
toJSON(fromPlainText('This is just another thread'))
279+
),
280+
},
281+
attachments: [],
282+
edits: [
283+
{
284+
timestamp: new Date(DATE + 2),
285+
content: {
286+
title: 'Yet another thread',
287+
body: JSON.stringify(
288+
toJSON(fromPlainText('This is just another thread'))
289+
),
290+
},
291+
},
292+
],
293+
modifiedAt: new Date(DATE + 2),
294+
lastActive: new Date(DATE + 2),
295+
},
296+
297+
{
298+
id: 'thread-10',
299+
createdAt: new Date(DATE + 2),
300+
creatorId: BRYN_ID,
301+
channelId: MODERATOR_CREATED_CHANNEL_ID,
302+
communityId: SPECTRUM_COMMUNITY_ID,
303+
isPublished: true,
304+
isLocked: false,
305+
type: 'DRAFTJS',
306+
content: {
307+
title: 'Yet another thread',
308+
body: JSON.stringify(
309+
toJSON(fromPlainText('This is just another thread'))
310+
),
311+
},
312+
attachments: [],
313+
edits: [
314+
{
315+
timestamp: new Date(DATE + 2),
316+
content: {
317+
title: 'Yet another thread',
318+
body: JSON.stringify(
319+
toJSON(fromPlainText('This is just another thread'))
320+
),
321+
},
322+
},
323+
],
324+
modifiedAt: new Date(DATE + 2),
325+
lastActive: new Date(DATE + 2),
326+
},
199327
];

api/migrations/seed/default/users.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ const {
77
QUIET_USER_ID,
88
BLOCKED_USER_ID,
99
PREVIOUS_MEMBER_USER_ID,
10+
CHANNEL_MODERATOR_USER_ID,
11+
COMMUNITY_MODERATOR_USER_ID,
1012
DATE,
1113
} = constants;
1214

@@ -98,4 +100,32 @@ module.exports = [
98100
createdAt: new Date(DATE),
99101
lastSeen: new Date(DATE),
100102
},
103+
{
104+
id: CHANNEL_MODERATOR_USER_ID,
105+
name: 'Channel moderator',
106+
description: 'I moderate all channels',
107+
website: '',
108+
username: 'channel-moderator-user',
109+
profilePhoto:
110+
'https://pbs.twimg.com/profile_images/848823167699230721/-9CbPtto_bigger.jpg',
111+
coverPhoto:
112+
'https://pbs.twimg.com/profile_banners/17106008/1491444958/1500x500',
113+
114+
createdAt: new Date(DATE),
115+
lastSeen: new Date(DATE),
116+
},
117+
{
118+
id: COMMUNITY_MODERATOR_USER_ID,
119+
name: 'Community moderator',
120+
description: 'I moderate all communities',
121+
website: '',
122+
username: 'community-moderator-user',
123+
profilePhoto:
124+
'https://pbs.twimg.com/profile_images/848823167699230721/-9CbPtto_bigger.jpg',
125+
coverPhoto:
126+
'https://pbs.twimg.com/profile_banners/17106008/1491444958/1500x500',
127+
128+
createdAt: new Date(DATE),
129+
lastSeen: new Date(DATE),
130+
},
101131
];

0 commit comments

Comments
 (0)