(device *userapi.Device, in []types.StreamEvent)
| 294 | } |
| 295 | |
| 296 | func (d *Database) StreamEventsToEvents(device *userapi.Device, in []types.StreamEvent) []*gomatrixserverlib.HeaderedEvent { |
| 297 | out := make([]*gomatrixserverlib.HeaderedEvent, len(in)) |
| 298 | for i := 0; i < len(in); i++ { |
| 299 | out[i] = in[i].HeaderedEvent |
| 300 | if device != nil && in[i].TransactionID != nil { |
| 301 | if device.UserID == in[i].Sender() && device.SessionID == in[i].TransactionID.SessionID { |
| 302 | err := out[i].SetUnsignedField( |
| 303 | "transaction_id", in[i].TransactionID.TransactionID, |
| 304 | ) |
| 305 | if err != nil { |
| 306 | logrus.WithFields(logrus.Fields{ |
| 307 | "event_id": out[i].EventID(), |
| 308 | }).WithError(err).Warnf("Failed to add transaction ID to event") |
| 309 | } |
| 310 | } |
| 311 | } |
| 312 | } |
| 313 | return out |
| 314 | } |
| 315 | |
| 316 | // handleBackwardExtremities adds this event as a backwards extremity if and only if we do not have all of |
| 317 | // the events listed in the event's 'prev_events'. This function also updates the backwards extremities table |
no outgoing calls
no test coverage detected