omppatil
(Om Patil)
9 يناير 2024، 1:37م
1
Hi!,
How can we add a button to the review post and topic queue modal and reviewable actions in for that button in a Discourse plugin?I would appreciate some help with adding a button to the review post and topic queue modal and implementing its action in the plugin.
إعجاب واحد (1)
There’s an API to add actions and modals to reviewable items here:
/**
* Adds additional params to be sent to the reviewable/:id/perform/:action
* endpoint for a given reviewable type. This is so plugins can provide more
* complex reviewable actions that may depend on a custom modal.
*
* This is copied from the reviewable model instance when performing an action
* on the ReviewableItem component.
*
* ```
* api.addPluginReviewableParam("ReviewablePluginType", "some_param");
* ```
**/
addPluginReviewableParam(reviewableType, param) {
addPluginReviewableParam(reviewableType, param);
}
/**
* Registers a mapping between a JavaScript modal component class and a server-side reviewable
* action, which is registered via `actions.add` and `build_actions`.
*
This file has been truncated. show original
These are used in the category experts plugin, if you’re looking for an example:
allowingCategoryExpertEndorsements: and(
"custom_fields.category_expert_group_ids",
"custom_fields.category_accepting_endorsements"
),
allowingCategoryExpertQuestions: and(
"custom_fields.category_expert_group_ids",
"custom_fields.category_accepting_questions"
),
});
api.addPluginReviewableParam(
"ReviewableCategoryExpertSuggestion",
"group_id"
);
api.registerReviewableActionModal(
"approve_category_expert",
ExpertGroupChooserModal
);
});
},
3 إعجابات
omppatil
(Om Patil)
11 يناير 2024، 4:42ص
3
So, which one of these functions is used to add a button to the review queue approval modal: addPluginReviewableParam
or registerReviewableActionModal
? Please guide me through it.