No Backbone in data layer; server/client interfaces are now similar

This commit is contained in:
Scott Nonnenberg 2021-12-10 14:51:54 -08:00 committed by GitHub
parent 064bbfe97a
commit 34fd945f83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 573 additions and 1021 deletions

View file

@ -5,6 +5,7 @@
import { Collection, Model } from 'backbone';
import type { MessageModel } from '../models/messages';
import { getContactId, getContact } from '../messages/helpers';
import { isOutgoing } from '../state/selectors/message';
import type { ReactionAttributesType } from '../model-types.d';
import * as log from '../logging/log';
@ -35,7 +36,7 @@ export class Reactions extends Collection<ReactionModel> {
}
}
const senderId = message.getContactId();
const senderId = getContactId(message.attributes);
const sentAt = message.get('sent_at');
const reactionsBySource = this.filter(re => {
const targetSenderId = window.ConversationController.ensureContactIds({
@ -87,15 +88,12 @@ export class Reactions extends Collection<ReactionModel> {
log.info('Handling reaction for', reaction.get('targetTimestamp'));
const messages = await window.Signal.Data.getMessagesBySentAt(
reaction.get('targetTimestamp'),
{
MessageCollection: window.Whisper.MessageCollection,
}
reaction.get('targetTimestamp')
);
// Message is fetched inside the conversation queue so we have the
// most recent data
const targetMessage = messages.find(m => {
const contact = m.getContact();
const contact = getContact(m);
if (!contact) {
return false;