Skip to content

A platform for community discussion. Free, open, simple.

DEV: New plugin outlets around 'add group' and group permissions (#37151)

Roman Rizzib8c8f2674760
diff --git a/frontend/discourse/admin/components/edit-category-security.gjs b/frontend/discourse/admin/components/edit-category-security.gjs
index 31537d442dc..f3e39f16cbb 100644
--- a/frontend/discourse/admin/components/edit-category-security.gjs
+++ b/frontend/discourse/admin/components/edit-category-security.gjs
@@ -108,19 +108,29 @@ export default class EditCategorySecurity extends buildCategoryPanel(
{{/unless}}
{{#if this.category.availableGroups}}
- <div class="add-group">
- <span class="group-name">
- <ComboBox
- @content={{this.category.availableGroups}}
- @onChange={{this.onSelectGroup}}
- @value={{null}}
- @valueProperty={{null}}
- @nameProperty={{null}}
- @options={{hash none="category.security_add_group"}}
- class="available-groups"
- />
- </span>
- </div>
+ <PluginOutlet
+ @name="category-security-permissions-add-group"
+ @outletArgs={{lazyHash
+ category=this.category
+ availableGroups=this.category.availableGroups
+ onSelectGroup=this.onSelectGroup
+ }}
+ @defaultGlimmer={{true}}
+ >
+ <div class="add-group">
+ <span class="group-name">
+ <ComboBox
+ @content={{this.category.availableGroups}}
+ @onChange={{this.onSelectGroup}}
+ @value={{null}}
+ @valueProperty={{null}}
+ @nameProperty={{null}}
+ @options={{hash none="category.security_add_group"}}
+ class="available-groups"
+ />
+ </span>
+ </div>
+ </PluginOutlet>
{{/if}}
</div>
diff --git a/frontend/discourse/app/components/category-permission-row.gjs b/frontend/discourse/app/components/category-permission-row.gjs
index 7a10e1ad15d..5d39269dcfd 100644
--- a/frontend/discourse/app/components/category-permission-row.gjs
+++ b/frontend/discourse/app/components/category-permission-row.gjs
@@ -1,7 +1,9 @@
import Component from "@glimmer/component";
import { action } from "@ember/object";
import DButton from "discourse/components/d-button";
+import PluginOutlet from "discourse/components/plugin-outlet";
import concatClass from "discourse/helpers/concat-class";
+import lazyHash from "discourse/helpers/lazy-hash";
import { AUTO_GROUPS } from "discourse/lib/constants";
import getURL from "discourse/lib/get-url";
import PermissionType from "discourse/models/permission-type";
@@ -136,30 +138,54 @@ export default class CategoryPermissionRow extends Component {
<span class="options actionable">
<DButton @icon="square-check" @disabled={{true}} class="btn-flat see" />
- <DButton
- @icon={{this.canReplyIcon}}
- @action={{this.setPermissionReply}}
- @translatedTitle={{this.replyTooltip}}
- @disabled={{this.replyDisabled}}
- class={{concatClass
- "btn btn-flat reply-toggle"
- this.replyGrantedClass
+ <PluginOutlet
+ @name="category-security-permissions-row-actions"
+ @outletArgs={{lazyHash
+ groupName=@groupName
+ groupId=@groupId
+ category=@category
+ canReplyIcon=this.canReplyIcon
+ canCreateIcon=this.canCreateIcon
+ replyTooltip=this.replyTooltip
+ createTooltip=this.createTooltip
+ replyDisabled=this.replyDisabled
+ createDisabled=this.createDisabled
+ replyGrantedClass=this.replyGrantedClass
+ createGrantedClass=this.createGrantedClass
+ setPermissionReply=this.setPermissionReply
+ setPermissionFull=this.setPermissionFull
+ removeRow=this.removeRow
}}
- />
-
- <DButton
- @icon={{this.canCreateIcon}}
- @action={{this.setPermissionFull}}
- @translatedTitle={{this.createTooltip}}
- @disabled={{this.createDisabled}}
- class={{concatClass "btn-flat create-toggle" this.createGrantedClass}}
- />
-
- <DButton
- class="remove-permission btn-flat"
- @action={{this.removeRow}}
- @icon="trash-can"
- />
+ @defaultGlimmer={{true}}
+ >
+ <DButton
+ @icon={{this.canReplyIcon}}
+ @action={{this.setPermissionReply}}
+ @translatedTitle={{this.replyTooltip}}
+ @disabled={{this.replyDisabled}}
+ class={{concatClass
+ "btn btn-flat reply-toggle"
+ this.replyGrantedClass
+ }}
+ />
+
+ <DButton
+ @icon={{this.canCreateIcon}}
+ @action={{this.setPermissionFull}}
+ @translatedTitle={{this.createTooltip}}
+ @disabled={{this.createDisabled}}
+ class={{concatClass
+ "btn-flat create-toggle"
+ this.createGrantedClass
+ }}
+ />
+
+ <DButton
+ class="remove-permission btn-flat"
+ @action={{this.removeRow}}
+ @icon="trash-can"
+ />
+ </PluginOutlet>
</span>
</div>
</template>