FIX: update report url to work with subfolder installs (#255)

This change includes the Discourse base url to allow for subfolder installs, it will also fix another potential issue where reports are sent via email (since we use the email_group_user component) that would require the base_url to know which domain to point to.
This commit is contained in:
David Battersby 2023-07-31 10:14:12 +08:00 committed by GitHub
parent c4adaa4da2
commit e4f8d3924a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -66,7 +66,7 @@ module ::DiscourseDataExplorer
pm["target_usernames"] = Array(username) pm["target_usernames"] = Array(username)
pm["raw"] = "Hi #{username}, your data explorer report is ready.\n\n" + pm["raw"] = "Hi #{username}, your data explorer report is ready.\n\n" +
"Query Name:\n#{query.name}\n\nHere are the results:\n#{table}\n\n" + "Query Name:\n#{query.name}\n\nHere are the results:\n#{table}\n\n" +
"<a href='/admin/plugins/explorer?id=#{query.id}'>View query in Data Explorer</a>\n\n" + "<a href='#{Discourse.base_url}/admin/plugins/explorer?id=#{query.id}'>View query in Data Explorer</a>\n\n" +
"Report created at #{Time.zone.now.strftime("%Y-%m-%d at %H:%M:%S")} (#{Time.zone.name})" "Report created at #{Time.zone.now.strftime("%Y-%m-%d at %H:%M:%S")} (#{Time.zone.name})"
pms << pm pms << pm
end end

View File

@ -48,7 +48,7 @@ describe DiscourseDataExplorer::ReportGenerator do
"raw" => "raw" =>
"Hi #{user.username}, your data explorer report is ready.\n\n" + "Hi #{user.username}, your data explorer report is ready.\n\n" +
"Query Name:\n#{query.name}\n\nHere are the results:\nle table\n\n" + "Query Name:\n#{query.name}\n\nHere are the results:\nle table\n\n" +
"<a href='/admin/plugins/explorer?id=#{query.id}'>View query in Data Explorer</a>\n\n" + "<a href='#{Discourse.base_url}/admin/plugins/explorer?id=#{query.id}'>View query in Data Explorer</a>\n\n" +
"Report created at #{Time.zone.now.strftime("%Y-%m-%d at %H:%M:%S")} (#{Time.zone.name})", "Report created at #{Time.zone.now.strftime("%Y-%m-%d at %H:%M:%S")} (#{Time.zone.name})",
}, },
], ],