@@ -8,13 +8,11 @@ import { getOwner } from "discourse-common/lib/get-owner";
8
8
import { htmlSafe } from "@ember/template" ;
9
9
import getURL from "discourse-common/lib/get-url" ;
10
10
import SearchAdvancedOptions from "discourse/components/search-advanced-options" ;
11
- import TopicButtonAction , {
12
- addBulkButton ,
13
- } from "discourse/controllers/topic-bulk-actions" ;
14
11
import I18n from "I18n" ;
15
12
import { isEmpty } from "@ember/utils" ;
16
13
import { registerTopicFooterDropdown } from "discourse/lib/register-topic-footer-dropdown" ;
17
14
import RawHtml from "discourse/widgets/raw-html" ;
15
+ import BulkAssign from "../components/bulk-actions/assign-user" ;
18
16
19
17
const PLUGIN_ID = "discourse-assign" ;
20
18
@@ -912,30 +910,6 @@ export default {
912
910
}
913
911
} ,
914
912
} ) ;
915
-
916
- TopicButtonAction . reopen ( {
917
- actions : {
918
- showReAssign ( ) {
919
- const controller = getOwner ( this ) . lookup ( "controller:bulk-assign" ) ;
920
- controller . set ( "model" , { username : "" , note : "" } ) ;
921
- this . send ( "changeBulkTemplate" , "modal/bulk-assign" ) ;
922
- } ,
923
-
924
- unassignTopics ( ) {
925
- this . performAndRefresh ( { type : "unassign" } ) ;
926
- } ,
927
- } ,
928
- } ) ;
929
-
930
- addBulkButton ( "showReAssign" , "assign" , {
931
- icon : "user-plus" ,
932
- class : "btn-default assign-topics" ,
933
- } ) ;
934
-
935
- addBulkButton ( "unassignTopics" , "unassign" , {
936
- icon : "user-times" ,
937
- class : "btn-default unassign-topics" ,
938
- } ) ;
939
913
}
940
914
941
915
withPluginApi ( "0.13.0" , ( api ) => {
@@ -953,6 +927,58 @@ export default {
953
927
api . addGroupPostSmallActionCode ( "unassigned_group_from_post" ) ;
954
928
955
929
api . addUserSearchOption ( "assignableGroups" ) ;
930
+
931
+ if ( api . addBulkActionButton ) {
932
+ api . addBulkActionButton ( {
933
+ label : "topics.bulk.assign" ,
934
+ icon : "user-plus" ,
935
+ class : "btn-default assign-topics" ,
936
+ action ( { setComponent } ) {
937
+ setComponent ( BulkAssign ) ;
938
+ } ,
939
+ } ) ;
940
+
941
+ api . addBulkActionButton ( {
942
+ label : "topics.bulk.unassign" ,
943
+ icon : "user-times" ,
944
+ class : "btn-default unassign-topics" ,
945
+ action ( { performAndRefresh } ) {
946
+ performAndRefresh ( { type : "unassign" } ) ;
947
+ } ,
948
+ } ) ;
949
+ } else {
950
+ // TODO: Remove this path after core 3.1.0.beta7 is released
951
+ const {
952
+ default : TopicButtonAction ,
953
+ addBulkButton,
954
+ } = require ( "discourse/controllers/topic-bulk-actions" ) ;
955
+
956
+ TopicButtonAction . reopen ( {
957
+ actions : {
958
+ showReAssign ( ) {
959
+ const controller = getOwner ( this ) . lookup (
960
+ "controller:bulk-assign"
961
+ ) ;
962
+ controller . set ( "model" , { username : "" , note : "" } ) ;
963
+ this . send ( "changeBulkTemplate" , "modal/bulk-assign" ) ;
964
+ } ,
965
+
966
+ unassignTopics ( ) {
967
+ this . performAndRefresh ( { type : "unassign" } ) ;
968
+ } ,
969
+ } ,
970
+ } ) ;
971
+
972
+ addBulkButton ( "showReAssign" , "assign" , {
973
+ icon : "user-plus" ,
974
+ class : "btn-default assign-topics" ,
975
+ } ) ;
976
+
977
+ addBulkButton ( "unassignTopics" , "unassign" , {
978
+ icon : "user-times" ,
979
+ class : "btn-default unassign-topics" ,
980
+ } ) ;
981
+ }
956
982
} ) ;
957
983
} ,
958
984
} ;
0 commit comments