See #170: add a description field on tracks, albums, tracks
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?
- A new
common.Content
model that is used to store arbitrary text content (with various supported content types) - A new optionnal
description
foreign key on the artists, albums and tracks tables, pointing to the model created in 1. - 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>"
}
}
- The description supports automatic links, markdown, and basic HTML markup (bold, italic, lists, etc.). Everything else is disabled to prevent XSS/privacy issues
- Description is included in the ActivityPub representation of corresponding resources (via the
content
property). - Description is populated from the
comment
field in ID3/Audio tags, if any, during upload - Description can be updated via the edit mechanism (like title, album cover, etc.)
- 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