Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: use full slugPath to reload categories with permissions #65

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ export default DiscourseRoute.extend({
},

model() {
const category = this.modelFor("activityPub.category");
return Category.reloadCategoryWithPermissions(
{ slug: this.modelFor("activityPub.category").slug },
{ slug: Category.slugFor(category) },
this.store,
this.site
);
Expand Down
48 changes: 48 additions & 0 deletions test/javascripts/acceptance/activity-pub-discovery-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,54 @@ acceptance(
}
);

acceptance(
"Discourse Activity Pub | Discovery activitypub subcategory follows route with edit permission",
function (needs) {
needs.user();
needs.site({
activity_pub_enabled: true,
activity_pub_publishing_enabled: true,
});
needs.pretender((server, helper) => {
server.get("/c/feature/spec/find_by_slug.json", () => {
return helper.response(200, {
category: {
id: 26,
name: "spec",
slug: "spec",
can_edit: true,
activity_pub_ready: true,
activity_pub_actor: {
name: "Angus",
handle: "angus@mastodon.pavilion.tech",
},
},
});
});
const path = "/ap/category/26/follows.json";
server.get(path, () => helper.response({}));
});

test("with activity pub ready", async function (assert) {
const category = Category.findById(26);
category.setProperties({
activity_pub_ready: true,
activity_pub_actor: {
name: "Angus",
handle: "angus@mastodon.pavilion.tech",
},
});

await visit("/ap/category/26/follows");

assert.ok(
exists(".activity-pub-follows-container"),
"the activitypub follows route is visible"
);
});
}
);

acceptance(
"Discourse Activity Pub | Discovery activitypub category follows route with edit permission with followers",
function (needs) {
Expand Down