Improved Comment URL Handling (#1860)

* feat: replaces PR 1819

- fixes #1851

* fix: set query using new syntax

* review: fixes for missed framework changes

* fix: linting
This commit is contained in:
Wyatt Johnson
2018-09-11 22:44:23 +00:00
committed by GitHub
parent 13cc80bd35
commit c19d4a433a
14 changed files with 246 additions and 38 deletions
+6 -5
View File
@@ -1,4 +1,4 @@
import queryString from 'query-string';
import queryString from 'querystringify';
import pym from 'pym.js';
import EventEmitter from 'eventemitter2';
import { buildUrl } from 'coral-framework/utils/url';
@@ -94,12 +94,13 @@ export default class Stream {
// Remove the permalink comment id from the hash.
this.pym.onMessage('coral-view-all-comments', () => {
const search = queryString.stringify({
...queryString.parse(location.search),
commentId: undefined,
});
const query = queryString.parse(location.search);
// Remove the commentId url param.
delete query.commentId;
const search = queryString.stringify(query);
const url = buildUrl({ ...location, search });
// Change the url.