From 1d4d07d55efa4931975a003dc36de6e9731e7ce4 Mon Sep 17 00:00:00 2001 From: Max Stoiber Date: Thu, 9 May 2019 09:36:05 +0200 Subject: [PATCH 1/4] Use new database env variables --- now.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/now.json b/now.json index 25e168fe97..ccbb205144 100644 --- a/now.json +++ b/now.json @@ -9,11 +9,11 @@ "DEBUG": "shared:rethinkdb:db-query-cache", "S3_TOKEN": "@s3-token", "S3_SECRET": "@s3-secret", - "COMPOSE_RETHINKDB_PASSWORD": "@github-compose-rethinkdb-password", - "COMPOSE_RETHINKDB_URL": "@github-compose-rethinkdb-url", - "COMPOSE_RETHINKDB_PORT": "@github-compose-rethinkdb-port", - "BACKUP_RETHINKDB_URL": "@backup-compose-rethinkdb-url", - "BACKUP_RETHINKDB_PORT": "@backup-compose-rethinkdb-port", + "COMPOSE_RETHINKDB_PASSWORD": "@new-compose-rethinkdb-password", + "COMPOSE_RETHINKDB_URL": "@new-compose-rethinkdb-url", + "COMPOSE_RETHINKDB_PORT": "@new-compose-rethinkdb-port", + "BACKUP_RETHINKDB_URL": "@new-backup-compose-rethinkdb-url", + "BACKUP_RETHINKDB_PORT": "@new-backup-compose-rethinkdb-port", "AWS_RETHINKDB_PASSWORD": "@aws-rethinkdb-password", "AWS_RETHINKDB_URL": "@aws-rethinkdb-url", "AWS_RETHINKDB_PORT": "@aws-rethinkdb-port", From c5790c82e500d1c21caa0cc6658d70dd57b90b5a Mon Sep 17 00:00:00 2001 From: Brian Lovin Date: Mon, 13 May 2019 11:35:58 -0400 Subject: [PATCH 2/4] Remove domain sharding from imgix construction --- shared/imgix/sign.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/imgix/sign.js b/shared/imgix/sign.js index 932bfef359..ce3c42a773 100644 --- a/shared/imgix/sign.js +++ b/shared/imgix/sign.js @@ -36,7 +36,7 @@ const defaultOpts = { const signPrimary = (url: string, opts: Opts = defaultOpts): string => { const client = new ImgixClient({ - domains: ['spectrum.imgix.net'], + domains: 'spectrum.imgix.net', secureURLToken: process.env.IMGIX_SECURITY_KEY, }); return client.buildURL(url, opts); @@ -44,7 +44,7 @@ const signPrimary = (url: string, opts: Opts = defaultOpts): string => { const signProxy = (url: string, opts?: Opts = defaultOpts): string => { const client = new ImgixClient({ - domains: ['spectrum-proxy.imgix.net'], + domains: 'spectrum-proxy.imgix.net', secureURLToken: process.env.IMGIX_PROXY_SECURITY_KEY, }); return client.buildURL(url, opts); From 1647db3087e771d8537b202ffda2f078538ca68f Mon Sep 17 00:00:00 2001 From: Brian Lovin Date: Mon, 13 May 2019 11:40:31 -0400 Subject: [PATCH 3/4] Fix flow --- api/models/usersChannels.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/models/usersChannels.js b/api/models/usersChannels.js index ff7b4ed786..02fe489c48 100644 --- a/api/models/usersChannels.js +++ b/api/models/usersChannels.js @@ -452,7 +452,7 @@ const createMemberInDefaultChannels = (communityId: string, userId: string): Pro }; // prettier-ignore -const toggleUserChannelNotifications = async (userId: string, channelId: string, value: boolean): Promise => { +const toggleUserChannelNotifications = async (userId: string, channelId: string, value: boolean): Promise => { const event = value ? events.CHANNEL_NOTIFICATIONS_ENABLED : events.CHANNEL_NOTIFICATIONS_DISABLED trackQueue.add({ @@ -490,7 +490,7 @@ const toggleUserChannelNotifications = async (userId: string, channelId: string, return createMemberInChannel(channelId, userId, false) } - return + return null }; const removeUsersChannelMemberships = async (userId: string) => { From caef630ef7c38c8c2bfcecb3edbbd3dab8d092c7 Mon Sep 17 00:00:00 2001 From: Brian Lovin Date: Mon, 13 May 2019 12:33:42 -0400 Subject: [PATCH 4/4] Remove the private channel members migration because of test interference --- ...1006-remove-all-private-channel-members.js | 75 ------------------- 1 file changed, 75 deletions(-) delete mode 100644 api/migrations/20190501021006-remove-all-private-channel-members.js diff --git a/api/migrations/20190501021006-remove-all-private-channel-members.js b/api/migrations/20190501021006-remove-all-private-channel-members.js deleted file mode 100644 index 36766c1aa7..0000000000 --- a/api/migrations/20190501021006-remove-all-private-channel-members.js +++ /dev/null @@ -1,75 +0,0 @@ -exports.up = async function(r, conn) { - // get all private channels that haven't been deleted - const privateChannels = await r - .db('spectrum') - .table('channels') - .filter({ isPrivate: true }) - .filter(row => row.hasFields('deletedAt').not()) - .run(conn) - .then(cursor => cursor.toArray()); - - // for each channel, remove all members except the community owner - return Promise.all( - privateChannels.map(async channel => { - const community = await r - .db('spectrum') - .table('communities') - .get(channel.communityId) - .run(conn); - - // ensure that the community owner also owns the channel - // to account for situations where a moderator created the channel - const communityOwnerChannelRecord = await r - .db('spectrum') - .table('usersChannels') - .getAll([community.creatorId, channel.id], { - index: 'userIdAndChannelId', - }) - .run(conn) - .then(cursor => cursor.toArray()); - - if ( - !communityOwnerChannelRecord || - communityOwnerChannelRecord.length === 0 - ) { - await r - .db('spectrum') - .table('usersChannels') - .insert({ - channelId: channel.id, - userId: community.creatorId, - createdAt: new Date(), - isOwner: true, - isMember: true, - isModerator: false, - isBlocked: false, - isPending: false, - receiveNotifications: false, - }) - .run(conn); - } else { - await r - .db('spectrum') - .table('usersChannels') - .getAll([community.creatorId, channel.id], { - index: 'userIdAndChannelId', - }) - .update({ isOwner: true }) - .run(conn); - } - - return await r - .db('spectrum') - .table('usersChannels') - .getAll(channel.id, { index: 'channelId' }) - .filter({ isMember: true }) - .filter(row => row('userId').ne(community.creatorId)) - .update({ isMember: false }) - .run(conn); - }) - ); -}; - -exports.down = function(r, conn) { - return Promise.resolve(); -};