Skip to content

Make system labels configurable #2141

@AlaeMghirbi

Description

@AlaeMghirbi

Why?

Current problem: The needs-action label is hard-coded
private static final String NEEDS_ACTION = "needs-action";
Problems identified: Different use cases may require different system labels and needs (e.g., "promotion", "social", "to-do") => needs action is not the only possible scenario.
Also system administrators should be able to control system labels without modifying the code

What?

We want to make system labels configurable through the application configuration file, not hard-coded.
Goal: Configuration-driven system labels

  1. Define system labels in listeners.xml configuration
  2. Support multiple system labels (not just needs-action)
  3. Each system label has: id, displayName, color, description

We also want to have clear separation between:

  • System labels: Configured in listeners.xml (managed by admins)
  • User labels: Stored in database (managed by users via JMAP)

System labels are configuration and they should not be stored in database

Example:

    <listener>
        <class>com.linagora.tmail.listener.rag.LlmMailClassifierListener</class>
        <configuration>
                     ....
              <systemLabels>
                <label>
                  <id>needs-action</id>
                  <displayName>Needs Action</displayName>
                  <color>#FF6B6B</color>
                  <description>Email requires the recipient to take action: answer a question, make a decision, complete a task, handle a request, or respond by a deadline.</description>
                </label>
                 <label>
                  <id>promotional</id>
                  <displayName>Promotional</displayName>
                  <color>#4ECDC4</color>
                  <description>Marketing, newsletters, announcements, or promotional content.</description>
                </label>
              </systemLabels>
        </configuration>
    </listener>

How:

  • Create SystemLabel record that create systemLabel from configuration and can turn it into an actual Label .
  • Label ID validation should include both user and system labels before being added as a flag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions