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

Allow room creator to send MSC2716 related events in existing room versions #10566

Merged

Commits on Aug 10, 2021

  1. Allow room creator to send MSC2716 related events in existing room ve…

    …rsions
    
    Discussed at matrix-org/matrix-spec-proposals#2716
    
    Restoring `get_create_event_for_room_txn` from,
    44bb3f0
    MadLittleMods committed Aug 10, 2021
    Configuration menu
    Copy the full SHA
    6481502 View commit details
    Browse the repository at this point in the history
  2. Add changelog

    MadLittleMods committed Aug 10, 2021
    Configuration menu
    Copy the full SHA
    13d0929 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    259303a View commit details
    Browse the repository at this point in the history

Commits on Aug 20, 2021

  1. Populate rooms.creator column for easy lookup

    > From some [out of band discussion](https://matrix.to/#/!UytJQHLQYfvYWsGrGY:jki.re/$p2fKESoFst038x6pOOmsY0C49S2gLKMr0jhNMz_JJz0?via=jki.re&via=matrix.org), my plan is to use `rooms.creator`. But currently, we don't fill in `creator` for remote rooms when a user is invited to a room for example. So we need to add some code to fill in `creator` wherever we add to the `rooms` table. And also add a background update to fill in the rows missing `creator` (we can use the same logic that `get_create_event_for_room_txn` is doing by looking in the state events to get the `creator`).
    >
    > #10566 (comment)
    MadLittleMods committed Aug 20, 2021
    Configuration menu
    Copy the full SHA
    16a41dd View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    fffce99 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    aafa069 View commit details
    Browse the repository at this point in the history

Commits on Aug 21, 2021

  1. Configuration menu
    Copy the full SHA
    fedd250 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8a2db20 View commit details
    Browse the repository at this point in the history

Commits on Aug 25, 2021

  1. Populate rooms.creator field for easy lookup

    Part of #10566
    
     - Fill in creator whenever we insert into the rooms table
     - Add background update to backfill any missing creator values
    MadLittleMods committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    2b177b7 View commit details
    Browse the repository at this point in the history
  2. Add changelog

    MadLittleMods committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    ee406df View commit details
    Browse the repository at this point in the history
  3. Fix usage

    MadLittleMods committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    9f8e22b View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    759e78c View commit details
    Browse the repository at this point in the history
  5. Merge branch 'madlittlemods/populate-rooms-creator-field' into madlit…

    …tlemods/room-creator-allowed-to-msc2716-events
    MadLittleMods committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    71c20f7 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    9b828ab View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    3c9b5a6 View commit details
    Browse the repository at this point in the history

Commits on Aug 31, 2021

  1. Configuration menu
    Copy the full SHA
    9a600ff View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    79b4991 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    25db289 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    41e72c2 View commit details
    Browse the repository at this point in the history
  5. Fix query casing

    MadLittleMods committed Aug 31, 2021
    Configuration menu
    Copy the full SHA
    9a3c015 View commit details
    Browse the repository at this point in the history
  6. Fix ambiguity iterating over cursor instead of list

    Fix `psycopg2.ProgrammingError: no results to fetch` error
    when tests run with Postgres.
    
    ```
    SYNAPSE_POSTGRES=1 SYNAPSE_TEST_LOG_LEVEL=INFO python -m twisted.trial tests.storage.databases.main.test_room
    ```
    
    ---
    
    We use `txn.fetchall` because it will return the results as a
    list or an empty list when there are no results.
    
    Docs:
    
    > `cursor` objects are iterable, so, instead of calling explicitly fetchone() in a loop, the object itself can be used:
    >
    > https://www.psycopg.org/docs/cursor.html#cursor-iterable
    
    And I'm guessing iterating over a raw cursor does something weird when there are no results.
    
    ---
    
    Test CI failure: https://github.com/matrix-org/synapse/pull/10697/checks?check_run_id=3468916530
    ```
    tests.test_visibility.FilterEventsForServerTestCase.test_large_room
    ===============================================================================
    [FAIL]
    Traceback (most recent call last):
      File "/home/runner/work/synapse/synapse/tests/storage/databases/main/test_room.py", line 85, in test_background_populate_rooms_creator_column
        self.get_success(
      File "/home/runner/work/synapse/synapse/tests/unittest.py", line 500, in get_success
        return self.successResultOf(d)
      File "/home/runner/work/synapse/synapse/.tox/py/lib/python3.9/site-packages/twisted/trial/_synctest.py", line 700, in successResultOf
        self.fail(
    twisted.trial.unittest.FailTest: Success result expected on <Deferred at 0x7f4022f3eb50 current result: None>, found failure result instead:
    Traceback (most recent call last):
      File "/home/runner/work/synapse/synapse/.tox/py/lib/python3.9/site-packages/twisted/internet/defer.py", line 701, in errback
        self._startRunCallbacks(fail)
      File "/home/runner/work/synapse/synapse/.tox/py/lib/python3.9/site-packages/twisted/internet/defer.py", line 764, in _startRunCallbacks
        self._runCallbacks()
      File "/home/runner/work/synapse/synapse/.tox/py/lib/python3.9/site-packages/twisted/internet/defer.py", line 858, in _runCallbacks
        current.result = callback(  # type: ignore[misc]
      File "/home/runner/work/synapse/synapse/.tox/py/lib/python3.9/site-packages/twisted/internet/defer.py", line 1751, in gotResult
        current_context.run(_inlineCallbacks, r, gen, status)
    --- <exception caught here> ---
      File "/home/runner/work/synapse/synapse/.tox/py/lib/python3.9/site-packages/twisted/internet/defer.py", line 1657, in _inlineCallbacks
        result = current_context.run(
      File "/home/runner/work/synapse/synapse/.tox/py/lib/python3.9/site-packages/twisted/python/failure.py", line 500, in throwExceptionIntoGenerator
        return g.throw(self.type, self.value, self.tb)
      File "/home/runner/work/synapse/synapse/synapse/storage/background_updates.py", line 224, in do_next_background_update
        await self._do_background_update(desired_duration_ms)
      File "/home/runner/work/synapse/synapse/synapse/storage/background_updates.py", line 261, in _do_background_update
        items_updated = await update_handler(progress, batch_size)
      File "/home/runner/work/synapse/synapse/synapse/storage/databases/main/room.py", line 1399, in _background_populate_rooms_creator_column
        end = await self.db_pool.runInteraction(
      File "/home/runner/work/synapse/synapse/synapse/storage/database.py", line 686, in runInteraction
        result = await self.runWithConnection(
      File "/home/runner/work/synapse/synapse/synapse/storage/database.py", line 791, in runWithConnection
        return await make_deferred_yieldable(
      File "/home/runner/work/synapse/synapse/.tox/py/lib/python3.9/site-packages/twisted/internet/defer.py", line 858, in _runCallbacks
        current.result = callback(  # type: ignore[misc]
      File "/home/runner/work/synapse/synapse/tests/server.py", line 425, in <lambda>
        d.addCallback(lambda x: function(*args, **kwargs))
      File "/home/runner/work/synapse/synapse/.tox/py/lib/python3.9/site-packages/twisted/enterprise/adbapi.py", line 293, in _runWithConnection
        compat.reraise(excValue, excTraceback)
      File "/home/runner/work/synapse/synapse/.tox/py/lib/python3.9/site-packages/twisted/python/deprecate.py", line 298, in deprecatedFunction
        return function(*args, **kwargs)
      File "/home/runner/work/synapse/synapse/.tox/py/lib/python3.9/site-packages/twisted/python/compat.py", line 404, in reraise
        raise exception.with_traceback(traceback)
      File "/home/runner/work/synapse/synapse/.tox/py/lib/python3.9/site-packages/twisted/enterprise/adbapi.py", line 284, in _runWithConnection
        result = func(conn, *args, **kw)
      File "/home/runner/work/synapse/synapse/synapse/storage/database.py", line 786, in inner_func
        return func(db_conn, *args, **kwargs)
      File "/home/runner/work/synapse/synapse/synapse/storage/database.py", line 554, in new_transaction
        r = func(cursor, *args, **kwargs)
      File "/home/runner/work/synapse/synapse/synapse/storage/databases/main/room.py", line 1375, in _background_populate_rooms_creator_column_txn
        for room_id, event_json in txn:
    psycopg2.ProgrammingError: no results to fetch
    ```
    MadLittleMods committed Aug 31, 2021
    Configuration menu
    Copy the full SHA
    9a887a4 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    6f9cb41 View commit details
    Browse the repository at this point in the history

Commits on Sep 1, 2021

  1. Configuration menu
    Copy the full SHA
    ad29e96 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    462ab25 View commit details
    Browse the repository at this point in the history
  3. Use constant field

    MadLittleMods committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    a3581d3 View commit details
    Browse the repository at this point in the history
  4. Merge branch 'madlittlemods/populate-rooms-creator-field' into madlit…

    …tlemods/room-creator-allowed-to-msc2716-events
    MadLittleMods committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    20196c8 View commit details
    Browse the repository at this point in the history
  5. Merge branch 'develop' into madlittlemods/room-creator-allowed-to-msc…

    …2716-events
    
    Conflicts:
    	synapse/handlers/federation.py
    MadLittleMods committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    725cf22 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    e047e42 View commit details
    Browse the repository at this point in the history