Skip to content

Fix frequent items timestamps not updated

Paul Slaughter requested to merge ps-fix-frequent-items-last-accessed-on into master

What does this MR do?

The original frequent items app shimmyed this lastAccessedOn into the currentItem object. The new top nav neglected to do this, which kept the items in local storage from updating.

PLEASE NOTE: There's still a number of issues with handling this in localStorage which should be holistically resolved soon when we change this to "Recently visited projects".

Screenshots (strongly suggested)

The following test cases assume you are logged into the root user and visiting the default GitLab Test project with id: 1.

Case 1 - Item exists without lastAccessedOn

How to set up? Run the following in the browser console:

localStorage.setItem('root/frequent-projects', JSON.stringify([{ id: 1, name: "Gitlab Test", namespace: "Gitlab Org / Gitlab Test", webUrl: "/gitlab-org/gitlab-test", frequency: 2 }]))

What to expect? After visiting the project page, the frequency should be bumped forcing it to pass the threshold and showing it in the dropdown.

Not visiting project (not enough frequency to show) After visiting project (frequency is updated)
Screen_Shot_2021-06-24_at_7.38.09_AM Screen_Shot_2021-06-24_at_7.38.26_AM

Case 2 - Item exists with very recent lastAccessedOn

How to set up? Run the following in the browser console:

localStorage.setItem('root/frequent-projects', JSON.stringify([{ id: 1, name: "Gitlab Test", namespace: "Gitlab Org / Gitlab Test", webUrl: "/gitlab-org/gitlab-test", frequency: 2, lastAccessedOn: Date.now() }]))

What to expect? After visiting the project page, the frequency should not be updated. You can verify this by inspecting the local storage.

Not visiting project (not enough frequency to show) After visiting project (frequency is not updated)
Screen_Shot_2021-06-24_at_7.42.40_AM Screen_Shot_2021-06-24_at_7.42.46_AM

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Paul Slaughter

Merge request reports