Class ChatApplicationBadgePlugin

java.lang.Object
io.meeds.chat.plugin.ChatApplicationBadgePlugin
All Implemented Interfaces:
io.meeds.appcenter.plugin.ApplicationBadgePlugin

@Component @ConditionalOnClass(io.meeds.appcenter.plugin.ApplicationBadgePlugin.class) public class ChatApplicationBadgePlugin extends Object implements io.meeds.appcenter.plugin.ApplicationBadgePlugin
Declares the chat badge and binds it to the Chat application, without computing it.

Chat is the one contributor whose counter is authoritative in the browser: the Matrix client maintains it from its own sync state, and the topbar chat button renders it directly. Two consequences:

  • There is no cheap server-side count to expose. MatrixService.getUnreadConversations does exist but performs a callAsUser, a conversation-title resolution and a full Matrix /sync per call — built for an on-demand MCP tool, not for a counter rendered on the topbar of every page.
  • Even if it were cheap, it would be a second source for a number already displayed next to it, and the two could disagree.
So the value is supplied client-side through the AppCenterAppBadge rendering extension, reusing the very count the chat button shows, and this plugin only carries the two things the frontend cannot know: the badge identifier and which catalog entry it belongs to.
  • Field Details

  • Constructor Details

    • ChatApplicationBadgePlugin

      public ChatApplicationBadgePlugin()
  • Method Details

    • init

      @PostConstruct public void init()
    • getName

      public String getName()
      Specified by:
      getName in interface io.meeds.appcenter.plugin.ApplicationBadgePlugin
    • getDrawerNames

      public List<String> getDrawerNames()
      Specified by:
      getDrawerNames in interface io.meeds.appcenter.plugin.ApplicationBadgePlugin
    • isSelfCached

      public boolean isSelfCached()
      Nothing is cached: there is no server-side value to cache. Declaring this self-cached keeps App Center from storing — and later serving — the placeholder returned by countBadge(String).
      Specified by:
      isSelfCached in interface io.meeds.appcenter.plugin.ApplicationBadgePlugin
    • countBadge

      public long countBadge(String username)
      Always 0: the real count is rendered by the frontend extension. The badge is still displayed, because a badge carrying a registered rendering extension owns its own visibility rather than depending on this value.
      Specified by:
      countBadge in interface io.meeds.appcenter.plugin.ApplicationBadgePlugin