Fixes broken channel page
Closes #1729 (closed)
This Merge Request includes:
A changelog fragment
It affects channels/name-of-the-channel/ page, and this bug is present at least in stable and develop
Apart from the props warnings:
Invalid prop: type check failed for prop "defaultCover". Expected Object, got Null Invalid prop: type check failed for prop "current". Expected Number, got Object Invalid prop: type check failed for prop "value". Expected String, got Null Invalid prop: type check failed for prop "channel". Expected Object, got Undefined type check failed for prop "value". Expected String, got Null Invalid prop: type check failed for prop "isChannel"
Which fixes I think are quite understandable, I also stumbled upon a couple of errors a little bit trickier:
TypeError: evaluated is null
This error prevented the page from loading and it was caused by getting a null value to be translated (
object.downloads_count at front/src/views/channels/DetailBase.vue). This is due to Sum annotation in Django returning None rather than zero, and doesn't admit a default value. A count variable default value should be zero, and the least intrusive was to change the serializer, instead of the view that would had required using Coalesce and therefore using an extra import.
Duplicate keys detected:
This warning is raised the by the track list overview, because front/src/components/audio/track/Table.vue is using
track.id as key and the same track was added twice. So to prevent this warning either we allow duplicates and use another key (e.g. the index) or we remove duplicates from the list. I opted to remove duplicates since IMO it makes more sense, but of course it's debatable.