v0.7.0 the History Update

I published the v0.7.0, which adds a new feature: the history. You will find in your account a new page, cleverly named “History”, where you will find… well, your history on Cyca. How convenient ๐Ÿ˜.

When you registered, added a folder or a bookmark, ignored or followed a feed, it’s all there, sorted by date, from the newest event to the oldest.

It’s not the new, secret feature I teased you about for the past days yet. Why would I have teased you about such a common feature ? But I thought that considering what’s going on next, having a history might be a good idea.

So, while you might not find it very useful now, although you still might enjoy remembering what happened some times ago, it will definitely be useful in a future update…

Technical stuff

You will not see it, but each history entry is stored with a bit more data. It is to ensure that, even if some object is missing, like a folder or a document, the history will still be usable. Only the required fields used to display the history entry are stored.

For instance, if you deleted a folder, the history entry will keep the folder name and its breadcrumbs so the history listing is still readable. The same will happened with documents and feeds, for which only the URL is kept.

Let’s take the example of a deleted folder:

{
    "id": 16,
    "user_id": 1,
    "folder_id": null,
    "document_id": null,
    "feed_id": null,
    "event": "folder_deleted",
    "details": {
        "user": {
            "id": 1,
            "name": "Richard Dern",
            "email": null
        },
        "folder": {
            "id": 3,
            "title": "Cyca",
            "breadcrumbs": "Root/Cyca"
        }
    },
    "created_at": "2020-10-21T14:26:25.000000Z",
    "updated_at": "2020-10-21T14:26:25.000000Z",
    "date": "2020-10-21",
    "time": "14:26",
    "text": "<a href=\"mailto:\">Richard Dern</a> deleted folder <span class=\"inline-folder folder-common\">Root/Cyca</span>",
    "user": {
        "id": 1,
        "name": "Richard Dern",
        "email": null,
        "email_verified_at": "2020-10-20T23:17:03.000000Z",
        "lang": "en",
        "theme": "cyca-light",
        "created_at": "2020-10-20T23:16:56.000000Z",
        "updated_at": "2020-10-21T22:41:11.000000Z"
    }
}

I’ve removed my email address from this snippet to avoid spam, but other than that, this is a good example of wht your history page will load. As you can see, there is no folder_id anymore (because corresponding folder was deleted), but we still have kept the original - useful to the history - folder properties in the details array, which also holds some user details (in case it’s also deleted in the future). We also send a nicely formatted text ready to be displayed (and translated on-the-fly if needed).

This only should give you a good hint about the upcoming secret feature ๐Ÿ˜Š.

Laravel offers nice tooling to watch for object changes. Among others, the observer design-pattern, which provides convenient entry-points for code on events like object creation, suppression, etc. This is where I plugged in the history entries. It allows me to keep my code clean and readable, and to easily add all kinds of history entries.

I haven’t decided if I wanted to include when you opened a bookmark or a feed because:

  • keeping a history of every opened feed item could make your history too big to handle
  • I am concerned about privacy

Consequently, and like every other “exotic” feature in Cyca, I am going to wait and see what users want.

Displaying the history is made with a 50 entries pagination, and so-called infinite loading: while you scroll down, it will load more entries until there are no more entries to load.

I think future updates, along with new kinds of events, would add links to folders when they still exist in your hierarchy, and modify existing links to documents and feeds to your actual bookmark (again, if they still exist).

I just realized I forgot to remove the “prototype” CSS classes from the Vue component, so this will be done shortly but won’t affect anything in the use of this new feature.