FEATURE: Category Reviewable by Group
Allow a group to review content in a particular category.
This commit is contained in:
@@ -2,6 +2,7 @@ import { setting } from "discourse/lib/computed";
|
||||
import { buildCategoryPanel } from "discourse/components/edit-category-panel";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { searchPriorities } from "discourse/components/concerns/category_search_priorities";
|
||||
import Group from "discourse/models/group";
|
||||
|
||||
const categorySortCriteria = [];
|
||||
export function addCategorySortCriteria(criteria) {
|
||||
@@ -41,6 +42,10 @@ export default buildCategoryPanel("settings", {
|
||||
];
|
||||
},
|
||||
|
||||
groupFinder(term) {
|
||||
return Group.findAll({ term, ignore_automatic: true });
|
||||
},
|
||||
|
||||
@computed
|
||||
availableViews() {
|
||||
return [
|
||||
|
||||
@@ -131,7 +131,8 @@ const Category = RestModel.extend({
|
||||
navigate_to_first_post_after_read: this.get(
|
||||
"navigate_to_first_post_after_read"
|
||||
),
|
||||
search_priority: this.get("search_priority")
|
||||
search_priority: this.get("search_priority"),
|
||||
reviewable_by_group_name: this.get("reviewable_by_group_name")
|
||||
},
|
||||
type: id ? "PUT" : "POST"
|
||||
});
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
{{i18n "category.num_featured_topics"}}
|
||||
{{/if}}
|
||||
</label>
|
||||
{{text-field value=category.num_featured_topics id="category-number-featured-topics" type="number"}}
|
||||
{{text-field value=category.num_featured_topics id="category-number-featured-topics" type="number"}}
|
||||
</section>
|
||||
|
||||
<section class="field">
|
||||
@@ -85,6 +85,19 @@
|
||||
|
||||
<h3>{{i18n 'category.settings_sections.moderation'}}</h3>
|
||||
|
||||
{{#if siteSettings.enable_category_group_review}}
|
||||
<section class="field">
|
||||
<label for="reviewable-by-group">
|
||||
{{i18n 'category.reviewable_by_group'}}
|
||||
</label>
|
||||
{{group-selector
|
||||
groupFinder=groupFinder
|
||||
single="true"
|
||||
groupNames=category.reviewable_by_group_name
|
||||
placeholderKey="category.review_group_name"}}
|
||||
</section>
|
||||
{{/if}}
|
||||
|
||||
<section class="field">
|
||||
<label>
|
||||
{{input type="checkbox" checked=category.custom_fields.require_topic_approval}}
|
||||
@@ -104,7 +117,7 @@
|
||||
<label for="topic-auto-close">
|
||||
{{i18n 'topic.auto_close.label'}}
|
||||
</label>
|
||||
{{text-field value=category.auto_close_hours id="topic-auto-close" type="number"}}
|
||||
{{text-field value=category.auto_close_hours id="topic-auto-close" type="number"}}
|
||||
<label>
|
||||
{{input type="checkbox" checked=category.auto_close_based_on_last_post}}
|
||||
{{i18n 'topic.auto_close.based_on_last_post'}}
|
||||
@@ -117,7 +130,7 @@
|
||||
<label for="category-minimum-tags">
|
||||
{{i18n 'category.minimum_required_tags'}}
|
||||
</label>
|
||||
{{text-field value=category.minimum_required_tags id="category-minimum-tags" type="number" min="0"}}
|
||||
{{text-field value=category.minimum_required_tags id="category-minimum-tags" type="number" min="0"}}
|
||||
</section>
|
||||
{{/if}}
|
||||
|
||||
@@ -125,7 +138,7 @@
|
||||
<label for="category-number-daily-bump">
|
||||
{{i18n "category.num_auto_bump_daily"}}
|
||||
</label>
|
||||
{{text-field value=category.custom_fields.num_auto_bump_daily id="category-number-daily-bump" type="number"}}
|
||||
{{text-field value=category.custom_fields.num_auto_bump_daily id="category-number-daily-bump" type="number"}}
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
@@ -57,14 +57,6 @@ export default createWidget("hamburger-menu", {
|
||||
}
|
||||
];
|
||||
|
||||
links.push({
|
||||
route: "review",
|
||||
className: "review",
|
||||
label: "review.title",
|
||||
badgeCount: "reviewable_count",
|
||||
badgeClass: "reviewables"
|
||||
});
|
||||
|
||||
if (currentUser.admin) {
|
||||
links.push({
|
||||
href: "/admin/site_settings/category/required",
|
||||
@@ -120,6 +112,20 @@ export default createWidget("hamburger-menu", {
|
||||
});
|
||||
}
|
||||
|
||||
// Staff always see the review link. Non-staff will see it if there are items to review
|
||||
if (
|
||||
this.currentUser &&
|
||||
(this.currentUser.staff || this.currentUser.reviewable_count)
|
||||
) {
|
||||
links.push({
|
||||
route: "review",
|
||||
className: "review",
|
||||
label: "review.title",
|
||||
badgeCount: "reviewable_count",
|
||||
badgeClass: "reviewables"
|
||||
});
|
||||
}
|
||||
|
||||
links.push({
|
||||
route: "discovery.top",
|
||||
className: "top-topics-link",
|
||||
|
||||
Reference in New Issue
Block a user