Skip to content

Commit

Permalink
Fix /versions requests (#17410)
Browse files Browse the repository at this point in the history
We need it to work on workers and allow guest access.

Broke by #17392
  • Loading branch information
erikjohnston committed Jul 9, 2024
1 parent 1353fb3 commit 0ed1c64
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/17410.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Finish up work to allow per-user feature flags.
4 changes: 4 additions & 0 deletions synapse/app/generic_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@
EventPushActionsWorkerStore,
)
from synapse.storage.databases.main.events_worker import EventsWorkerStore
from synapse.storage.databases.main.experimental_features import (
ExperimentalFeaturesStore,
)
from synapse.storage.databases.main.filtering import FilteringWorkerStore
from synapse.storage.databases.main.keys import KeyStore
from synapse.storage.databases.main.lock import LockStore
Expand Down Expand Up @@ -155,6 +158,7 @@ class GenericWorkerStore(
LockStore,
SessionStore,
TaskSchedulerWorkerStore,
ExperimentalFeaturesStore,
):
# Properties that multiple storage classes define. Tell mypy what the
# expected type is.
Expand Down
7 changes: 6 additions & 1 deletion synapse/rest/client/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
msc3881_enabled = self.config.experimental.msc3881_enabled

if self.auth.has_access_token(request):
requester = await self.auth.get_user_by_req(request)
requester = await self.auth.get_user_by_req(
request,
allow_guest=True,
allow_locked=True,
allow_expired=True,
)
user_id = requester.user.to_string()

msc3881_enabled = await self.store.is_feature_enabled(
Expand Down

0 comments on commit 0ed1c64

Please sign in to comment.