I’ve just found a bug with combination of embedded comments and sub-folder installation:
‘Continue Discussion’ button and user links does not respect subfolder path.
But ‘Start Discussion’ button does respect subfolder path.
So I can only post once on embedded thread.
Here is the example: http://nsr24.com/football/game/705041
Discourse installed into: http://nsr24.com/social/en/
‘Start Discussion’ url is http://nsr24.com/social/en/t/bournemouth-west-ham-united-new-sports-rating/13
‘Continue Discussion’ url is just /t/bournemouth-west-ham-united-new-sports-rating/13
Discourse Version v1.5.0.beta8 +11 (Docker + subfolder official guide)
A quick and dirty work-around I can come up with is the following:
add this javascript to Discourse embedded code so the full Discourse code will be:
DiscourseEmbed = { discourseUrl: 'http://nsr24.com/social/en/',
discourseEmbedUrl: window.location.href };
(function() {
var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
// Temporary work around
setTimeout(function () {
$('#discourse-embed-frame').contents().find("a").each(function () {
var value = $(this).attr('href');
if (!value.startsWith('http')) {
$(this).attr('href', 'http://nsr24.com/social/en' + value);
}
})
}, 3000);
})();
Hope this help later in debugging this problem.
eviltrout
(Robin Ward)
January 12, 2016, 5:39pm
3
I think this commit should fix you up:
committed 05:38PM - 12 Jan 16 UTC
3 Likes
Thank you very much!
I apply this patch in my installation, and during application figured out two more places with similar problems:
You forget to fix /users/ links at app/views/embed/comments.html.erb lines 19 and 23
1 Like
I created a Pull Request, it should completely fix this issue.
master ← halfstrik:master
merged 03:20PM - 13 Jan 16 UTC
Fix URLs for post authors and their avatars in embedded comments so they work wh… en using subfolder installation.
See [this bug](https://meta.discourse.org/t/links-without-sub-folder-path-in-embedded-comments-continue-discussion-and-user-links/37836/3).
PS: I'm using `Discourse.base_url` here, may be it worth using `Discourse.base_uri` instead?
3 Likes