From e73c113e0d8250dee304478dcf6544ab1929722c Mon Sep 17 00:00:00 2001 From: Jeff Nelson Date: Fri, 25 Aug 2017 08:30:29 -0400 Subject: [PATCH 01/12] use mailgun since postmark has been deprecated --- app.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app.json b/app.json index 5faa23bc2..a2e75404b 100644 --- a/app.json +++ b/app.json @@ -14,8 +14,7 @@ "required": true }, "NODE_ENV": "production", - "TALK_SMTP_PORT": "2525", - "REWRITE_ENV": "TALK_PORT:PORT,TALK_MONGO_URL:MONGO_URI,TALK_REDIS_URL:REDIS_URL,TALK_SMTP_HOST:POSTMARK_SMTP_SERVER,TALK_SMTP_USERNAME:POSTMARK_API_TOKEN,TALK_SMTP_PASSWORD:POSTMARK_API_TOKEN", + "REWRITE_ENV": "TALK_PORT:PORT,TALK_MONGO_URL:MONGO_URI,TALK_REDIS_URL:REDIS_URL,TALK_SMTP_HOST:MAILGUN_SMTP_SERVER,TALK_SMTP_PORT:MAILGUN_SMTP_PORT,TALK_SMTP_USERNAME:MAILGUN_SMTP_LOGIN,TALK_SMTP_PASSWORD:MAILGUN_SMTP_PASSWORD", "NPM_CONFIG_PRODUCTION": "false" }, "addons": [{ @@ -25,8 +24,8 @@ "plan": "rediscloud:30", "as": "REDIS" }, { - "plan": "postmark:10k", - "as": "POSTMARK" + "plan": "mailgun:starter", + "as": "MAILGUN" }], "image": "heroku/nodejs", "success_url": "/admin/install" From faecd80543171e533807cd6247c8a9cf86e96585 Mon Sep 17 00:00:00 2001 From: Jeff Nelson Date: Fri, 25 Aug 2017 08:51:36 -0400 Subject: [PATCH 02/12] better handling for heroku dynamic port --- config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.js b/config.js index 4472af26e..f86f41f30 100644 --- a/config.js +++ b/config.js @@ -80,7 +80,7 @@ const CONFIG = { //------------------------------------------------------------------------------ // Port to bind to. - PORT: process.env.TALK_PORT || '3000', + PORT: process.env.TALK_PORT || || process.env.PORT || '3000', // The URL for this Talk Instance as viewable from the outside. ROOT_URL: process.env.TALK_ROOT_URL || null, From 4b7cc9ffcce37d8dbaee01df996047b05ee9e939 Mon Sep 17 00:00:00 2001 From: Jeff Nelson Date: Fri, 25 Aug 2017 08:55:26 -0400 Subject: [PATCH 03/12] whoops --- app.json | 2 +- config.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app.json b/app.json index a2e75404b..2316d1d1a 100644 --- a/app.json +++ b/app.json @@ -14,7 +14,7 @@ "required": true }, "NODE_ENV": "production", - "REWRITE_ENV": "TALK_PORT:PORT,TALK_MONGO_URL:MONGO_URI,TALK_REDIS_URL:REDIS_URL,TALK_SMTP_HOST:MAILGUN_SMTP_SERVER,TALK_SMTP_PORT:MAILGUN_SMTP_PORT,TALK_SMTP_USERNAME:MAILGUN_SMTP_LOGIN,TALK_SMTP_PASSWORD:MAILGUN_SMTP_PASSWORD", + "REWRITE_ENV": "TALK_MONGO_URL:MONGO_URI,TALK_REDIS_URL:REDIS_URL,TALK_SMTP_HOST:MAILGUN_SMTP_SERVER,TALK_SMTP_PORT:MAILGUN_SMTP_PORT,TALK_SMTP_USERNAME:MAILGUN_SMTP_LOGIN,TALK_SMTP_PASSWORD:MAILGUN_SMTP_PASSWORD", "NPM_CONFIG_PRODUCTION": "false" }, "addons": [{ diff --git a/config.js b/config.js index f86f41f30..faa911c83 100644 --- a/config.js +++ b/config.js @@ -80,7 +80,7 @@ const CONFIG = { //------------------------------------------------------------------------------ // Port to bind to. - PORT: process.env.TALK_PORT || || process.env.PORT || '3000', + PORT: process.env.TALK_PORT || process.env.PORT || '3000', // The URL for this Talk Instance as viewable from the outside. ROOT_URL: process.env.TALK_ROOT_URL || null, From 2f3d7c5329802af6d4d2c53eea2711eaf7645ed7 Mon Sep 17 00:00:00 2001 From: Jeff Nelson Date: Fri, 25 Aug 2017 09:17:51 -0400 Subject: [PATCH 04/12] set default root url --- app.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app.json b/app.json index 2316d1d1a..3c17023c4 100644 --- a/app.json +++ b/app.json @@ -13,6 +13,10 @@ "value": "", "required": true }, + "TALK_ROOT_URL": { + "value": "http://0.0.0.0", + "required": true + }, "NODE_ENV": "production", "REWRITE_ENV": "TALK_MONGO_URL:MONGO_URI,TALK_REDIS_URL:REDIS_URL,TALK_SMTP_HOST:MAILGUN_SMTP_SERVER,TALK_SMTP_PORT:MAILGUN_SMTP_PORT,TALK_SMTP_USERNAME:MAILGUN_SMTP_LOGIN,TALK_SMTP_PASSWORD:MAILGUN_SMTP_PASSWORD", "NPM_CONFIG_PRODUCTION": "false" From 28dafd3e07f73ed4029b6d20bca91d428cd2c9d8 Mon Sep 17 00:00:00 2001 From: Jeff Nelson Date: Fri, 25 Aug 2017 09:27:52 -0400 Subject: [PATCH 05/12] update --- app.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.json b/app.json index 3c17023c4..aefe25861 100644 --- a/app.json +++ b/app.json @@ -1,7 +1,7 @@ { "name": "The Coral Project: Talk", "env": { - "TALK_SESSION_SECRET": { + "TALK_JWT_SECRET": { "description": "The session secret", "generator": "secret" }, From 50caddee56d7d9c47368582c1a502add7aad9c27 Mon Sep 17 00:00:00 2001 From: Jeff Nelson Date: Fri, 25 Aug 2017 09:47:40 -0400 Subject: [PATCH 06/12] update --- app.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app.json b/app.json index aefe25861..b0db1dcde 100644 --- a/app.json +++ b/app.json @@ -5,6 +5,11 @@ "description": "The session secret", "generator": "secret" }, + "TALK_ROOT_URL": { + "description": "Please copy the App Name you choose above. If you did not choose one, please do so now and copy it here. Talk on Heroku will not work without this setting.", + "value":"https://.herokuapp.com", + "required": true + }, "TALK_FACEBOOK_APP_ID": { "value": "", "required": true @@ -13,10 +18,6 @@ "value": "", "required": true }, - "TALK_ROOT_URL": { - "value": "http://0.0.0.0", - "required": true - }, "NODE_ENV": "production", "REWRITE_ENV": "TALK_MONGO_URL:MONGO_URI,TALK_REDIS_URL:REDIS_URL,TALK_SMTP_HOST:MAILGUN_SMTP_SERVER,TALK_SMTP_PORT:MAILGUN_SMTP_PORT,TALK_SMTP_USERNAME:MAILGUN_SMTP_LOGIN,TALK_SMTP_PASSWORD:MAILGUN_SMTP_PASSWORD", "NPM_CONFIG_PRODUCTION": "false" From cc66f1b45953c3bff17dd7de5e1d3f9117206cc4 Mon Sep 17 00:00:00 2001 From: Jeff Nelson Date: Fri, 25 Aug 2017 09:47:59 -0400 Subject: [PATCH 07/12] update --- app.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.json b/app.json index b0db1dcde..6c85e3cc2 100644 --- a/app.json +++ b/app.json @@ -7,7 +7,7 @@ }, "TALK_ROOT_URL": { "description": "Please copy the App Name you choose above. If you did not choose one, please do so now and copy it here. Talk on Heroku will not work without this setting.", - "value":"https://.herokuapp.com", + "value":"https://.herokuapp.com", "required": true }, "TALK_FACEBOOK_APP_ID": { From 091d787e349ae32002b6d2d3d9dbc0a838c57019 Mon Sep 17 00:00:00 2001 From: Jeff Nelson Date: Fri, 25 Aug 2017 10:02:16 -0400 Subject: [PATCH 08/12] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a58ac7c74..d1bcf2956 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Talk [![CircleCI](https://circleci.com/gh/coralproject/talk.svg?style=svg)](https://circleci.com/gh/coralproject/talk) +[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/coralproject/talk/tree/feature/heroku-deploy&env[TALK_FACEBOOK_APP_ID]=ignore&env[TALK_FACEBOOK_APP_SECRET]=ignore) Online comments are broken. Our open-source Talk tool rethinks how moderation, comment display, and conversation function, creating the opportunity for safer, smarter discussions around your work. [Read more about Talk here.](https://coralproject.net/products/talk.html) From fe0c32898d2de2814213845ac30d82d566c65a26 Mon Sep 17 00:00:00 2001 From: Jeff Nelson Date: Fri, 25 Aug 2017 10:03:46 -0400 Subject: [PATCH 09/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d1bcf2956..4b12315e4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Talk [![CircleCI](https://circleci.com/gh/coralproject/talk.svg?style=svg)](https://circleci.com/gh/coralproject/talk) -[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/coralproject/talk/tree/feature/heroku-deploy&env[TALK_FACEBOOK_APP_ID]=ignore&env[TALK_FACEBOOK_APP_SECRET]=ignore) +[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://dashboard.heroku.com/new?template=https%3A%2F%2Fgithub.com%2Fcoralproject%2Ftalk%2Ftree%2Ffeature%2Fheroku-deploy&env[TALK_FACEBOOK_APP_ID]=ignore&env[TALK_FACEBOOK_APP_SECRET]=ignore) Online comments are broken. Our open-source Talk tool rethinks how moderation, comment display, and conversation function, creating the opportunity for safer, smarter discussions around your work. [Read more about Talk here.](https://coralproject.net/products/talk.html) From 7c9e2297dffea8c8f159a18048e054abf363219b Mon Sep 17 00:00:00 2001 From: Jeff Nelson Date: Mon, 28 Aug 2017 09:54:20 -0400 Subject: [PATCH 10/12] don't hardcode branch --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4b12315e4..4bec86d07 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Talk [![CircleCI](https://circleci.com/gh/coralproject/talk.svg?style=svg)](https://circleci.com/gh/coralproject/talk) -[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://dashboard.heroku.com/new?template=https%3A%2F%2Fgithub.com%2Fcoralproject%2Ftalk%2Ftree%2Ffeature%2Fheroku-deploy&env[TALK_FACEBOOK_APP_ID]=ignore&env[TALK_FACEBOOK_APP_SECRET]=ignore) +[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://dashboard.heroku.com/new?template=https%3A%2F%2Fgithub.com%2Fcoralproject%2Ftalk&env[TALK_FACEBOOK_APP_ID]=ignore&env[TALK_FACEBOOK_APP_SECRET]=ignore) Online comments are broken. Our open-source Talk tool rethinks how moderation, comment display, and conversation function, creating the opportunity for safer, smarter discussions around your work. [Read more about Talk here.](https://coralproject.net/products/talk.html) @@ -20,7 +20,7 @@ endpoint when the server is running with built assets. - Blog: https://blog.coralproject.net -- Community Guides for Journalism: https://guides.coralproject.net/ +- Community Guides for Journalism: https://guides.coralproject.net/ ## License From 12d66a49d049b0f8b2b47be3a299620a9aae3b6f Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Mon, 28 Aug 2017 12:17:01 -0300 Subject: [PATCH 11/12] Adding commentAuthorTags --- client/coral-embed-stream/src/components/Comment.js | 8 ++++++++ client/coral-embed-stream/src/containers/Comment.js | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/client/coral-embed-stream/src/components/Comment.js b/client/coral-embed-stream/src/components/Comment.js index 79dfb1b34..3eecc80ea 100644 --- a/client/coral-embed-stream/src/components/Comment.js +++ b/client/coral-embed-stream/src/components/Comment.js @@ -447,6 +447,14 @@ export default class Comment extends React.Component { {isStaff(comment.tags) ? Staff : null} + + { diff --git a/client/coral-embed-stream/src/containers/Comment.js b/client/coral-embed-stream/src/containers/Comment.js index e34218883..f955066aa 100644 --- a/client/coral-embed-stream/src/containers/Comment.js +++ b/client/coral-embed-stream/src/containers/Comment.js @@ -16,7 +16,8 @@ const slots = [ 'commentContent', 'commentReactions', 'commentAvatar', - 'commentAuthorName' + 'commentAuthorName', + 'commentAuthorTags' ]; /** From 38f98c7c4352a5f1ee9b872eb2877b8831b886de Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Mon, 28 Aug 2017 16:41:58 -0600 Subject: [PATCH 12/12] Added duplicated comments tests --- test/server/graph/queries/asset.js | 85 ++++++++++++++++++++++-------- 1 file changed, 62 insertions(+), 23 deletions(-) diff --git a/test/server/graph/queries/asset.js b/test/server/graph/queries/asset.js index 68270f9ba..4d96be74a 100644 --- a/test/server/graph/queries/asset.js +++ b/test/server/graph/queries/asset.js @@ -10,10 +10,13 @@ const CommentsService = require('../../../../services/comments'); const {expect} = require('chai'); describe('graph.queries.asset', () => { - let asset, users; + let assets, users, comments; beforeEach(async () => { await SettingsService.init(); - asset = await Asset.create({id: '1', url: 'https://example.com'}); + assets = await Asset.create([ + {id: '1', url: 'https://example.com/?id=1'}, + {id: '2', url: 'https://example.com/?id=2'} + ]); users = await UsersService.createLocalUsers([ { email: 'usernameA@example.com', @@ -31,17 +34,63 @@ describe('graph.queries.asset', () => { username: 'usernameC' } ]); + comments = await CommentsService.publicCreate([0, 1, 0, 1].map((idx) => ({ + author_id: users[idx].id, + asset_id: assets[idx].id, + body: `hello there! ${String(Math.random()).slice(2)}`, + }))); + }); + + it('will not show the same asset stream across multiple assets', async () => { + const context = new Context({user: users[0]}); + + const query = ` + fragment assetFragment on Asset { + comments(query: {limit: 2}) { + nodes { + id + } + hasNextPage + } + } + + query assetQuery($id: ID!, $otherID: ID!) { + asset(id: $id) { + ...assetFragment + } + otherAsset: asset(id: $otherID) { + ...assetFragment + } + } + `; + + let res = await graphql(schema, query, {}, context, {id: assets[0].id, otherID: assets[1].id}); + if (res.errors) { + console.error(res.errors); + } + expect(res.errors).is.empty; + + let {asset: {comments: asset}, otherAsset: {comments: otherAsset}} = res.data; + + expect(asset.nodes).to.have.length(2); + expect(asset.hasNextPage).to.be.false; + expect(asset.nodes[0]).to.have.property('id', comments[2].id); + expect(asset.nodes[1]).to.have.property('id', comments[0].id); + expect(otherAsset.nodes).to.have.length(2); + expect(otherAsset.hasNextPage).to.be.false; + expect(otherAsset.nodes[0]).to.have.property('id', comments[3].id); + expect(otherAsset.nodes[1]).to.have.property('id', comments[1].id); + + for (let node of asset.nodes) { + for (let otherNode of otherAsset.nodes) { + expect(node.id).to.not.equal(otherNode.id); + } + } }); it('can get comments edge', async () => { const context = new Context({user: users[0]}); - await CommentsService.publicCreate([1, 2].map(() => ({ - author_id: users[0].id, - asset_id: asset.id, - body: `hello there! ${String(Math.random()).slice(2)}`, - }))); - const assetCommentsQuery = ` query assetCommentsQuery($id: ID!) { asset(id: $id) { @@ -58,8 +107,7 @@ describe('graph.queries.asset', () => { } } `; - const res = await graphql(schema, assetCommentsQuery, {}, context, {id: asset.id}); - expect(res.errors).is.empty; + const res = await graphql(schema, assetCommentsQuery, {}, context, {id: assets[0].id}); const {nodes, startCursor, endCursor, hasNextPage} = res.data.asset.comments; expect(nodes.length).to.equal(2); expect(startCursor).to.equal(nodes[0].created_at); @@ -70,12 +118,6 @@ describe('graph.queries.asset', () => { it('can query comments edge to exclude comments ignored by user', async () => { const context = new Context({user: users[0]}); - await Promise.all(users.slice(1, 3).map((user) => CommentsService.publicCreate({ - author_id: user.id, - asset_id: asset.id, - body: `hello there! ${String(Math.random()).slice(2)}`, - }))); - // Add the second user to the list of ignored users. context.user.ignoresUsers.push(users[1].id); @@ -94,16 +136,13 @@ describe('graph.queries.asset', () => { { const res = await graphql(schema, query, {}, context, { - id: asset.id, - url: asset.url, + id: assets[0].id, + url: assets[0].url, excludeIgnored: true }); - if (res.errors && res.errors.length) { - console.error(res.errors); - } expect(res.errors).is.empty; - const nodes = res.data.asset.comments.nodes; - expect(nodes.length).to.equal(1); + const {nodes} = res.data.asset.comments; + expect(nodes.length).to.equal(2); } });