From 4875fe1c3ea3865f4f37fe71fc8358c8c6341a07 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 10 May 2016 10:42:16 -0400 Subject: [PATCH] FIX: Logo links to a different domain were broken --- app/assets/javascripts/discourse/lib/url.js.es6 | 4 +--- app/assets/javascripts/discourse/widgets/home-logo.js.es6 | 6 ++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/lib/url.js.es6 b/app/assets/javascripts/discourse/lib/url.js.es6 index 50ef5e45f..93e1ca731 100644 --- a/app/assets/javascripts/discourse/lib/url.js.es6 +++ b/app/assets/javascripts/discourse/lib/url.js.es6 @@ -139,9 +139,7 @@ const DiscourseURL = Ember.Object.extend({ } } - rewrites.forEach(function(rw) { - path = path.replace(rw.regexp, rw.replacement); - }); + rewrites.forEach(rw => path = path.replace(rw.regexp, rw.replacement)); if (this.navigatedToPost(oldPath, path)) { return; } // Schedule a DOM cleanup event diff --git a/app/assets/javascripts/discourse/widgets/home-logo.js.es6 b/app/assets/javascripts/discourse/widgets/home-logo.js.es6 index 31aea3d6e..dc52db7cb 100644 --- a/app/assets/javascripts/discourse/widgets/home-logo.js.es6 +++ b/app/assets/javascripts/discourse/widgets/home-logo.js.es6 @@ -48,7 +48,13 @@ export default createWidget('home-logo', { click(e) { if (wantsNewWindow(e)) { return false; } + e.preventDefault(); + const a = $(e.target).closest('a')[0]; + if (a && a.host !== document.location.host) { + document.location = a.href; + } + DiscourseURL.routeTo(this.href()); return false; }