Skip to content

Fix display of unknown licenses

Christoph Wolk requested to merge cwo/discover:unknown_license_fixes into master

This MR contains a number of small fixes to the handling of missing licenses. More specifically,

  • The license label for missing licenses is made consistent with those for labels present; the license type information button is shown and the correct color is applied to the label
  • The link to the project website for unknown licenses is now actually displayed
  • Licenses with the name "unknown" are now treated as unknown, rather than the (often incorrect) non-free.

Screenshots:

header header
discover_unknown_text_before discover_unknown_text_after
discover_unknown_button_before discover_unknown_button_after

Full details:

The recently added button that displays a license type explanation is only shown if a license is set. If the list of licenses is empty, there is a dedicated label displaying the license as "unknown", but this dedicated label does not have an info button, as these are only added in the repeater that iterates through actually existing license information. The label does also not adjust its color.

This change adds the button for the missing license case, moves the tooptip text into a property of the parent to reduce duplication, sets the appropriate color for the license label, and adds translation context.


The license type explainer text for an unknown license where a project url is known uses the KUIT tag, but does not use xi18n, so the link is not actually shown. In addition, the single-quoted placeholder is not actually closed.

This change switches this text to xi18n and adds the closing single quote.


If a license is reported as "unknown" (rather than empty), the license type function passes this through to the final free/non-free check, where unknown licenses are always non-free. Discover has a special category and explanations in the UI for unknown licenses though, and translated string for this category, so it seems more appropriate to use that rather than inform users about the non-free nature of what may well be free software.

This change extends the cases where a license has unknown type to those where the license is explicitly "unknown" (case-insensitively).

Merge request reports