Toolhub/Progress reports/2022-02-25

Report on activities in the Toolhub project for the week ending 2022-02-25.

Refactor and update diff rendering behavior

edit
Tracked in Phabricator:
Task T301206 resolved
Tracked in Phabricator:
Task T300513 resolved

Bryan rebuilt the parts of the code dealing with generating and rendering diffs for tools and list of tools almost entirely from scratch, making the design more modular and reducing overall code repetition. While this didn't happen without some sweat and tears, the result is more user-friendly rendering of complex objects, as well as code that is easier to maintain. Yay!

Exclude extra properties for url_multilingual and person types

edit
Tracked in Phabricator:
Task T302534 resolved

Working on the new diff logic uncovered a mysterious 'isTrusted' value that was being added on by the frontend when editing some fields in the toolinfo schema, such as adding a tool author. Not only was this extraneous value surreptitiously added, but it was also accepted by the backend, which is supposed to guard against such intruders. Further investigation of the matter revealed an invalid assumption that json-schema defined objects have a closed set of allowed properties by default. Thankfully, Bryan was able to modify the schema to explicitly disallow this type of unexpected behavior. Even in 2022, computers still find a way to surprise you!

Exclude 'featured' field from List diffs

edit
Tracked in Phabricator:
Task T302418 resolved

Another oddity that was revealed by tinkering with the diff rendering was that lists' 'featured' status was displayed in the list diffs, but not as an atomic revision, but rather merged into whatever other changes had been made between two revisions. This behavior was deemed unacceptable, and it was decided that featured-list toggling should be excluded from diffs altogether. Slavina made the necessary changes to the relevant serializer, and that was that. Do not worry, though -- featuring and unfeaturing of lists do show up in the audit logs and will soon become patrollable actions.

Search functionality for published list

edit

Raymond and Slavina have been working together for a couple of weeks on a UI for published lists. The search and sort functionalities have been implemented by Raymond, on both the back- and the frontend (new serializers and viewsets!), and only a few issues remain to be solved before this feature can come to life. This will enable users to curate and share lists of tools with each other.

Ensure user is fetched before fetching user's lists

edit
Tracked in Phabricator:
Task T302467 resolved

The current way of fetching the logged-in user and their list of tools sometimes resulted in passing a username of 'undefined' to the backend and, erroneously, an empty set of lists as the response. Thanks to the groundwork laid by Raymond last week that made all Vuex store actions containing API calls return Promises, it was possible for Bryan to resolve this issue by chaining the two actions (fetching the user, and fetching the user's lists), together in the correct order, while also simplifying the code.