Skip to content

Incorrect handling of "highlighted" property on a "role" #28327

@nikclayton

Description

@nikclayton

Steps to reproduce the problem

  1. Open https://frikiverse.zone/@kergozh
  2. They are the owner of that server, observe they have an "Owner" role badge on their profile
  3. Use the API to fetch their account info from their server (https://frikiverse.zone/api/v1/accounts/109270219674177937)

Nothing special about that server or that account, it's just the first owner account I noticed.

Expected behaviour

A role object with a highlighted value set to true

Actual behaviour

The role object exists, but has no highlighted property

Detailed description

According to the docs, highlight is for "Whether the role is publicly visible as a badge on user profiles." (https://docs.joinmastodon.org/entities/Role/#highlighted)

The relevant bit of the JSON response for that account is:

    "roles": [
        {
            "id": "3",
            "name": "Owner",
            "color": ""
        }
    ],

I see two problems with that.

  1. There's no "highlighted": true, so the web UI should not be displaying the badge.
  2. There's no "highlighted" entry full-stop; as far as I can tell there's nothing in the JSON spec that defines how parsers are supposed to handle missing (boolean) fields (treat as null, true, false, raise an error). Either the field should always be included, or the documentation should be updated to note how clients are supposed to handle missing fields.

Mastodon instance

https://frikiverse.zone/

Mastodon version

4.2.3

Browser name and version

Firefox 120.0.1

Operating system

Windows 11

Technical details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions