Introducing a new "Post Type" Composer actions dropdown

The good news is that in the meantime we have to hooks to allow this in a theme component… this works in an initializer to only show the toggle in an ideas category:

import { withPluginApi } from "discourse/lib/plugin-api";

export default {
    name: "hide-post-voting-toggle",
    after: "extend-composer-actions", 

    initialize() {
      withPluginApi((api) => {
        api.registerValueTransformer(
          "composer-actions-content",
          ({ value, context }) => {
            const category = context.composerModel?.category;
    
            if (!category?.isType("ideas")) {
              return value.filter((item) => item.id !== "togglePostVoting");
            }
    
            return value;
          }
        );
      });
    }
};

5 Likes