Skip to content

Commit

Permalink
Fix global custom colored quote in composition area
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-signal committed Jun 3, 2021
1 parent 53d6065 commit cdf8b0b
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions ts/models/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
import { CallbackResultType } from '../textsecure/SendMessage';
import * as expirationTimer from '../util/expirationTimer';
import { missingCaseError } from '../util/missingCaseError';
import { ConversationColorType } from '../types/Colors';
import { ConversationColors } from '../types/Colors';
import { CallMode } from '../types/Calling';
import { BodyRangesType } from '../types/Util';
import { ReactionType } from '../types/Reactions';
Expand Down Expand Up @@ -957,11 +957,6 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
.map(attachment => this.getPropsForAttachment(attachment));
}

getConversationColor(): ConversationColorType {
const conversation = this.getConversation();
return conversation?.getConversationColor() || ('ultramarine' as const);
}

// Note: interactionMode is mixed in via selectors/conversations._messageSelector
getPropsForMessage(): PropsForMessage {
const sourceId = this.getContactId();
Expand Down Expand Up @@ -996,13 +991,18 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
) || {}
).emoji;

const { customColor = undefined } = conversation
? conversation.getCustomColorData()
: {};

return {
author: contact,
text: this.createNonBreakingLastSeparator(this.get('body')),
textPending: this.get('bodyPending'),
id: this.id,
conversationColor: this.getConversationColor(),
customColor: conversation?.getCustomColorData()?.customColor,
conversationColor:
conversation?.getConversationColor() ?? ConversationColors[0],
customColor,
conversationId: this.get('conversationId'),
isSticker: Boolean(sticker),
direction: this.isIncoming() ? 'incoming' : 'outgoing',
Expand Down Expand Up @@ -1330,15 +1330,21 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {

const firstAttachment = quote.attachments && quote.attachments[0];

const conversation = this.getConversation();
const { customColor = undefined } = conversation
? conversation.getCustomColorData()
: {};

return {
authorId,
authorName,
authorPhoneNumber,
authorProfileName,
authorTitle,
bodyRanges: this.processBodyRanges(bodyRanges),
conversationColor: this.getConversationColor(),
customColor: this.getConversation()?.get('customColor'),
conversationColor:
conversation?.getConversationColor() ?? ConversationColors[0],
customColor,
isFromMe,
rawAttachment: firstAttachment
? this.processQuoteAttachment(firstAttachment)
Expand Down

0 comments on commit cdf8b0b

Please sign in to comment.