-
Notifications
You must be signed in to change notification settings - Fork 57
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
Post Event PendingEventItems #861
base: dev
Are you sure you want to change the base?
Conversation
Quality Gate passedIssues Measures |
@@ -850,7 +850,7 @@ public Q_SLOTS: | |||
/// The event is about to be appended to the list of pending events | |||
void pendingEventAboutToAdd(Quotient::RoomEvent* event); | |||
/// An event has been appended to the list of pending events | |||
void pendingEventAdded(const Quotient::RoomEvent* event); | |||
void pendingEventAdded(const PendingEventItem& pendingItem); |
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.
I'm not sure it's a good idea; for one, you cannot use a queued connection with this signal because a reference cannot be copied; and besides, this reference is at risk of dangling if any slot connected to pendingEventAdded
causes adding another pending event to the same room (I stumbled over it when writing Quotest, some time ago). At the very least, these caveats should be in the signal documentation.
//! | ||
//! The future will get finished just before this pending item is merged into its remote | ||
//! counterpart that comes with /sync. The pending item will always be in ReachedServer state. | ||
//! The future result has type implicitly convertible to std::pair with a `const RoomEvent&` and an `int`. | ||
about_to_merge_future_type whenAboutToMerged() const { return _aboutToMergePromise.future(); } |
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.
Do you have code that would use it? Or at least can you give an idea of code that would use it? Futures are generally heavier than signal-slot connections.
Always return pending event items when posting events rather than transaction IDs
Also add a future for about to merge as it's useful when rearranging a timeline model (we need to know where the pending event was in the timeline to make sure it can be moved to the right place and this isn't available after merge)