omppatil
(Om Patil)
1월 9, 2024, 1:37오후
1
안녕하세요!
Discourse 플러그인에서 검토 대기열(리뷰 포스트 및 토픽 큐) 모달에 버튼을 추가하고, 해당 버튼에 대한 실행 가능한 액션(reviewable actions)을 구현하는 방법은 무엇인가요? 플러그인에 버튼을 추가하고 그 액션을 구현하는 방법에 대해 도움을 주시면 감사하겠습니다.
여기에는 검토 가능한 항목에 액션과 모달을 추가하는 API가 있습니다:
/**
* 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
예시를 찾고 있다면 category experts 플러그인에서 이 API가 사용되고 있습니다:
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
);
});
},
omppatil
(Om Patil)
1월 11, 2024, 4:42오전
3
그렇다면, 리뷰 대기열 승인 모달에 버튼을 추가하는 데 사용되는 함수는 addPluginReviewableParam과 registerReviewableActionModal 중 어느 것일까요? 자세히 안내해 주시겠어요?