198 Commits

Author SHA1 Message Date
Kévin Commaille
32901da35f events: Reorganize tests
Move tests to the proper files, streamline test names and remove
duplicates.
2023-02-23 19:31:08 +01:00
Jonas Platte
11d5020565 events: Don't require threads to contain m.in_reply_to 2023-02-22 14:38:23 +01:00
Kévin Commaille
699c2daf39
events: Remove mixed types and conversion functions for extensible events
Mixed types have been removed from MSC1767.
2023-02-09 16:25:51 +01:00
Jonas Platte
9c65a7dcae
events: Use input visibility for generated types in EventContent derive 2023-02-07 20:55:53 +01:00
Kévin Commaille
e58b9fcd92 tests: Remove unnecessary borrows 2023-02-06 19:11:06 +01:00
Jonas Platte
e37d064306
macros: Update expected trybuild test output 2023-01-30 16:34:26 +01:00
Jonas Platte
2eba14f0cc
events: Rework the content traits 2023-01-16 21:28:53 +01:00
Jonas Platte
b859d9c8b0
common: Derive Debug via StringEnum derive 2023-01-13 13:49:59 +01:00
Kévin Commaille
1d8ea75f6f events: Remove EventContent::from_parts 2023-01-10 11:37:31 +01:00
Kévin Commaille
9a9bd2c933 events: Remove Raw::deserialize_content
Replace it with deserialize_as or deserialize_with_type.
2023-01-10 11:37:31 +01:00
Kévin Commaille
dc591647f8 events: Remove StateUnsignedFromParts
Replace it with a bound on DeserializeOwned
2023-01-10 11:37:31 +01:00
Kévin Commaille
97b212795a events: Create EventContentFromType
Implement it for:
- event contents that implement Deserialize
- event contents with event types with a suffix
- custom event contents
2023-01-10 11:37:31 +01:00
Kévin Commaille
ca78825e94 events: rename RoomEventType to TimelineEventType 2023-01-03 10:36:13 +01:00
Kévin Commaille
cd74cdcc0e
events: Generate PossiblyRedacted type for original state events
Fix deserialization of redacted prev_content
Can be overriden with the `custom_possibly_redacted` attribute

Co-authored-by: Jonas Platte <jplatte@element.io>
2023-01-03 10:28:40 +01:00
Jonas Platte
ff8ab6b085
Replace ruma_common::serde::urlencoded with serde_html_form 2023-01-02 17:47:33 +01:00
Jonas Platte
ad3c27d927
events: Make redacted_because non-optional in RedactedUnsigned 2022-12-15 12:47:27 +01:00
Jonas Platte
cdabe8e52d events: Remove Serialize impls for all event types except ToDeviceEvent 2022-12-15 10:41:30 +01:00
Jonas Platte
a5c5b0b137
Make clippy happy 2022-12-09 11:45:04 +01:00
Jonas Platte
3211fccab0
Remove borrowing in requests 2022-11-28 14:02:35 +01:00
Kévin Commaille
5faff343a0 events: Use Reference instead of events::poll::ReferenceRelation 2022-11-25 22:33:37 +01:00
Kévin Commaille
6648954bd2 events: Move common relation structs under events::room::encrypted to events::relation 2022-11-25 22:33:37 +01:00
Kévin Commaille
aeaa4af776 events: Move relations under events::room::message to events::relation 2022-11-25 22:33:37 +01:00
Kévin Commaille
1ecd7effc0
events: Add tests for serde of encrypted relations 2022-11-25 18:51:12 +01:00
Kévin Commaille
dc18b12506
events: Fix deserialization without relation 2022-11-25 18:40:19 +01:00
Jonas Platte
ae3394a6df api: Turn metadata name and description fields into docstrings 2022-11-12 10:17:24 +01:00
Jonas Platte
bdb5950fe4 macros: Remove ruma_api! macro 2022-11-12 10:17:24 +01:00
Jonas Platte
80c060cb69 Remove usage of ruma_api! 2022-11-12 10:17:24 +01:00
Jonas Platte
2500e8f8fa api: Make query_string parameter of make_endpoint_url non-optional
When Some(_), the argument would often be an empty string. By always
using the empty string to mean "no query", we avoid trailing a `?` on
URLs without having two parameter values that mean the same thing.
2022-11-11 11:27:07 +01:00
Jonas Platte
a8ba82d585 api: Make EndpointError construction infallible
Simplifies error matching and preserves more information for
non-spec-compliant server errors.
2022-11-10 13:10:57 +01:00
Jonas Platte
08dcf1e224
api: Add VersionHistory::{deprecated_in, removed_in} 2022-11-10 11:33:17 +01:00
Jonas Platte
866b01d0c2
api: Rename VersionHistory::added_version to added_in
… and reword its documentation.
2022-11-10 11:33:17 +01:00
Jonas Platte
848ca9b225
api: Rework VersionHistory path accessors
* Return iterators
* Rename all_unstable_paths to unstable_paths
* Rename all_versioned_stable_paths to stable_paths
2022-11-10 11:33:17 +01:00
Jonas Platte
94990f60f2 events: Don't skip serializing empty content of redacted events 2022-11-09 17:11:50 +01:00
Xiretza
69c807bdc1
events: Escape plain bodies in replies
Replies generate an HTML body even if the reply itself only consists of
plain text. In order to convert the plain text to HTML, it has to be
escaped, which did not happen previously.
2022-11-03 13:16:01 +01:00
Jonas Platte
3eb82950f2
Remove accidentally duplicated file 2022-11-01 12:39:55 +01:00
Jonas Platte
ec67fcbd6f api: Use VersionHistory::new from ruma_api!
… and remove a now-redundant check from the macro code.
2022-10-28 10:38:52 +02:00
Jonathan de Jong
e783d77db7
api: Add VersionHistory const fn new 2022-10-26 18:00:46 +02:00
Jonas Platte
c7e84c5249
Fix clippy lints
Automated using `cargo clippy --fix`.
2022-10-26 13:38:29 +02:00
Jonas Platte
ec31badd84
api: Replace path fields in Metadata with new VersionHistory type
Co-authored-by: Jonathan de Jong <jonathan@automatia.nl>
2022-10-22 11:17:55 +02:00
Jonas Platte
451a50a77b
api: Add missing cfg for test 2022-10-22 11:12:52 +02:00
Kévin Commaille
a3675e61bf events: Add method to construct a replacement 2022-10-21 10:40:33 +02:00
Jonas Platte
764e96a254
api: Enforce consistent path field order 2022-10-20 20:51:09 +02:00
Kévin Commaille
21bda6678d events: Enable more markdown syntax
Enable markdown extensions that produces spec-compliant HTML.
2022-10-19 21:44:33 +02:00
Kévin Commaille
a710229d9d events: Fix markdown content detection
Encoded HTML entities would be detected as a change.
Use the parsed events instead to check if markdown syntax was detected.
2022-10-19 21:44:33 +02:00
Kévin Commaille
7c0f7ba5f1 events: Make Replacement generic over the parent type
Because the new content must be of the same type.
2022-10-17 20:27:49 +02:00
Kévin Commaille
ec853e968a events: Generate structs without relation for events that can be replaced 2022-10-17 20:27:49 +02:00
Kévin Commaille
e6e7e52034 client-api: Send CORP headers by default for media responses
According to MSC3828.
2022-10-10 19:09:39 +02:00
Kévin Commaille
739c35aaca api: Allow to use any HeaderName with the header keyword of ruma_api 2022-10-10 19:09:39 +02:00
Kévin Commaille
99ae790446 events: Remove redundant tests
There are similar tests in the relations module
2022-10-10 18:23:03 +02:00
Kévin Commaille
4e2dac30be events: Stabilize support for event replacements 2022-10-10 18:23:03 +02:00