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

Commit 812a186

Browse files
authored
Merge pull request #2767 from withspectrum/2.2.4
2.2.4
2 parents 221b379 + ac39198 commit 812a186

File tree

164 files changed

+2906
-1226
lines changed

Some content is hidden

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

164 files changed

+2906
-1226
lines changed

LICENSE

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Copyright 2018 Space Program Inc.
2+
3+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4+
5+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6+
7+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8+
9+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10+
11+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Spectrum](./public/img/media.png)](https://spectrum.chat)
44

55
### Simple, powerful online communities.
6-
6+
77
</div>
88

99
This is the main monorepo codebase of [Spectrum](https://spectrum.chat). Every single line of code that's not packaged into a reusable library is in this repository.
@@ -16,7 +16,7 @@ It is difficult to grow, manage and measure the impact of online communities. Co
1616

1717
Spectrum aims to be the best platform to build any kind of community online by combining the best of web 2.0 forums and real-time chat apps. With best-in-class moderation tooling, a single platform for all your communities, threaded conversations by default, community health monitoring (and much more to come), we think that we will be able to help more people start and grow the best online communities.
1818

19-
> "[Spectrum] will take the place that Reddit used to have a long time ago for communities (especially tech) to freely share ideas and iteract. Except realtime and trolling-free."
19+
> "[Spectrum] will take the place that Reddit used to have a long time ago for communities (especially tech) to freely share ideas and interact. Except realtime and trolling-free."
2020
>
2121
> \- [Guillermo Rauch (@rauchg)](https://twitter.com/rauchg/status/930946768841228288)
2222
@@ -39,17 +39,17 @@ Spectrum has been under full-time development since March, 2017. See [the roadma
3939
- [First time setup](#first-time-setup)
4040
- [Running the app locally](#running-the-app-locally)
4141
- [Roadmap](https://github.com/withspectrum/spectrum/projects/19)
42-
- Technical
42+
- [Technical](docs/)
4343
- [Testing](docs/testing.md)
4444
- [Background Jobs](docs/backend/background-jobs.md)
4545
- [Deployment](docs/backend/deployment.md)
46-
- [GraphQL](docs/backend/api/)
46+
- [API](docs/backend/api/)
4747
- [Fragments](docs/backend/api/fragments.md)
4848
- [Pagination](docs/backend/api/pagination.md)
4949
- [Testing](docs/backend/api/testing.md)
5050
- [Tips and Tricks](docs/backend/api/tips-and-tricks.md)
5151

52-
## Contributing
52+
## Contributing
5353

5454
**We heartily welcome any and all contributions that match [our product roadmap](https://github.com/withspectrum/spectrum/projects/19) and engineering standards!**
5555

@@ -67,9 +67,9 @@ If you found a technical bug on Spectrum or have ideas for features we should im
6767

6868
#### Fixing a bug or implementing a new feature
6969

70-
If you find a bug on Spectrum and open a PR that fixes it we'll review it as soon as possible to ensure it matches our engineering standards. If you want implement a new feature, open an issue first to discuss what it'd look like and to ensure it fits in [our roadmap](https://github.com/withspectrum/spectrum/projects/19) and plans for the app.
70+
If you find a bug on Spectrum and open a PR that fixes it we'll review it as soon as possible to ensure it matches our engineering standards. If you want to implement a new feature, open an issue first to discuss what it'd look like and to ensure it fits in [our roadmap](https://github.com/withspectrum/spectrum/projects/19) and plans for the app.
7171

72-
If you want to contribute but are unsure to start, we have [a "good first issue" label](https://github.com/withspectrum/spectrum/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) which is applied to newcomer-friendly issues. Take a look at [the full list of good first issues](https://github.com/withspectrum/spectrum/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) and pick something you like!
72+
If you want to contribute but are unsure to start, we have [a "good first issue" label](https://github.com/withspectrum/spectrum/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) which is applied to newcomer-friendly issues. Take a look at [the full list of good first issues](https://github.com/withspectrum/spectrum/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) and pick something you like! There is also [an "open" channel in the Spectrum community on Spectrum](https://spectrum.chat/spectrum/open) (how meta), if you run into troubles while trying to contribute that is the best place to talk to us.
7373

7474
Want to fix a bug or implement an agreed-upon feature? Great, jump to the [local setup instructions](#first-time-setup)!
7575

@@ -225,7 +225,7 @@ yarn run dev:api
225225

226226
#### Develop the web UI
227227

228-
To develop the frontend and web UI run
228+
To develop the frontend and web UI run
229229

230230
```
231231
yarn run dev:web
@@ -239,12 +239,12 @@ To start the mobile apps run:
239239
yarn run dev:mobile
240240
```
241241

242-
And then open either the iOS simulator or the Android simulator with
242+
And then open either the iOS simulator or the Android simulator with
243243

244244
```sh
245-
yarn run open:ios
245+
yarn run open:ios
246246
# or
247-
yarn run open:android
247+
yarn run open:android
248248
```
249249

250250
Refer to [the Expo documentation on how to install the simulators](https://docs.expo.io/versions/v25.0.0/guides/debugging.html#using-a-simulator--emulator).
@@ -256,3 +256,7 @@ Refer to [the Expo documentation on how to install the simulators](https://docs.
256256
<img height="200px" src="public/img/connect.svg" />
257257
</div>
258258

259+
## License
260+
261+
BSD 3-Clause, see the [LICENSE](./LICENSE) file.
262+

api/models/message.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ export const getMediaMessagesForThread = (
104104
.table('messages')
105105
.getAll(threadId, { index: 'threadId' })
106106
.filter({ messageType: 'media' })
107+
.filter(db.row.hasFields('deletedAt').not())
107108
.run();
108109
};
109110

api/routes/auth/create-signin-routes.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import passport from 'passport';
1111
import { URL } from 'url';
1212
import isSpectrumUrl from '../../utils/is-spectrum-url';
13-
import { signCookie } from 'shared/cookie-utils';
13+
import { signCookie, getCookies } from 'shared/cookie-utils';
1414

1515
const IS_PROD = process.env.NODE_ENV === 'production';
1616
const FALLBACK_URL = IS_PROD
@@ -63,11 +63,13 @@ export const createSigninRoutes = (
6363
req.cookies.session &&
6464
req.cookies['session.sig']
6565
) {
66+
const cookies = getCookies(req.session.passport);
67+
6668
redirectUrl.searchParams.append(
6769
'accessToken',
6870
signCookie(
69-
`session=${req.cookies.session}; session.sig=${
70-
req.cookies['session.sig']
71+
`session=${cookies.session}; session.sig=${
72+
cookies['session.sig']
7173
}`
7274
)
7375
);

api/subscriptions/message.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ module.exports = {
5858
try {
5959
return addMessageListener({
6060
filter: message => {
61-
if (message.threadId === thread) {
61+
if (message.threadId === thread && user) {
6262
trackUserThreadLastSeenQueue.add({
6363
userId: user.id,
6464
threadId: message.threadId,

athena/index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@ import {
3737
PRIVATE_CHANNEL_REQUEST_SENT,
3838
PRIVATE_CHANNEL_REQUEST_APPROVED,
3939
SEND_PUSH_NOTIFICATIONS,
40+
TRACK_USER_LAST_SEEN,
4041
} from './queues/constants';
4142

4243
const PORT = process.env.PORT || 3003;
4344

44-
console.log('\n🛠 Athena, the processing worker, is starting...');
45+
debug('\n🛠 Athena, the processing worker, is starting...');
4546
debug('Logging with debug enabled!');
46-
console.log('');
47+
debug('');
4748

4849
const server = createWorker({
4950
[MESSAGE_NOTIFICATION]: processMessageNotification,
@@ -57,7 +58,7 @@ const server = createWorker({
5758
[COMMUNITY_INVITE_NOTIFICATION]: processCommunityInvite,
5859
[COMMUNITY_INVOICE_PAID_NOTIFICATION]: processCommunityInvoicePaid,
5960
[PRO_INVOICE_PAID_NOTIFICATION]: processProInvoicePaid,
60-
'track user thread last seen': trackUserThreadLastSeen,
61+
[TRACK_USER_LAST_SEEN]: trackUserThreadLastSeen,
6162
[PROCESS_ADMIN_TOXIC_MESSAGE]: processAdminMessageModeration,
6263
[PROCESS_ADMIN_TOXIC_THREAD]: processAdminThreadModeration,
6364
[PRIVATE_CHANNEL_REQUEST_SENT]: processUserRequestedJoinPrivateChannel,
@@ -67,7 +68,7 @@ const server = createWorker({
6768

6869
startNotificationsListener();
6970

70-
console.log(
71+
debug(
7172
`🗄 Queues open for business ${(process.env.NODE_ENV === 'production' &&
7273
// $FlowIssue
7374
`at ${process.env.COMPOSE_REDIS_URL}:${process.env.COMPOSE_REDIS_PORT}`) ||
@@ -76,7 +77,7 @@ console.log(
7677

7778
// $FlowIssue
7879
server.listen(PORT, 'localhost', () => {
79-
console.log(
80+
debug(
8081
`💉 Healthcheck server running at ${server.address().address}:${
8182
server.address().port
8283
}`

athena/queues/channel-notification.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,5 @@ export default async (job: Job<ChannelNotificationJobData>) => {
9191
debug('❌ Error in job:\n');
9292
debug(err);
9393
Raven.captureException(err);
94-
console.log(err);
9594
});
9695
};

athena/queues/community-invite.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ export default async (job: Job<CommunityInviteNotificationJobData>) => {
9191
sender,
9292
customMessage
9393
).catch(err => {
94+
debug(err);
9495
Raven.captureException(err);
95-
console.log(err);
9696
});
9797
} else {
9898
// the user exists on spectrum
@@ -142,7 +142,6 @@ export default async (job: Job<CommunityInviteNotificationJobData>) => {
142142
debug('❌ Error in job:\n');
143143
debug(err);
144144
Raven.captureException(err);
145-
console.log(err);
146145
});
147146
}
148147
};

athena/queues/community-invoice-paid.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,5 @@ export default async (job: Job<InvoiceJobData>) => {
7676
debug('❌ Error in job:\n');
7777
debug(err);
7878
Raven.captureException(err);
79-
console.log(err);
8079
});
8180
};

athena/queues/community-notification.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,5 @@ export default async (job: Job<CommunityNotificationJobData>) => {
7979
debug('❌ Error in job:\n');
8080
debug(err);
8181
Raven.captureException(err);
82-
console.log(err);
8382
}
8483
};

0 commit comments

Comments
 (0)