Rotonde / rotonde-client

Rotonde Base Client
https://client-neauoire.hashbase.io/
MIT License
227 stars 49 forks source link

Sort port list by activity, fix portal.updated(), misc fixes #136

Closed 0x0ade closed 7 years ago

0x0ade commented 7 years ago

portal.updated() now correctly checks for the most recent entry (both timestamp and editstamp-wise). Before, it just blindly picked the last entry in the list.

Also, json.port gets sorted by activity on home.save.

I initially thought about sorting it in feed.register, but opted against it. Feeds can update on the fly and the order determined in feed.register can already be outdated when saving.
Additionally, this doesn't "magically fix" your portal.json. You still need to invoke a save by f.e. following someone or posting something. Automatically invoking a save after sorting would just bloat the history.

Edit: Yet again, I'm smuggling in an unrelated fix. When using the undat command, entries from the unfollowed portal still ghosted around. This PR introduces portal.entries_remove() (named after portal.entries) invoking element.remove_element() (named after element.to_element()).

Edit 2: And two more fixes: Remove zombie entries from the feed (entries without any containing portal) and handle entry updates properly again (add entry.update(data, host)).