Skip to content

Commit

Permalink
Merge branch 'develop' into retry-header
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep authored Mar 6, 2024
2 parents 5b4e1a1 + 4af3301 commit aa41727
Show file tree
Hide file tree
Showing 27 changed files with 241 additions and 189 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs-pr-netlify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
# There's a 'download artifact' action, but it hasn't been updated for the workflow_run action
# (https://github.com/actions/download-artifact/issues/60) so instead we get this mess:
- name: 📥 Download artifact
uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d # v3.0.0
uses: dawidd6/action-download-artifact@72aaadce3bc708349fc665eee3785cbb1b6e51d0 # v3.1.1
with:
workflow: docs-pr.yaml
run_id: ${{ github.event.workflow_run.id }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/latest_deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: JasonEtco/create-an-issue@e27dddc79c92bc6e4562f268fffa5ed752639abd # v2.9.1
- uses: JasonEtco/create-an-issue@1b14a70e4d8dc185e5cc76d3bec9eab20257b2c5 # v2.9.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/twisted_trunk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: JasonEtco/create-an-issue@e27dddc79c92bc6e4562f268fffa5ed752639abd # v2.9.1
- uses: JasonEtco/create-an-issue@1b14a70e4d8dc185e5cc76d3bec9eab20257b2c5 # v2.9.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
38 changes: 38 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
# Synapse 1.102.0 (2024-03-05)

### Bugfixes

- Revert https://github.com/element-hq/synapse/pull/16756, which caused incorrect notification counts on mobile clients since v1.100.0. ([\#16979](https://github.com/element-hq/synapse/issues/16979))


# Synapse 1.102.0rc1 (2024-02-20)

### Features

- A metric was added for emails sent by Synapse, broken down by type: `synapse_emails_sent_total`. Contributed by Remi Rampin. ([\#16881](https://github.com/element-hq/synapse/issues/16881))

### Bugfixes

- Do not send multiple concurrent requests for keys for the same server. ([\#16894](https://github.com/element-hq/synapse/issues/16894))
- Fix performance issue when joining very large rooms that can cause the server to lock up. Introduced in v1.100.0. ([\#16903](https://github.com/element-hq/synapse/issues/16903))
- Always prefer unthreaded receipt when >1 exist ([MSC4102](https://github.com/matrix-org/matrix-spec-proposals/pull/4102)). ([\#16927](https://github.com/element-hq/synapse/issues/16927))

### Improved Documentation

- Fix a small typo in the Rooms section of the Admin API documentation. Contributed by @RainerZufall187. ([\#16857](https://github.com/element-hq/synapse/issues/16857))

### Internal Changes

- Don't invalidate the entire event cache when we purge history. ([\#16905](https://github.com/element-hq/synapse/issues/16905))
- Add experimental config option to not send device list updates for specific users. ([\#16909](https://github.com/element-hq/synapse/issues/16909))
- Fix incorrect docker hub link in release script. ([\#16910](https://github.com/element-hq/synapse/issues/16910))



### Updates to locked dependencies

* Bump attrs from 23.1.0 to 23.2.0. ([\#16899](https://github.com/element-hq/synapse/issues/16899))
* Bump bcrypt from 4.0.1 to 4.1.2. ([\#16900](https://github.com/element-hq/synapse/issues/16900))
* Bump pygithub from 2.1.1 to 2.2.0. ([\#16902](https://github.com/element-hq/synapse/issues/16902))
* Bump sentry-sdk from 1.40.0 to 1.40.3. ([\#16898](https://github.com/element-hq/synapse/issues/16898))

# Synapse 1.101.0 (2024-02-13)

### Bugfixes
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion changelog.d/16857.doc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/16881.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/16894.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/16903.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/16905.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/16909.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/16910.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/16927.bugfix

This file was deleted.

1 change: 1 addition & 0 deletions changelog.d/16946.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve the documentation around running Complement tests with new configuration parameters.
1 change: 1 addition & 0 deletions changelog.d/16951.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add docs on upgrading from a very old version.
1 change: 1 addition & 0 deletions changelog.d/16973.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix joining remote rooms when a module uses the `on_new_event` callback. This callback may now pass partial state events instead of the full state for remote rooms.
12 changes: 12 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
matrix-synapse-py3 (1.102.0) stable; urgency=medium

* New Synapse release 1.102.0.

-- Synapse Packaging team <packages@matrix.org> Tue, 05 Mar 2024 14:47:03 +0000

matrix-synapse-py3 (1.102.0~rc1) stable; urgency=medium

* New Synapse release 1.102.0rc1.

-- Synapse Packaging team <packages@matrix.org> Tue, 20 Feb 2024 15:50:36 +0000

matrix-synapse-py3 (1.101.0) stable; urgency=medium

* New Synapse release 1.101.0.
Expand Down
11 changes: 11 additions & 0 deletions docker/complement/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,14 @@ Consult `scripts-dev/complement.sh` in the repository root for a real example.

[complement]: https://github.com/matrix-org/complement
[complementEnv]: https://github.com/matrix-org/complement/pull/382

## How to modify homeserver.yaml for Complement tests

It's common for MSCs to be gated behind a feature flag like this:
```yaml
experimental_features:
faster_joins: true
```
To modify this for the Complement image, modify `./conf/workers-shared-extra.yaml.j2`. Despite the name,
this will affect non-worker mode as well. Remember to _rebuild_ the image (so don't use `-e` if using
`complement.sh`).
4 changes: 4 additions & 0 deletions docs/modules/third_party_rules_callbacks.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ Called after sending an event into a room. The module is passed the event, as we
as the state of the room _after_ the event. This means that if the event is a state event,
it will be included in this state.

The state map may not be complete if Synapse hasn't yet loaded the full state
of the room. This can happen for events in rooms that were just joined from
a remote server.

Note that this callback is called when the event has already been processed and stored
into the room, which means this callback cannot be used to deny persisting the event. To
deny an incoming event, see [`check_event_for_spam`](spam_checker_callbacks.md#check_event_for_spam) instead.
Expand Down
20 changes: 20 additions & 0 deletions docs/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,26 @@ v1.61.0.
<!-- REPLACE_WITH_SCHEMA_VERSIONS -->
## Upgrading from a very old version
You need to read all of the upgrade notes for each version between your current
version and the latest so that you can update your dependencies, environment,
config files, etc. if necessary. But you do not need to perform an
upgrade to each individual version that was missed.
We do not have a list of which versions must be installed. Instead, we recommend
that you upgrade through each incompatible database schema version, which would
give you the ability to roll back the maximum number of versions should anything
go wrong. See [Rolling back to older versions](#rolling-back-to-older-versions)
above.
Additionally, new versions of Synapse will occasionally run database migrations
and background updates to update the database. Synapse will not start until
database migrations are complete. You should wait until background updates from
each upgrade are complete before moving on to the next upgrade, to avoid
stacking them up. You can monitor the currently running background updates with
[the Admin API](usage/administration/admin_api/background_updates.html#status).
# Upgrading to v1.100.0
## Minimum supported Rust version
Expand Down
5 changes: 5 additions & 0 deletions docs/usage/administration/admin_faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ for file in $source_directory/*; do
done
```

How do I upgrade from a very old version of Synapse to the latest?
---
See [this](../../upgrade.html#upgrading-from-a-very-old-version) section in the
upgrade docs.

Manually resetting passwords
---
Users can reset their password through their client. Alternatively, a server admin
Expand Down
22 changes: 11 additions & 11 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ module-name = "synapse.synapse_rust"

[tool.poetry]
name = "matrix-synapse"
version = "1.101.0"
version = "1.102.0"
description = "Homeserver for the Matrix decentralised comms protocol"
authors = ["Matrix.org Team and Contributors <packages@matrix.org>"]
license = "AGPL-3.0-or-later"
Expand Down Expand Up @@ -372,7 +372,7 @@ optional = true
sphinx = {version = "^6.1", python = "^3.8"}
sphinx-autodoc2 = {version = ">=0.4.2,<0.6.0", python = "^3.8"}
myst-parser = {version = "^1.0.0", python = "^3.8"}
furo = ">=2022.12.7,<2024.0.0"
furo = ">=2022.12.7,<2025.0.0"


[build-system]
Expand Down
23 changes: 9 additions & 14 deletions synapse/module_api/callbacks/third_party_event_rules_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ async def check_threepid_can_be_invited(
if len(self._check_threepid_can_be_invited_callbacks) == 0:
return True

state_events = await self._get_state_map_for_room(room_id)
state_events = await self._storage_controllers.state.get_current_state(room_id)

for callback in self._check_threepid_can_be_invited_callbacks:
try:
Expand Down Expand Up @@ -399,7 +399,7 @@ async def check_visibility_can_be_modified(
if len(self._check_visibility_can_be_modified_callbacks) == 0:
return True

state_events = await self._get_state_map_for_room(room_id)
state_events = await self._storage_controllers.state.get_current_state(room_id)

for callback in self._check_visibility_can_be_modified_callbacks:
try:
Expand Down Expand Up @@ -427,7 +427,13 @@ async def on_new_event(self, event_id: str) -> None:
return

event = await self.store.get_event(event_id)
state_events = await self._get_state_map_for_room(event.room_id)

# We *don't* want to wait for the full state here, because waiting for full
# state will persist event, which in turn will call this method.
# This would end up in a deadlock.
state_events = await self._storage_controllers.state.get_current_state(
event.room_id, await_full_state=False
)

for callback in self._on_new_event_callbacks:
try:
Expand Down Expand Up @@ -490,17 +496,6 @@ async def check_can_deactivate_user(
)
return True

async def _get_state_map_for_room(self, room_id: str) -> StateMap[EventBase]:
"""Given a room ID, return the state events of that room.
Args:
room_id: The ID of the room.
Returns:
A dict mapping (event type, state key) to state event.
"""
return await self._storage_controllers.state.get_current_state(room_id)

async def on_profile_update(
self, user_id: str, new_profile: ProfileInfo, by_admin: bool, deactivation: bool
) -> None:
Expand Down
8 changes: 7 additions & 1 deletion synapse/push/push_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,17 @@

async def get_badge_count(store: DataStore, user_id: str, group_by_room: bool) -> int:
invites = await store.get_invited_rooms_for_local_user(user_id)
joins = await store.get_rooms_for_user(user_id)

badge = len(invites)

room_to_count = await store.get_unread_counts_by_room_for_user(user_id)
for _room_id, notify_count in room_to_count.items():
for room_id, notify_count in room_to_count.items():
# room_to_count may include rooms which the user has left,
# ignore those.
if room_id not in joins:
continue

if notify_count == 0:
continue

Expand Down
9 changes: 7 additions & 2 deletions synapse/storage/controllers/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,10 +562,15 @@ async def get_current_state_deltas(
@trace
@tag_args
async def get_current_state(
self, room_id: str, state_filter: Optional[StateFilter] = None
self,
room_id: str,
state_filter: Optional[StateFilter] = None,
await_full_state: bool = True,
) -> StateMap[EventBase]:
"""Same as `get_current_state_ids` but also fetches the events"""
state_map_ids = await self.get_current_state_ids(room_id, state_filter)
state_map_ids = await self.get_current_state_ids(
room_id, state_filter, await_full_state
)

event_map = await self.stores.main.get_events(list(state_map_ids.values()))

Expand Down
Loading

0 comments on commit aa41727

Please sign in to comment.