DEV: Use category ids in more URLs preferentially
This is a followup to 374534f0
This commit is contained in:
parent
bb69e8942e
commit
6e5fedb312
|
@ -107,7 +107,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||
slug: result.category.slug,
|
||||
id: result.category.id
|
||||
});
|
||||
DiscourseURL.redirectTo("/c/" + Category.slugFor(model));
|
||||
DiscourseURL.redirectTo(`/c/${Category.slugFor(model)}/${model.id}`);
|
||||
})
|
||||
.catch(error => {
|
||||
this.flash(extractError(error), "error");
|
||||
|
|
|
@ -79,7 +79,7 @@ function defaultCategoryLinkRenderer(category, opts) {
|
|||
let restricted = get(category, "read_restricted");
|
||||
let url = opts.url
|
||||
? opts.url
|
||||
: Discourse.getURL("/c/") + Category.slugFor(category);
|
||||
: Discourse.getURL(`/c/${Category.slugFor(category)}/${category.id}`);
|
||||
let href = opts.link === false ? "" : url;
|
||||
let tagName = opts.link === false || opts.link === "false" ? "span" : "a";
|
||||
let extraClasses = opts.extraClasses ? " " + opts.extraClasses : "";
|
||||
|
|
|
@ -67,7 +67,7 @@ const Category = RestModel.extend({
|
|||
|
||||
@discourseComputed("name")
|
||||
url() {
|
||||
return Discourse.getURL("/c/") + Category.slugFor(this);
|
||||
return Discourse.getURL(`/c/${Category.slugFor(this)}/${this.id}`);
|
||||
},
|
||||
|
||||
@discourseComputed
|
||||
|
|
|
@ -36,7 +36,7 @@ QUnit.test("Editing the category", async assert => {
|
|||
assert.ok(!visible(".d-modal"), "it closes the modal");
|
||||
assert.equal(
|
||||
DiscourseURL.redirectedTo,
|
||||
"/c/bug",
|
||||
"/c/bug/1",
|
||||
"it does one of the rare full page redirects"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -265,6 +265,7 @@ export default function() {
|
|||
|
||||
this.put("/categories/:category_id", request => {
|
||||
const category = parsePostData(request.requestBody);
|
||||
category.id = parseInt(request.params.category_id, 10);
|
||||
|
||||
if (category.email_in === "duplicate@example.com") {
|
||||
return response(422, { errors: ["duplicate email"] });
|
||||
|
|
Loading…
Reference in New Issue