Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Add a filter for inactive sessions #2983

Merged
merged 7 commits into from
Jul 19, 2024
Merged

Conversation

sandhose
Copy link
Member

@sandhose sandhose commented Jul 18, 2024

This is reviewable commit by commit:

  • Add an index on the last_active_at column of the sessions tables
  • storage: add a filter by last active time on browser sessions
  • storage: add a filter by last active time on compatibility sessions
  • storage: add a filter by last active time on OAuth 2.0 sessions
  • storage: add a filter by last active time on app sessions
  • graphql: allow filtering of sessions by last activity
  • frontend: add filter for inactive sessions

This adds a filter to only show sessions that have not been active for more than 90 days.

It also reworks a bit the session list to make it clearer that the browser session thing is separate.
On the frontend side, it isn't exactly what's designed, because:

  • the menu component in compound is lacking
  • we can't really merge the 'browser' sessions and the 'app' sessions
image

Fixes #2219
Helps with #2265

@sandhose sandhose requested a review from reivilibre July 18, 2024 17:04
Copy link

Deploying matrix-authentication-service-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: d225d13
Status: ✅  Deploy successful!
Preview URL: https://095ac6ee.matrix-authentication-service-docs.pages.dev
Branch Preview URL: https://quenting-inactive-sessions-f.matrix-authentication-service-docs.pages.dev

View logs

@reivilibre
Copy link
Contributor

On the frontend side, it isn't exactly what's designed, because:

just for ref, do you have a link to the designs / an issue, in case we need to look back on this in the future?

Copy link
Contributor

@reivilibre reivilibre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems fine to me. Glad we split up the filters like that

/// A filter for dates, with a lower bound and an upper bound
#[derive(InputObject, Default, Clone, Copy)]
pub struct DateFilter {
/// The lower bound of the date range
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is what gets generated as the GraphQL documentation right?

I think we should describe the format of the date here, since it's not obvious how a caller should use it.

I then wonder how much we care about timezones. Possibly not at all, given 90 days is far enough away that it probably doesn't matter whether it's a few hours off.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scalar used is a custom one, which is serialises as a string, and has the following (autogenerated) documentation on it:

"""
Implement the DateTime<Utc> scalar

The input/output is a string in RFC3339 format.
"""
scalar DateTime

so that's probably fine?

@sandhose
Copy link
Member Author

sandhose commented Jul 19, 2024

just for ref, do you have a link to the designs / an issue, in case we need to look back on this in the future?

You're right, for the feature itself that would be #2219

The designs are here: https://www.figma.com/design/HUysJAhv6cK6p1Pc81Fxaa/Matrix-Authentication-Service-(MAS)?node-id=4352-32522&t=lqvaJRtBgVVCC7Ix-4

Tracking issue for the designs: #2265

@sandhose sandhose merged commit 3b83b11 into main Jul 19, 2024
16 checks passed
@sandhose sandhose deleted the quenting/inactive-sessions-filter branch July 29, 2024 12:06
@sandhose sandhose added the A-GraphQL Changes to the GraphQL API label Jul 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-GraphQL Changes to the GraphQL API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mark inactive sessions
2 participants