-
-
diff --git a/plugins/talk-plugin-featured-comments/client/components/ModTag.css b/plugins/talk-plugin-featured-comments/client/components/ModTag.css
index c8ba1b6ba..683c16570 100644
--- a/plugins/talk-plugin-featured-comments/client/components/ModTag.css
+++ b/plugins/talk-plugin-featured-comments/client/components/ModTag.css
@@ -4,13 +4,14 @@
color: #696969;
background-color: white;
box-sizing: border-box;
- padding: 2px 8px;
+ padding: 0px 5px;
border-radius: 2px;
font-size: 12px;
- height: 28px;
+ height: 24px;
transition: background-color .2s cubic-bezier(.4,0,.2,1), color .2s cubic-bezier(.4,0,.2,1), border-color .2s cubic-bezier(.4,0,.2,1);
margin: 2px 0px;
letter-spacing: 0.4px;
+
}
.tag:hover {
@@ -39,4 +40,3 @@
font-size: 15px;
vertical-align: text-bottom;
}
-
\ No newline at end of file
diff --git a/plugins/talk-plugin-featured-comments/client/containers/ModSubscription.js b/plugins/talk-plugin-featured-comments/client/containers/ModSubscription.js
index 647c7ecfd..85e0d8fe2 100644
--- a/plugins/talk-plugin-featured-comments/client/containers/ModSubscription.js
+++ b/plugins/talk-plugin-featured-comments/client/containers/ModSubscription.js
@@ -2,7 +2,6 @@ import React from 'react';
import {gql} from 'react-apollo';
import {connect} from 'react-redux';
import Comment from 'coral-admin/src/routes/Moderation/containers/Comment';
-import {handleCommentChange} from 'coral-admin/src/graphql/utils';
import {getDefinitionName} from 'coral-framework/utils';
import truncate from 'lodash/truncate';
import t from 'coral-framework/services/i18n';
@@ -22,20 +21,14 @@ class ModSubscription extends React.Component {
assetId: this.props.data.variables.asset_id,
},
updateQuery: (prev, {subscriptionData: {data: {commentFeatured: {user, comment}}}}) => {
- const sort = this.props.data.variables.sort;
- const text = this.props.user.id === user.id
- ? {}
+ const notify = this.props.user.id === user.id
+ ? ''
: t(
'talk-plugin-featured-comments.notify_featured',
user.username,
prepareNotificationText(comment.body),
);
- const notify = {
- activeQueue: this.props.activeTab,
- text,
- anyQueue: true,
- };
- return handleCommentChange(prev, comment, sort, notify);
+ return this.props.handleCommentChange(prev, comment, notify);
},
},
{
@@ -44,20 +37,14 @@ class ModSubscription extends React.Component {
assetId: this.props.data.variables.asset_id,
},
updateQuery: (prev, {subscriptionData: {data: {commentUnfeatured: {user, comment}}}}) => {
- const sort = this.props.data.variables.sort;
- const text = this.props.user.id === user.id
- ? {}
+ const notify = this.props.user.id === user.id
+ ? ''
: t(
'talk-plugin-featured-comments.notify_unfeatured',
user.username,
prepareNotificationText(comment.body),
);
- const notify = {
- activeQueue: this.props.activeTab,
- text,
- anyQueue: true,
- };
- return handleCommentChange(prev, comment, sort, notify);
+ return this.props.handleCommentChange(prev, comment, notify);
}
},
];
diff --git a/plugins/talk-plugin-featured-comments/client/index.js b/plugins/talk-plugin-featured-comments/client/index.js
index 82cba8b91..ad10f87ca 100644
--- a/plugins/talk-plugin-featured-comments/client/index.js
+++ b/plugins/talk-plugin-featured-comments/client/index.js
@@ -26,6 +26,9 @@ export default {
IgnoreUser: ({variables}) => ({
updateQueries: {
CoralEmbedStream_Embed: (previous) => {
+ if (!previous.asset.featuredComments) {
+ return previous;
+ }
const ignoredUserId = variables.id;
const newNodes = previous.asset.featuredComments.nodes.filter((n) => n.user.id !== ignoredUserId);
const removedCount = previous.asset.featuredComments.nodes.length - newNodes.length;
diff --git a/plugins/talk-plugin-offtopic/client/components/OffTopicFilter.js b/plugins/talk-plugin-offtopic/client/components/OffTopicFilter.js
index 171bafeb2..426dea29a 100644
--- a/plugins/talk-plugin-offtopic/client/components/OffTopicFilter.js
+++ b/plugins/talk-plugin-offtopic/client/components/OffTopicFilter.js
@@ -16,7 +16,6 @@ export default class OffTopicFilter extends React.Component {
this.props.removeCommentClassName(idx);
this.props.toggleCheckbox();
}
- this.props.closeViewingOptions();
}
render() {
diff --git a/plugins/talk-plugin-offtopic/client/containers/OffTopicFilter.js b/plugins/talk-plugin-offtopic/client/containers/OffTopicFilter.js
index 9548b764e..7eab8c526 100644
--- a/plugins/talk-plugin-offtopic/client/containers/OffTopicFilter.js
+++ b/plugins/talk-plugin-offtopic/client/containers/OffTopicFilter.js
@@ -3,9 +3,6 @@ import {bindActionCreators} from 'redux';
import {toggleCheckbox} from '../actions';
import {commentClassNamesSelector} from 'plugin-api/alpha/client/selectors';
import OffTopicFilter from '../components/OffTopicFilter';
-import {
- closeViewingOptions
-} from 'plugins/talk-plugin-viewing-options/client/actions';
import {
addCommentClassName,
removeCommentClassName
@@ -20,7 +17,6 @@ const mapDispatchToProps = (dispatch) =>
bindActionCreators(
{
toggleCheckbox,
- closeViewingOptions,
addCommentClassName,
removeCommentClassName
},
diff --git a/services/passport.js b/services/passport.js
index 409bb2279..14a2134ce 100644
--- a/services/passport.js
+++ b/services/passport.js
@@ -23,7 +23,8 @@ const {
JWT_ALG,
RECAPTCHA_SECRET,
RECAPTCHA_ENABLED,
- JWT_COOKIE_NAME,
+ JWT_SIGNING_COOKIE_NAME,
+ JWT_COOKIE_NAMES,
JWT_CLEAR_COOKIE_LOGOUT,
JWT_USER_ID_CLAIM,
} = require('../config');
@@ -53,7 +54,7 @@ const GenerateToken = (user) => {
const SetTokenForSafari = (req, res, token) => {
const browser = bowser._detect(req.headers['user-agent']);
if (browser.ios || browser.safari) {
- res.cookie(JWT_COOKIE_NAME, token, {
+ res.cookie(JWT_SIGNING_COOKIE_NAME, token, {
httpOnly: true,
secure: process.env.NODE_ENV === 'production',
expires: new Date(Date.now() + ms(JWT_EXPIRY))
@@ -169,7 +170,7 @@ const HandleLogout = (req, res, next) => {
// Only clear the cookie on logout if enabled.
if (JWT_CLEAR_COOKIE_LOGOUT) {
- res.clearCookie(JWT_COOKIE_NAME);
+ res.clearCookie(JWT_SIGNING_COOKIE_NAME);
}
res.status(204).end();
@@ -209,14 +210,20 @@ const CheckBlacklisted = async (jwt) => {
const JwtStrategy = require('passport-jwt').Strategy;
const ExtractJwt = require('passport-jwt').ExtractJwt;
-let cookieExtractor = function(req) {
- let token = null;
-
+let cookieExtractor = (req) => {
if (req && req.cookies) {
- token = req.cookies[JWT_COOKIE_NAME];
+
+ // Walk over all the cookie names in JWT_COOKIE_NAMES.
+ for (const cookieName of JWT_COOKIE_NAMES) {
+
+ // Check to see if that cookie is set.
+ if (cookieName in req.cookies && req.cookies[cookieName] !== null && req.cookies[cookieName].length > 0) {
+ return req.cookies[cookieName];
+ }
+ }
}
- return token;
+ return null;
};
// Override the JwtVerifier method on the JwtStrategy so we can pack the
diff --git a/services/tags.js b/services/tags.js
index fbe6b58ec..b0d0c4b96 100644
--- a/services/tags.js
+++ b/services/tags.js
@@ -205,8 +205,8 @@ class TagsService {
return updateModel(item_type, query, {
$pull: {
tags: {
- name: link.tag.name
- }
+ 'tag.name': link.tag.name,
+ },
}
});
}
diff --git a/test/server/services/tags.js b/test/server/services/tags.js
index 7cdad829e..1080563f0 100644
--- a/test/server/services/tags.js
+++ b/test/server/services/tags.js
@@ -27,7 +27,7 @@ describe('services.TagsService', () => {
const id = comment.id;
const name = 'BEST';
const assigned_by = user.id;
-
+
await TagsService.add(id, 'COMMENTS', {
tag: {
name
@@ -45,7 +45,7 @@ describe('services.TagsService', () => {
const id = comment.id;
const name = 'BEST';
const assigned_by = user.id;
-
+
await TagsService.add(id, 'COMMENTS', {
tag: {
name
@@ -103,5 +103,43 @@ describe('services.TagsService', () => {
expect(tags.length).to.equal(0);
}
});
+ it('removes a tag out of 2', async () => {
+ const id = comment.id;
+ const name = 'BEST';
+ const assigned_by = user.id;
+
+ await TagsService.add(id, 'COMMENTS', {
+ tag: {
+ name: 'ANOTHER'
+ },
+ assigned_by
+ });
+
+ await TagsService.add(id, 'COMMENTS', {
+ tag: {
+ name
+ },
+ assigned_by
+ });
+
+ {
+ const {tags} = await CommentsService.findById(id);
+ expect(tags.length).to.equal(2);
+ }
+
+ // ok now to remove it
+ await TagsService.remove(id, 'COMMENTS', {
+ tag: {
+ name
+ },
+ assigned_by
+ });
+
+ {
+ const {tags} = await CommentsService.findById(id);
+ expect(tags.length).to.equal(1);
+ expect(tags[0].tag.name).to.equal('ANOTHER');
+ }
+ });
});
});
diff --git a/yarn.lock b/yarn.lock
index 255dc7415..a5d73a756 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -162,6 +162,10 @@ ansi-escapes@^1.1.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e"
+ansi-escapes@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-2.0.0.tgz#5bae52be424878dd9783e8910e3fc2922e83c81b"
+
ansi-regex@^1.0.0, ansi-regex@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-1.1.1.tgz#41c847194646375e6a1a5d10c3ca054ef9fc980d"
@@ -170,10 +174,20 @@ ansi-regex@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
+ansi-regex@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998"
+
ansi-styles@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
+ansi-styles@^3.1.0:
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88"
+ dependencies:
+ color-convert "^1.9.0"
+
any-promise@^0.1.0, any-promise@~0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-0.1.0.tgz#830b680aa7e56f33451d4b049f3bd8044498ee27"
@@ -1498,6 +1512,14 @@ chalk@1.1.3, chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3:
strip-ansi "^3.0.0"
supports-color "^2.0.0"
+chalk@^2.0.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.1.0.tgz#ac5becf14fa21b99c6c92ca7a7d7cfd5b17e743e"
+ dependencies:
+ ansi-styles "^3.1.0"
+ escape-string-regexp "^1.0.5"
+ supports-color "^4.0.0"
+
change-emitter@^0.1.2:
version "0.1.6"
resolved "https://registry.yarnpkg.com/change-emitter/-/change-emitter-0.1.6.tgz#e8b2fe3d7f1ab7d69a32199aff91ea6931409515"
@@ -1727,7 +1749,7 @@ codemirror@*:
version "5.25.2"
resolved "https://registry.yarnpkg.com/codemirror/-/codemirror-5.25.2.tgz#8c77677ca9c9248d757d3a07ed1e89a8404850b7"
-color-convert@^1.3.0:
+color-convert@^1.3.0, color-convert@^1.9.0:
version "1.9.0"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.0.tgz#1accf97dd739b983bf994d56fec8f95853641b7a"
dependencies:
@@ -3053,10 +3075,12 @@ extend@^1.2.1:
version "1.3.0"
resolved "https://registry.yarnpkg.com/extend/-/extend-1.3.0.tgz#d1516fb0ff5624d2ebf9123ea1dac5a1994004f8"
-external-editor@^2.0.1:
- version "2.0.1"
- resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.0.1.tgz#4c597c6c88fa6410e41dbbaa7b1be2336aa31095"
+external-editor@^2.0.4:
+ version "2.0.4"
+ resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.0.4.tgz#1ed9199da9cbfe2ef2f7a31b2fde8b0d12368972"
dependencies:
+ iconv-lite "^0.4.17"
+ jschardet "^1.4.2"
tmp "^0.0.31"
extglob@^0.3.1:
@@ -3757,6 +3781,10 @@ has-flag@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa"
+has-flag@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51"
+
has-unicode@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9"
@@ -3972,6 +4000,10 @@ iconv-lite@0.4.15, iconv-lite@^0.4.5, iconv-lite@~0.4.13:
version "0.4.15"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.15.tgz#fe265a218ac6a57cfe854927e9d04c19825eddeb"
+iconv-lite@^0.4.17:
+ version "0.4.18"
+ resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.18.tgz#23d8656b16aae6742ac29732ea8f0336a4789cf2"
+
icss-replace-symbols@1.0.2, icss-replace-symbols@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/icss-replace-symbols/-/icss-replace-symbols-1.0.2.tgz#cb0b6054eb3af6edc9ab1d62d01933e2d4c8bfa5"
@@ -4103,22 +4135,23 @@ inquirer@0.8.2:
rx "^2.4.3"
through "^2.3.6"
-inquirer@^3.0.6:
- version "3.0.6"
- resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.0.6.tgz#e04aaa9d05b7a3cb9b0f407d04375f0447190347"
+inquirer@^3.2.1:
+ version "3.2.1"
+ resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.2.1.tgz#06ceb0f540f45ca548c17d6840959878265fa175"
dependencies:
- ansi-escapes "^1.1.0"
- chalk "^1.0.0"
+ ansi-escapes "^2.0.0"
+ chalk "^2.0.0"
cli-cursor "^2.1.0"
cli-width "^2.0.0"
- external-editor "^2.0.1"
+ external-editor "^2.0.4"
figures "^2.0.0"
lodash "^4.3.0"
mute-stream "0.0.7"
run-async "^2.2.0"
- rx "^4.1.0"
- string-width "^2.0.0"
- strip-ansi "^3.0.0"
+ rx-lite "^4.0.8"
+ rx-lite-aggregates "^4.0.8"
+ string-width "^2.1.0"
+ strip-ansi "^4.0.0"
through "^2.3.6"
interpret@^1.0.0:
@@ -4560,6 +4593,10 @@ jsbn@~0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
+jschardet@^1.4.2:
+ version "1.5.1"
+ resolved "https://registry.yarnpkg.com/jschardet/-/jschardet-1.5.1.tgz#c519f629f86b3a5bedba58a88d311309eec097f9"
+
jsdom@^7.0.2:
version "7.2.2"
resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-7.2.2.tgz#40b402770c2bda23469096bee91ab675e3b1fc6e"
@@ -7434,6 +7471,16 @@ run-async@^2.2.0:
dependencies:
is-promise "^2.1.0"
+rx-lite-aggregates@^4.0.8:
+ version "4.0.8"
+ resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be"
+ dependencies:
+ rx-lite "*"
+
+rx-lite@*, rx-lite@^4.0.8:
+ version "4.0.8"
+ resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444"
+
rx-lite@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102"
@@ -7442,10 +7489,6 @@ rx@^2.4.3:
version "2.5.3"
resolved "https://registry.yarnpkg.com/rx/-/rx-2.5.3.tgz#21adc7d80f02002af50dae97fd9dbf248755f566"
-rx@^4.1.0:
- version "4.1.0"
- resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782"
-
safe-buffer@^5.0.1, safe-buffer@~5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.0.1.tgz#d263ca54696cd8a306b5ca6551e92de57918fbe7"
@@ -7833,6 +7876,13 @@ string-width@^2.0.0:
is-fullwidth-code-point "^2.0.0"
strip-ansi "^3.0.0"
+string-width@^2.1.0:
+ version "2.1.1"
+ resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e"
+ dependencies:
+ is-fullwidth-code-point "^2.0.0"
+ strip-ansi "^4.0.0"
+
string.prototype.codepointat@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/string.prototype.codepointat/-/string.prototype.codepointat-0.2.0.tgz#6b26e9bd3afcaa7be3b4269b526de1b82000ac78"
@@ -7871,6 +7921,12 @@ strip-ansi@^3.0.0, strip-ansi@^3.0.1:
dependencies:
ansi-regex "^2.0.0"
+strip-ansi@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f"
+ dependencies:
+ ansi-regex "^3.0.0"
+
strip-bom@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e"
@@ -7961,6 +8017,12 @@ supports-color@^3.1.2, supports-color@^3.2.3:
dependencies:
has-flag "^1.0.0"
+supports-color@^4.0.0:
+ version "4.2.1"
+ resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.2.1.tgz#65a4bb2631e90e02420dba5554c375a4754bb836"
+ dependencies:
+ has-flag "^2.0.0"
+
svgo@^0.7.0:
version "0.7.2"
resolved "https://registry.yarnpkg.com/svgo/-/svgo-0.7.2.tgz#9f5772413952135c6fefbf40afe6a4faa88b4bb5"