Repository navigation
Add the ability to remove yourself as a guest - #6826
Conversation
b27afa9 to
5b8e10f
Compare
5b8e10f to
e674c0a
Compare
|
zoldar
left a comment
There was a problem hiding this comment.
One thing we could consider is querying for guest membership directly in session retrieval query, as discussed elsewhere. Other than that, LGTM.
| end | ||
| end | ||
|
|
||
| describe "GET /settings/guest-sites" do |
There was a problem hiding this comment.
meganitpick, non-blocking: with connected apps screen, I took the approach of putting these in a separate module. defmodule PlausibleWeb.SettingsController.ConnectedAppsTest do
There was a problem hiding this comment.
Good call to avoid increasing the giant file even further. Did the same for guest sites settings. 25ff6c0
| def leave_guest_site(conn, %{"site_id" => site_id}) do | ||
| user = conn.assigns.current_user | ||
|
|
||
| guest_membership = |
There was a problem hiding this comment.
I'd consider refactoring and adding a clause accepting site_id to Teams.Memberships.remove/2 to avoid this slightly awkward site retrieval 😬
| case Repo.one(token_query) do | ||
| %Auth.UserSession{} = user_session -> | ||
| {user_session, has_guest_memberships?} -> | ||
| user_session = put_in(user_session.user.has_guest_memberships?, has_guest_memberships?) |
There was a problem hiding this comment.
I'm not a fan of cramming contextual stuff into virtual fields of a struct, but alternative being passing around even more complex result shape along with retrieved session, I guess that's a lesser evil we can live with for now 🙈
Changes
Add a new "Guest sites" page into Account Settings, that lists all your guest memberships:
"Owned by #{user.name}"/settings/preferences(the index of account settings)Tests
Changelog
Documentation
Dark mode