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

Commit 2cebc16

Browse files
authored
Merge pull request #3202 from withspectrum/2.4.2
2.4.2
2 parents 14f07a7 + ed2b251 commit 2cebc16

File tree

38 files changed

+450
-308
lines changed

38 files changed

+450
-308
lines changed

.circleci/config.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,16 @@ jobs:
136136
name: Deploy and alias Hyperion
137137
command: npx now-cd --alias "alpha=hyperion.alpha.spectrum.chat" --team spaceprogram
138138

139+
deploy_desktop:
140+
<<: *js_defaults
141+
docker:
142+
- image: circleci/node:8
143+
steps:
144+
- attach_workspace:
145+
at: ~/spectrum
146+
- run:
147+
name: Build and release desktop app
148+
command: yarn run release:desktop
139149

140150
# Run eslint, flow etc.
141151
test_static_js:
@@ -212,3 +222,10 @@ workflows:
212222
filters:
213223
branches:
214224
only: alpha
225+
- deploy_desktop:
226+
requires:
227+
- test_static_js
228+
- test_web
229+
filters:
230+
branches:
231+
only: production

api/mutations/community/updateAdministratorEmail.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default requireAuth(async (_: any, args: Input, ctx: GraphQLContext) => {
2020
const { id: communityId, email } = args.input;
2121
const { loaders, user } = ctx;
2222

23-
if (!isEmail(email)) {
23+
if (!email || !isEmail(email)) {
2424
return new UserError('Please enter a working email address');
2525
}
2626

api/mutations/message/addMessage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export default requireAuth(async (_: any, args: Input, ctx: GraphQLContext) => {
203203
// at this point we are only dealing with thread messages
204204
const thread = await loaders.thread.load(message.threadId);
205205

206-
if (thread.isDeleted) {
206+
if (!thread || thread.deletedAt) {
207207
trackQueue.add({
208208
userId: user.id,
209209
event: eventFailed,

athena/queues/private-channel-request-approved.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ export default async (job: Job<PrivateChannelRequestApprovedJobData>) => {
4545
const recipients = await getUsers([userId]);
4646

4747
// only get owners with emails
48-
const filteredRecipients = recipients.filter(user => isEmail(user.email));
48+
const filteredRecipients = recipients.filter(
49+
user => user && isEmail(user.email)
50+
);
4951

5052
// for each owner, create a notification for the app
5153
const usersNotificationPromises = filteredRecipients.map(recipient =>

athena/queues/private-channel-request-sent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export default async (job: Job<PrivateChannelRequestJobData>) => {
7575

7676
// only get owners + moderators with emails
7777
const filteredRecipients = recipientsWithUserData.filter(
78-
owner => owner.email && isEmail(owner.email)
78+
owner => owner && owner.email && isEmail(owner.email)
7979
);
8080

8181
// for each owner, create a notification for the app

athena/queues/private-community-request-approved.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ export default async (job: Job<PrivateCommunityRequestApprovedJobData>) => {
4242

4343
const community = await getCommunityById(communityId);
4444
const recipients = await getUsers([userId]);
45-
const filteredRecipients = recipients.filter(user => isEmail(user.email));
45+
const filteredRecipients = recipients.filter(
46+
user => user && isEmail(user.email)
47+
);
4648
const usersNotificationPromises = filteredRecipients.map(recipient =>
4749
storeUsersNotifications(updatedNotification.id, recipient.id)
4850
);

athena/queues/private-community-request-sent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default async (job: Job<PrivateCommunityRequestJobData>) => {
5959

6060
// only get owners + moderators with emails
6161
const filteredRecipients = recipientsWithUserData.filter(
62-
owner => owner.email && isEmail(owner.email)
62+
owner => owner && owner.email && isEmail(owner.email)
6363
);
6464

6565
// for each owner, create a notification for the app

athena/queues/send-slack-invitations.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@ const processJob = async (job: Job<SendSlackInvitationsJobData>) => {
6262
// filter out deleted members
6363
.filter(member => !member.deleted)
6464
// only save members with valid email
65-
.filter(member => member.profile.email && isEmail(member.profile.email))
65+
.filter(
66+
member =>
67+
member &&
68+
member.profile &&
69+
member.profile.email &&
70+
isEmail(member.profile.email)
71+
)
6672
// format output data
6773
.map(member => ({
6874
firstName: member.profile.first_name,

config-overrides.js

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -106,37 +106,19 @@ module.exports = function override(config, env) {
106106
});
107107
config.plugins.push(
108108
new OfflinePlugin({
109-
// Don't cache anything in dev
109+
appShell: '/index.html',
110110
caches: process.env.NODE_ENV === 'development' ? {} : 'all',
111-
updateStrategy: 'all', // Update all files on update, seems safer than trying to only update changed files since we didn't write the webpack config
112-
externals, // These files should be cached, but they're not emitted by webpack, so we gotta tell OfflinePlugin about 'em.
113-
excludes: ['**/*.map'], // Don't cache any source maps, they're huge and unnecessary for clients
114-
autoUpdate: true, // Automatically check for updates every hour
115-
rewrites: arg => arg,
116-
cacheMaps: [
117-
{
118-
match: url => {
119-
// Don't return the cached index.html for API requests or /auth pages
120-
if (url.pathname.indexOf('/api') === 0) return;
121-
if (url.pathname.indexOf('/auth') === 0) return;
122-
try {
123-
return new URL('/index.html', url);
124-
// TODO: Fix this properly instead of ignoring errors
125-
} catch (err) {
126-
return;
127-
}
128-
},
129-
requestType: ['navigate'],
130-
},
131-
],
111+
externals,
112+
autoUpdate: true,
132113
ServiceWorker: {
133-
entry: './public/push-sw.js', // Add the push notification ServiceWorker
134-
events: true, // Emit events from the ServiceWorker
114+
entry: './public/push-sw.js',
115+
events: true,
135116
prefetchRequest: {
136-
credentials: 'include', // Include credentials when fetching files, just to make sure we don't get into any issues
117+
mode: 'cors',
118+
credentials: 'include',
137119
},
138120
},
139-
AppCache: false, // Don't cache using AppCache, too buggy that thing
121+
AppCache: false,
140122
})
141123
);
142124
if (process.env.ANALYZE_BUNDLE === 'true') {

desktop/README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
# Desktop
22

3-
**This folder contains all sources used to build spectrum desktop application.**
4-
5-
The project uses [Electron](https://electronjs.org/) to build cross platform desktop apps with JavaScript, HTML, and CSS.
3+
This folder contains the [Electron](https://electronjs.org/)-based desktop app for Spectrum. Electron renders a web view, which renders the main `Spectrum.chat` webpage.
64

75
## Directory Structure
86

9-
* `release/` - the release build for each platform (mac, win, linux).
10-
* `resources/` - the resources folder (icons, images ...).
11-
* `src/` the source code of electron application.
12-
* `package.json` - dependencies & devdependencies.
13-
* `yarn.lock` - Yarn lockfile to get consistent installs across machine.
7+
* `release/` - the release build for each platform (mac, win, linux)
8+
* `resources/` - the resources folder (icons, images ...)
9+
* `src/` the source code of electron application
1410

1511
## Scripts
1612

0 commit comments

Comments
 (0)