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:
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user