ruma / homeserver

A Matrix homeserver written in Rust.
https://www.ruma.io/
1.08k stars 41 forks source link

Sending m.room.member and m.presence events again after changing avatar or displayname #157

Open farodin91 opened 7 years ago

farodin91 commented 7 years ago

See http://matrix.org/speculator/spec/HEAD/client_server/unstable.html#events-on-change-of-profile-information

farodin91 commented 7 years ago

Source code:

jooert commented 7 years ago

Perhaps I'm misunderstanding something here, but isn't that already implemented? Avatar and display name can only be changed through the /profile API and the handlers for PutAvatarUrl and PutDisplayName both call models::profile::Profile::update_memberships which then calls RoomMembership::update which finally emits an m.room.member event.

mujx commented 7 years ago

@jooert Seems you are right regarding the m.room.member event. Reading through the code the issue seems to be about the m.presence event also.

The problems is in PresenceStatus::upsert which is called after a profile update. Here we create the event_id but we don't use it to create the actual event in PresenceStatus::update (like we do in PresenceStatus::create) which leave us with a dangling event_id.