Skip to content

Commit

Permalink
fix notification dropdown links (#2280)
Browse files Browse the repository at this point in the history
* update Router to adjust when shop URL is in provided data

* update notification onClick to open dashboard panel when needed

* re-add markOneAsRead
  • Loading branch information
kieckhafer authored and mikemurray committed May 16, 2017
1 parent f4f7f61 commit 650679b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
18 changes: 12 additions & 6 deletions imports/plugins/core/router/lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,18 @@ Router.pathFor = (path, options = {}) => {


Router.go = (path, params, query) => {
const actualPath = Router.pathFor(path, {
hash: {
...params,
query
}
});
let actualPath;

if (typeof path === "string" && path.startsWith("/")) {
actualPath = path;
} else {
actualPath = Router.pathFor(path, {
hash: {
...params,
query
}
});
}

if (window) {
history.push(actualPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ class NotificationDropdown extends Component {
}

handleClick(notify) {
if (notify.type === "forAdmin") {
const actionViewData = Reaction.Apps({
name: "reaction-orders",
provides: "dashboard"
});
Reaction.showActionView(actionViewData);
} else {
Reaction.Router.go(notify.url);
}

const { markOneAsRead } = this.props;
return markOneAsRead(notify._id);
}
Expand Down Expand Up @@ -61,7 +71,7 @@ class NotificationDropdown extends Component {
const i18n = `notifications.messages.${notify.type}`;
return (
<li className={read} key={key}>
<a href={notify.url} onClick={() => {
<a onClick={() => {
this.handleClick(notify);
}}
>
Expand Down

0 comments on commit 650679b

Please sign in to comment.