FIX: check permalinks for deleted topics

- allow to specify 410 vs 404 in Discourse::NotFound exception
- remove unused `permalink_redirect_or_not_found` which
- handle JS side links to topics via Discourse-Xhr-Redirect mechanism
This commit is contained in:
Sam
2018-08-09 15:05:12 +10:00
parent f7b4a2b3ba
commit ed4c0f256e
7 changed files with 88 additions and 26 deletions
@@ -29,6 +29,17 @@ export function handleLogoff(xhr) {
}
}
function handleRedirect(data) {
if (
data &&
data.getResponseHeader &&
data.getResponseHeader("Discourse-Xhr-Redirect")
) {
window.location.replace(data.responseText);
window.location.reload();
}
}
/**
Our own $.ajax method. Makes sure the .then method executes in an Ember runloop
for performance reasons. Also automatically adjusts the URL to support installs
@@ -76,6 +87,7 @@ export function ajax() {
}
args.success = (data, textStatus, xhr) => {
handleRedirect(data);
handleLogoff(xhr);
Ember.run(() => {