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
+1
View File
@@ -6,6 +6,7 @@ import { capitalize } from 'coral-framework/helpers/strings';
import assignWith from 'lodash/assignWith';
import mapValues from 'lodash/mapValues';
export * from 'coral-framework/helpers/strings';
export * from './url';
export const getTotalActionCount = (type, comment) => {
return comment.action_summaries
+9
View File
@@ -1,3 +1,5 @@
import parse from 'url-parse';
export function buildUrl(
{ protocol, hostname, port, pathname, search, hash } = window.location
) {
@@ -10,3 +12,10 @@ export function buildUrl(
port ? `:${port}` : ''
}${pathname}${search}${hash}`;
}
export function buildCommentURL(assetURL, commentID) {
const u = parse(assetURL, true);
u.query.commentId = commentID;
u.set('query', u.query);
return u.href;
}