Skip to content
Snippets Groups Projects
  1. Nov 03, 2021
  2. Oct 28, 2021
  3. Oct 27, 2021
  4. Oct 25, 2021
  5. Oct 21, 2021
    • David Robertson's avatar
      Fix adding excluded users to the private room sharing tables when joining a room (#11143) · 2d91b625
      David Robertson authored
      * We only need to fetch users in private rooms
      
      * Filter out `user_id` at the top
      
      * Discard excluded users in the top loop
      
      We weren't doing this in the "First, if they're our user" branch so this
      is a bugfix.
      
      * The caller must check that `user_id` is included
      
      This is in the docstring. There are two call sites:
      - one in `_handle_room_publicity_change`, which explicitly checks before calling;
      - and another in `_handle_room_membership_event`, which returns early if
        the user is excluded.
      
      So this change is safe.
      
      * Test joining a private room with an excluded user
      
      * Tweak an existing test
      
      * Changelog
      
      * test docstring
      
      * lint
      2d91b625
  6. Oct 18, 2021
  7. Oct 15, 2021
  8. Oct 14, 2021
    • Eric Eastwood's avatar
      Fix 500 error on `/messages` when we accumulate more than 5 backward extremities (#11027) · daf498e0
      Eric Eastwood authored
      Found while working on the Gitter backfill script and noticed
      it only happened after we sent 7 batches, https://gitlab.com/gitterHQ/webapp/-/merge_requests/2229#note_665906390
      
      When there are more than 5 backward extremities for a given depth,
      backfill will throw an error because we sliced the extremity list
      to 5 but then try to iterate over the full list. This causes
      us to look for state that we never fetched and we get a `KeyError`.
      
      Before when calling `/messages` when there are more than 5 backward extremities:
      ```
      Traceback (most recent call last):
        File "/usr/local/lib/python3.8/site-packages/synapse/http/server.py", line 258, in _async_render_wrapper
          callback_return = await self._async_render(request)
        File "/usr/local/lib/python3.8/site-packages/synapse/http/server.py", line 446, in _async_render
          callback_return = await raw_callback_return
        File "/usr/local/lib/python3.8/site-packages/synapse/rest/client/room.py", line 580, in on_GET
          msgs = await self.pagination_handler.get_messages(
        File "/usr/local/lib/python3.8/site-packages/synapse/handlers/pagination.py", line 396, in get_messages
          await self.hs.get_federation_handler().maybe_backfill(
        File "/usr/local/lib/python3.8/site-packages/synapse/handlers/federation.py", line 133, in maybe_backfill
          return await self._maybe_backfill_inner(room_id, current_depth, limit)
        File "/usr/local/lib/python3.8/site-packages/synapse/handlers/federation.py", line 386, in _maybe_backfill_inner
          likely_extremeties_domains = get_domains_from_state(states[e_id])
      KeyError: '$zpFflMEBtZdgcMQWTakaVItTLMjLFdKcRWUPHbbSZJl'
      ```
      daf498e0
  9. Oct 13, 2021
  10. Oct 08, 2021
  11. Oct 07, 2021
  12. Oct 06, 2021
  13. Oct 04, 2021
    • David Robertson's avatar
      Consistently exclude from user_directory (#10960) · f7b034a2
      David Robertson authored
      * Introduce `should_include_local_users_in_dir`
      
      We exclude three kinds of local users from the user_directory tables. At
      present we don't consistently exclude all three in the same places. This
      commit introduces a new function to gather those exclusion conditions
      together. Because we have to handle local and remote users in different
      ways, I've made that function only consider the case of remote users.
      It's the caller's responsibility to make the local versus remote
      distinction clear and correct.
      
      A test fixup is required. The test now hits a path which makes db
      queries against the users table. The expected rows were missing, because
      we were using a dummy user that hadn't actually been registered.
      
      We also add new test cases to covert the exclusion logic.
      
      ----
      
      By my reading this makes these changes:
      
      * When an app service user registers or changes their profile, they will
        _not_ be added to the user directory. (Previously only support and
        deactivated users were excluded). This is consistent with the logic that
        rebuilds the user directory. See also [the discussion
        here](https://github.com/matrix-org/synapse/pull/10914#discussion_r716859548
      
      ).
      * When rebuilding the directory, exclude support and disabled users from
        room sharing tables. Previously only appservice users were excluded.
      * Exclude all three categories of local users when rebuilding the
        directory. Previously `_populate_user_directory_process_users` didn't do
        any exclusion.
      
      Co-authored-by: default avatarRichard van der Hoff <1389908+richvdh@users.noreply.github.com>
      f7b034a2
    • Patrick Cloke's avatar
  14. Sep 30, 2021
  15. Sep 29, 2021
  16. Sep 24, 2021
    • Patrick Cloke's avatar
    • Richard van der Hoff's avatar
      Factor out common code for persisting fetched auth events (#10896) · 85551b7a
      Richard van der Hoff authored
      * Factor more stuff out of `_get_events_and_persist`
      
      It turns out that the event-sorting algorithm in `_get_events_and_persist` is
      also useful in other circumstances. Here we move the current
      `_auth_and_persist_fetched_events` to `_auth_and_persist_fetched_events_inner`,
      and then factor the sorting part out to `_auth_and_persist_fetched_events`.
      
      * `_get_remote_auth_chain_for_event`: remove redundant `outlier` assignment
      
      `get_event_auth` returns events with the outlier flag already set, so this is
      redundant (though we need to update a test where `get_event_auth` is mocked).
      
      * `_get_remote_auth_chain_for_event`: move existing-event tests earlier
      
      Move a couple of tests outside the loop. This is a bit inefficient for now, but
      a future commit will make it better. It should be functionally identical.
      
      * `_get_remote_auth_chain_for_event`: use `_auth_and_persist_fetched_events`
      
      We can use the same codepath for persisting the events fetched as part of an
      auth chain as for those fetched individually by `_get_events_and_persist` for
      building the state at a backwards extremity.
      
      * `_get_remote_auth_chain_for_event`: use a dict for efficiency
      
      `_auth_and_persist_fetched_events` sorts the events itself, so we no longer
      need to care about maintaining the ordering from `get_event_auth` (and no
      longer need to sort by depth in `get_event_auth`).
      
      That means that we can use a map, making it easier to filter out events we
      already have, etc.
      
      * changelog
      
      * `_auth_and_persist_fetched_events`: improve docstring
      85551b7a
    • David Robertson's avatar
      Improve typing in user_directory files (#10891) · 7f335274
      David Robertson authored
      
      * Improve typing in user_directory files
      
      This makes the user_directory.py in storage pass most of mypy's
      checks (including `no-untyped-defs`). Unfortunately that file is in the
      tangled web of Store class inheritance so doesn't pass mypy at the moment.
      
      The handlers directory has already been mypyed.
      
      Co-authored-by: default avatarreivilibre <olivier@librepush.net>
      7f335274
  17. Sep 23, 2021
  18. Sep 21, 2021
    • Patrick Cloke's avatar
      4054dfa4
    • David Robertson's avatar
      Always add local users to the user directory (#10796) · 60453315
      David Robertson authored
      
      It's a simplification, but one that'll help make the user directory logic easier
      to follow with the other changes upcoming. It's not strictly required for those
      changes, but this will help simplify the resulting logic that listens for
      `m.room.member` events and generally make the logic easier to follow.
      
      This means the config option `search_all_users` ends up controlling the
      search query only, and not the data we store. The cost of doing so is an
      extra row in the `user_directory` and `user_directory_search` tables for
      each local user which
      
      - belongs to no public rooms
      - belongs to no private rooms of size ≥ 2
      
      I think the cost of this will be marginal (since they'll already have entries
       in `users` and `profiles` anyway).
      
      As a small upside, a homeserver whose directory was built with this
      change can toggle `search_all_users` without having to rebuild their
      directory.
      
      Co-authored-by: default avatarRichard van der Hoff <1389908+richvdh@users.noreply.github.com>
      60453315
  19. Sep 10, 2021
  20. Sep 06, 2021
  21. Sep 01, 2021
  22. Aug 27, 2021
    • Richard van der Hoff's avatar
      Fix incompatibility with Twisted < 21. (#10713) · 8f982605
      Richard van der Hoff authored
      Turns out that the functionality added in #10546 to skip TLS was incompatible
      with older Twisted versions, so we need to be a bit more inventive.
      
      Also, add a test to (hopefully) not break this in future. Sadly, testing TLS is
      really hard.
      8f982605
  23. Aug 26, 2021
  24. Aug 19, 2021
  25. Aug 17, 2021
  26. Aug 16, 2021
  27. Aug 11, 2021
  28. Aug 10, 2021
Loading