Skip to content

See #170: add a description field on tracks, albums, tracks

Agate requested to merge 170-track-description into develop

This is a requirement for #170 (closed), since we'll need a place to store free-form description relating channels, albums and tracks.

So, what do we have?

  1. A new common.Content model that is used to store arbitrary text content (with various supported content types)
  2. A new optionnal description foreign key on the artists, albums and tracks tables, pointing to the model created in 1.
  3. A new description field exposed when fetching the detailed reprentation of these resources via the API:
// GET /api/v1/artists/42
{
  // The description has the same structure for album / tracks resources. We use an object instead of a plain string,
  // because we have multiple fields (and may want to have even more in the future, e.g to support translations)
  "description": {
    // content type of the description text. html, plain text and markdown supported
    "content_type": "text/markdown",
    // raw text, unrendered, for edition
    "text": "**hello world**",
    // rendered and sanitized HTML from the original text
    "html": "<p><strong>hello world</strong></p>"
  }
}
  1. The description supports automatic links, markdown, and basic HTML markup (bold, italic, lists, etc.). Everything else is disabled to prevent XSS/privacy issues
  2. Description is included in the ActivityPub representation of corresponding resources (via the content property).
  3. Description is populated from the comment field in ID3/Audio tags, if any, during upload
  4. Description can be updated via the edit mechanism (like title, album cover, etc.)
  5. Description update is propagated over federation

What's not implemented in this MR is the actual display of descriptions in the UI. This will come later.

cc @funkwhale/reviewers-front cc @funkwhale/reviewers-python

Merge request reports