element-hq / dendrite

Dendrite is a second-generation Matrix homeserver written in Go!
https://element-hq.github.io/dendrite/
GNU Affero General Public License v3.0
37 stars 6 forks source link

Edited messages appear twice in fulltext search #3358

Closed matrixbot closed 3 weeks ago

matrixbot commented 3 weeks ago

This issue was originally created by @S7evinK at https://github.com/matrix-org/dendrite/issues/3358.

When a message is edited, they appear twice in the results of /search. While Element Web seems to aggregate the results and only returns one results, Element Android returns both. This may be a bit confusing.

IMO, Dendrite should only return the latest message.

The responsible code for this: https://github.com/matrix-org/dendrite/blob/14a6c100977be6484eec419fdc8f496eb27b0677/syncapi/consumers/roomserver.go#L593-L627

We'd need to check if m.relates.to in content contains a rel_type of m.replace and then delete the event_id from the fulltext index before indexing the new event.

matrixbot commented 3 weeks ago

This comment was originally posted by @adnull at https://github.com/matrix-org/dendrite/issues/3358#issuecomment-2061519877.

Hi! I'd like to take this.

matrixbot commented 3 weeks ago

This comment was originally posted by @S7evinK at https://github.com/matrix-org/dendrite/issues/3358#issuecomment-2063067102.

Sure, go for it! :)

matrixbot commented 3 weeks ago

This comment was originally posted by @S7evinK at https://github.com/matrix-org/dendrite/issues/3358#issuecomment-2254247191.

Fixed with #3363.