-
-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unstable support for MSC 3489 live location sharing #1722
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, and thanks for the PR!
Please note that all of the modules in ruma-events
that define event (content) types are named after the event type. That means that the live_location
module you added should be split into two modules beacon
and beacon_info
.
c32b059
to
e644e8a
Compare
a996c48
to
14b3ab1
Compare
f613503
to
f1088d6
Compare
@jplatte This has been revamped and should be ready for a second look if you have some spare time! |
Add missing even type to beacon handling This is a work in progress. move beacon struct to `beacon` module wip cleanup make it compile; add test ensure that location is enabled for beacon live sharing use beacon_info instead of beacon for state event cleanup feat(beacon): add unstable support for msc-3489 feat(beacon): add unstable support for msc-3489 squash commits refactor(beacon_info): rename files to be consistent with spec name tests(beacon_info): Update beacon_info test for serialization and de_serialization revert(pinnedevents): remove accdiental change chore: update formatting docs(beacon_info): update descriptions clean up tests refactor(beacon_info): update file naming and paths feat(beacon): integrate beacon event with tests test(beacon_info): fix broken test for creating asset type refactor(beacon_info): update constructor params for owned_event_id and geo_uri fix(enums): beacon info import fix remove unused imports fix(beacon_info): bad naming alias fix(beacon_info): set the default ts time on creation fix(beacon_info): fix tests for calculating expiration remove some docs docs(changelog): update changelog fix clippy use passed in value or now fix clippy fix tests update docs update correct changelog revert changelog revert changes update changelog
8030601
to
2c7eef4
Compare
0de6147
to
3f2c5e4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, just a few nits remaining.
} | ||
|
||
#[test] | ||
fn beacon_info_start_event_content_serialization() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we have tests of full event (BeaconInfoEvent
) serialization and deserialization too?
} | ||
|
||
#[test] | ||
fn beacon_event_content_serialization() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we have tests of full event (BeaconEvent
) serialization and deserialization too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
something like this? Not a complete example, just making sure this is what you are expecting generally
#[test]
fn message_event_deserialization() {
let json_data = json!({
"content": get_beacon_event_content_json(),
"event_id": "$beacon_event_id:example.com",
"origin_server_ts": 1_636_829_458,
"room_id": "!roomid:example.com",
"type": "org.matrix.msc3672.beacon",
"sender": "@example:example.com"
});
let event = from_json_value::<AnyMessageLikeEvent>(json_data).unwrap();
assert_matches!(event, AnyMessageLikeEvent::Beacon(MessageLikeEvent::Original(message_event)));
assert_eq!(
message_event.content.relates_to.event_id,
owned_event_id!("$beacon_info_event_id:example.com")
);
assert_eq!(message_event.content.location.uri, "geo:51.5008,0.1247;u=35");
assert_eq!(message_event.content.ts, MilliSecondsSinceUnixEpoch(uint!(1_636_829_458)));
assert_matches!(message_event.content.relates_to, Reference { event_id, .. });
assert_eq!(message_event.sender, "@example:example.com");
assert_eq!(message_event.room_id, "!roomid:example.com");
assert_eq!(message_event.event_id, owned_event_id!("$beacon_event_id:example.com"));
assert_eq!(message_event.origin_server_ts, MilliSecondsSinceUnixEpoch(uint!(1_636_829_458)));
assert!(message_event.unsigned.is_empty());
}
This merge request introduces the live location sharing feature as per MSC3489.
These changes allow users to share their live location, start and stop the sharing, and check if the location sharing is live.