discourse/plugins/poll
Alan Guo Xiang Tan 913fd3a7b3
DEV: Improve addToolbarPopupMenuOptionsCallback plugin api (#23769)
Why this change?

Previously just using the `addToolbarPopupMenuOptionsCallback` plugin
API itself was insufficient because it required the return object to
include an `action` key which only accepted a name of the action
function as a string. This was highly problematic because the action
function had to be defined on the `composer` service which means using
the `modifyClass` API to add the action function. This made the API
awkward to use leading to poor developer experiencec.

What does this change do?

This commit introduces a couple of improvemnts to the API.

1. First the API has been renamed to `addComposerToolbarPopupMenuOption` because
   the API no longer accepts a callback function which was quite
   redundant. Instead, it now accepts an Object. The
   `addToolbarPopupMenuOptionsCallback` API function is deprecated and
   will be dropped in Discourse 3.3. Note that passing the API a
   function is still supported but will be dropped when the `addToolbarPopupMenuOptionsCallback`
   is removed.

2. The `action` key in the Object passed to the function can now be a
   function and is passed the `toolbarEvent` object when called.

3. The `condition` on key in the Object passed to the function can now be a
   function and is passed the `composer` service when called.
2023-10-06 07:43:40 +08:00
..
app DEV: Apply syntax_tree formatting to plugins/* 2023-01-07 11:11:37 +00:00
assets DEV: Improve addToolbarPopupMenuOptionsCallback plugin api (#23769) 2023-10-06 07:43:40 +08:00
config Update translations (#23309) 2023-08-29 15:50:52 +02:00
db FIX: Cater for polls that can have multiple votes per user (#22297) 2023-06-27 18:58:16 +08:00
jobs/regular DEV: Apply syntax_tree formatting to plugins/* 2023-01-07 11:11:37 +00:00
lib FIX: Ensure poll extraction is not attempted if post body is absent (#19718) 2023-01-13 01:47:44 +00:00
spec DEV: Cleanup an old spec (#22503) 2023-07-10 11:34:17 +08:00
test/javascripts DEV: Improve addToolbarPopupMenuOptionsCallback plugin api (#23769) 2023-10-06 07:43:40 +08:00
plugin.rb REFACTOR: improve poll info layout (#22353) 2023-07-05 12:20:18 -04:00