Fix a bug where redactions were not being sent over federation if we did not have the original event.
Prior to this change, redactions were not sent over federation if the sending server hadn't received the original event. Fixes #12795. Per the discussion on #12795, this is achieved by making the function EventsWorkerStore._get_events_from_cache_or_db public and using that rather than EventsWorkerStore.get_events_as_list, which drops redaction events if the original event isn't present. I wrote a test to verify that this change works, you can see it here: https://github.com/matrix-org/complement/actions/runs/3055371487/jobs/4929450057
Complement test is https://github.com/matrix-org/complement/pull/462
We now have
get_events_from_cache_or_dbandget_events_as_listwhich both sound like they do the same thing but have different behaviour with regard to redaction events.
I don't disagree, and it's basically the point I made on #12795:
having lots of similar-but-different entry points makes a component hard to use correctly.
Still, I can't think of a better solution here. What we could do is try to find names that better describe the functionality (maybe s/get_events_from_cache_or_db/get_unredacted_events? other suggestions welcome) and spell out the differences between the entry points in the docstrings.
Merged #13813 into develop, thanks for the explanations and the review!