omppatil
(Om Patil)
Janeiro 9, 2024, 1:37pm
1
Olá!
Como podemos adicionar um botão à modal da fila de posts e tópicos de revisão e às ações revisáveis para esse botão em um plugin do Discourse? Agradeceria alguma ajuda para adicionar um botão à modal da fila de posts e tópicos de revisão e implementar sua ação no plugin.
1 curtida
Existe uma API para adicionar ações e modais a itens revisáveis aqui:
/**
* 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
Eles são usados no plugin de especialistas de categoria, se você estiver procurando por um exemplo:
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 curtidas
omppatil
(Om Patil)
Janeiro 11, 2024, 4:42am
3
Então, qual dessas funções é usada para adicionar um botão à modal de aprovação da fila de revisão: addPluginReviewableParam ou registerReviewableActionModal? Por favor, me guie.