remove authorColor unused in Session

This commit is contained in:
Audric Ackermann 2020-09-15 15:24:57 +10:00
parent 6eb13e43e3
commit 56cd42d34c
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4
24 changed files with 7 additions and 74 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 555 B

View File

@ -73,7 +73,6 @@
'folder-outline.svg', 'folder-outline.svg',
'forward.svg', 'forward.svg',
'gear.svg', 'gear.svg',
'group_default.png',
'hourglass_empty.svg', 'hourglass_empty.svg',
'hourglass_full.svg', 'hourglass_full.svg',
'icon_1024.png', 'icon_1024.png',
@ -731,7 +730,6 @@
profileName: displayName, profileName: displayName,
pubkey: ourNumber, pubkey: ourNumber,
avatarPath, avatarPath,
avatarColor: conversation.getColor(),
onOk: async (newName, avatar) => { onOk: async (newName, avatar) => {
let newAvatarPath = ''; let newAvatarPath = '';
let url = null; let url = null;
@ -1065,7 +1063,6 @@
profileName: displayName, profileName: displayName,
pubkey: userPubKey, pubkey: userPubKey,
avatarPath, avatarPath,
avatarColor: conversation.getColor(),
isRss: conversation.isRss(), isRss: conversation.isRss(),
onStartConversation: () => { onStartConversation: () => {
Whisper.events.trigger('showConversation', userPubKey); Whisper.events.trigger('showConversation', userPubKey);

View File

@ -32,7 +32,6 @@
UNRESTRICTED: 3, UNRESTRICTED: 3,
}; };
const { Util } = window.Signal;
const { const {
Conversation, Conversation,
Contact, Contact,
@ -571,7 +570,6 @@
getProps() { getProps() {
const { format } = PhoneNumber; const { format } = PhoneNumber;
const regionCode = storage.get('regionCode'); const regionCode = storage.get('regionCode');
const color = this.getColor();
const typingKeys = Object.keys(this.contactTypingTimers || {}); const typingKeys = Object.keys(this.contactTypingTimers || {});
const result = { const result = {
@ -579,7 +577,6 @@
isArchived: this.get('isArchived'), isArchived: this.get('isArchived'),
activeAt: this.get('active_at'), activeAt: this.get('active_at'),
avatarPath: this.getAvatarPath(), avatarPath: this.getAvatarPath(),
color,
type: this.isPrivate() ? 'direct' : 'group', type: this.isPrivate() ? 'direct' : 'group',
isMe: this.isMe(), isMe: this.isMe(),
isPublic: this.isPublic(), isPublic: this.isPublic(),
@ -2526,14 +2523,6 @@
return this.get('type') === 'private'; return this.get('type') === 'private';
}, },
getColor() {
if (!this.isPrivate()) {
return 'signal-blue';
}
const { migrateColor } = Util;
return migrateColor(this.get('color'));
},
getAvatarPath() { getAvatarPath() {
const avatar = this.get('avatar') || this.get('profileAvatar'); const avatar = this.get('avatar') || this.get('profileAvatar');
@ -2549,19 +2538,17 @@
}, },
getAvatar() { getAvatar() {
const title = this.get('name'); const title = this.get('name');
const color = this.getColor();
const url = this.getAvatarPath(); const url = this.getAvatarPath();
if (url) { if (url) {
return { url, color }; return { url };
} else if (this.isPrivate()) { } else if (this.isPrivate()) {
const symbol = this.isValid() ? '#' : '!'; const symbol = this.isValid() ? '#' : '!';
return { return {
color,
content: this.getInitials(title) || symbol, content: this.getInitials(title) || symbol,
}; };
} }
return { url: 'images/group_default.png', color }; return { url: null };
}, },
getNotificationIcon() { getNotificationIcon() {

View File

@ -414,7 +414,6 @@
const regionCode = storage.get('regionCode'); const regionCode = storage.get('regionCode');
const contactModel = this.findContact(phoneNumber); const contactModel = this.findContact(phoneNumber);
const color = contactModel ? contactModel.getColor() : null;
let profileName; let profileName;
if (phoneNumber === window.storage.get('primaryDevicePubKey')) { if (phoneNumber === window.storage.get('primaryDevicePubKey')) {
profileName = i18n('you'); profileName = i18n('you');
@ -426,7 +425,7 @@
phoneNumber: format(phoneNumber, { phoneNumber: format(phoneNumber, {
ourRegionCode: regionCode, ourRegionCode: regionCode,
}), }),
color, color: null,
avatarPath: contactModel ? contactModel.getAvatarPath() : null, avatarPath: contactModel ? contactModel.getAvatarPath() : null,
name: contactModel ? contactModel.getName() : null, name: contactModel ? contactModel.getName() : null,
profileName, profileName,
@ -565,7 +564,6 @@
const contact = this.findAndFormatContact(phoneNumber); const contact = this.findAndFormatContact(phoneNumber);
const contactModel = this.findContact(phoneNumber); const contactModel = this.findContact(phoneNumber);
const authorColor = contactModel ? contactModel.getColor() : null;
const authorAvatarPath = contactModel const authorAvatarPath = contactModel
? contactModel.getAvatarPath() ? contactModel.getAvatarPath()
: null; : null;
@ -599,7 +597,6 @@
serverTimestamp: this.get('serverTimestamp'), serverTimestamp: this.get('serverTimestamp'),
status: this.getMessagePropStatus(), status: this.getMessagePropStatus(),
contact: this.getPropsForEmbeddedContact(), contact: this.getPropsForEmbeddedContact(),
authorColor,
authorName: contact.name, authorName: contact.name,
authorProfileName: contact.profileName, authorProfileName: contact.profileName,
authorPhoneNumber: contact.phoneNumber, authorPhoneNumber: contact.phoneNumber,
@ -764,7 +761,6 @@
const { author, id, referencedMessageNotFound } = quote; const { author, id, referencedMessageNotFound } = quote;
const contact = author && ConversationController.get(author); const contact = author && ConversationController.get(author);
const authorColor = contact ? contact.getColor() : 'grey';
const authorPhoneNumber = format(author, { const authorPhoneNumber = format(author, {
ourRegionCode: regionCode, ourRegionCode: regionCode,
@ -794,7 +790,6 @@
authorPhoneNumber, authorPhoneNumber,
authorProfileName, authorProfileName,
authorName, authorName,
authorColor,
onClick, onClick,
referencedMessageNotFound, referencedMessageNotFound,
}; };

View File

@ -1424,7 +1424,7 @@ class LokiPublicChannelAPI {
value: { value: {
name: 'Your Public Chat', name: 'Your Public Chat',
description: 'Your public chat room', description: 'Your public chat room',
avatar: 'images/group_default.png', avatar: null,
}, },
}, },
]; ];

View File

@ -32,7 +32,6 @@
Component: window.Signal.Components.ContactListItem, Component: window.Signal.Components.ContactListItem,
props: { props: {
isMe, isMe,
color: this.model.getColor(),
avatarPath: this.model.getAvatarPath(), avatarPath: this.model.getAvatarPath(),
phoneNumber: this.model.getNumber(), phoneNumber: this.model.getNumber(),
name: this.model.getName(), name: this.model.getName(),

View File

@ -165,7 +165,6 @@
name: this.model.getName(), name: this.model.getName(),
phoneNumber: this.model.getNumber(), phoneNumber: this.model.getNumber(),
profileName: this.model.getProfileName(), profileName: this.model.getProfileName(),
color: this.model.getColor(),
avatarPath: this.model.getAvatarPath(), avatarPath: this.model.getAvatarPath(),
isVerified: this.model.isVerified(), isVerified: this.model.isVerified(),
isMe: this.model.isMe(), isMe: this.model.isMe(),
@ -279,7 +278,6 @@
name: this.model.getName(), name: this.model.getName(),
phoneNumber: this.model.getNumber(), phoneNumber: this.model.getNumber(),
profileName: this.model.getProfileName(), profileName: this.model.getProfileName(),
color: this.model.getColor(),
avatarPath: this.model.getAvatarPath(), avatarPath: this.model.getAvatarPath(),
isGroup: !this.model.isPrivate(), isGroup: !this.model.isPrivate(),
isPublic: this.model.isPublic(), isPublic: this.model.isPublic(),

View File

@ -8,21 +8,13 @@
Whisper.EditProfileDialogView = Whisper.View.extend({ Whisper.EditProfileDialogView = Whisper.View.extend({
className: 'loki-dialog modal', className: 'loki-dialog modal',
initialize({ initialize({ profileName, avatarPath, pubkey, onOk, callback }) {
profileName,
avatarPath,
avatarColor,
pubkey,
onOk,
callback,
}) {
this.close = this.close.bind(this); this.close = this.close.bind(this);
this.callback = callback; this.callback = callback;
this.profileName = profileName; this.profileName = profileName;
this.pubkey = pubkey; this.pubkey = pubkey;
this.avatarPath = avatarPath; this.avatarPath = avatarPath;
this.avatarColor = avatarColor;
this.onOk = onOk; this.onOk = onOk;
this.$el.focus(); this.$el.focus();

View File

@ -11,7 +11,6 @@
initialize({ initialize({
profileName, profileName,
avatarPath, avatarPath,
avatarColor,
pubkey, pubkey,
isRss, isRss,
onOk, onOk,
@ -23,7 +22,6 @@
this.pubkey = pubkey; this.pubkey = pubkey;
this.isRss = isRss; this.isRss = isRss;
this.avatarPath = avatarPath; this.avatarPath = avatarPath;
this.avatarColor = avatarColor;
this.onOk = onOk; this.onOk = onOk;
this.onStartConversation = onStartConversation; this.onStartConversation = onStartConversation;

View File

@ -86,11 +86,8 @@ export class Avatar extends React.PureComponent<Props, State> {
/> />
); );
} }
console.warn(
'renderNoImage should not happen with something else than a closed group'
);
return <div className={classNames('module-avatar__icon')} />; return this.renderIdenticon();
} }
public render() { public render() {
@ -121,7 +118,7 @@ export class Avatar extends React.PureComponent<Props, State> {
}} }}
role="button" role="button"
> >
{hasImage ? this.renderAvatarOrIdenticon() : this.renderNoImage()} {hasImage ? this.renderImage() : this.renderNoImage()}
</div> </div>
); );
} }
@ -133,12 +130,6 @@ export class Avatar extends React.PureComponent<Props, State> {
} }
} }
private renderAvatarOrIdenticon() {
const { avatarPath } = this.props;
return avatarPath ? this.renderImage() : this.renderIdenticon();
}
private getAvatarColors(): Array<string> { private getAvatarColors(): Array<string> {
// const theme = window.Events.getThemedSettings(); // const theme = window.Events.getThemedSettings();
// defined in session-android as `profile_picture_placeholder_colors` // defined in session-android as `profile_picture_placeholder_colors`

View File

@ -10,7 +10,6 @@ interface Props {
phoneNumber: string; phoneNumber: string;
isMe?: boolean; isMe?: boolean;
name?: string; name?: string;
color: string;
verified: boolean; verified: boolean;
profileName?: string; profileName?: string;
avatarPath?: string; avatarPath?: string;

View File

@ -30,7 +30,6 @@ interface Props {
i18n: any; i18n: any;
profileName: string; profileName: string;
avatarPath: string; avatarPath: string;
avatarColor: string;
pubkey: string; pubkey: string;
onClose: any; onClose: any;
onOk: any; onOk: any;

View File

@ -14,7 +14,6 @@ interface Props {
isRss: boolean; isRss: boolean;
profileName: string; profileName: string;
avatarPath: string; avatarPath: string;
avatarColor: string; //fixme audric toremove
pubkey: string; pubkey: string;
onClose: any; onClose: any;
onStartConversation: any; onStartConversation: any;

View File

@ -50,7 +50,6 @@ export class CreateGroupDialog extends React.Component<Props, State> {
authorProfileName: name, authorProfileName: name,
selected: false, selected: false,
authorName: name, // different from ProfileName? authorName: name, // different from ProfileName?
authorColor: d.getColor(),
checkmarked: false, checkmarked: false,
}; };
}); });

View File

@ -45,7 +45,6 @@ export class InviteContactsDialog extends React.Component<Props, State> {
authorAvatarPath: d?.cachedProps?.avatarPath, authorAvatarPath: d?.cachedProps?.avatarPath,
selected: false, selected: false,
authorName: name, authorName: name,
authorColor: d.getColor(),
checkmarked: false, checkmarked: false,
existingMember, existingMember,
}; };

View File

@ -8,7 +8,6 @@ export interface Contact {
authorProfileName: string; authorProfileName: string;
authorPhoneNumber: string; authorPhoneNumber: string;
authorName: string; authorName: string;
authorColor: any;
authorAvatarPath: string; authorAvatarPath: string;
checkmarked: boolean; checkmarked: boolean;
existingMember: boolean; existingMember: boolean;

View File

@ -78,7 +78,6 @@ export interface Props {
authorProfileName?: string; authorProfileName?: string;
/** Note: this should be formatted for display */ /** Note: this should be formatted for display */
authorPhoneNumber: string; authorPhoneNumber: string;
authorColor?: ColorType;
conversationType: 'group' | 'direct'; conversationType: 'group' | 'direct';
attachments?: Array<AttachmentType>; attachments?: Array<AttachmentType>;
quote?: { quote?: {
@ -88,7 +87,6 @@ export interface Props {
authorPhoneNumber: string; authorPhoneNumber: string;
authorProfileName?: string; authorProfileName?: string;
authorName?: string; authorName?: string;
authorColor?: ColorType;
onClick?: () => void; onClick?: () => void;
referencedMessageNotFound: boolean; referencedMessageNotFound: boolean;
}; };
@ -585,7 +583,6 @@ export class Message extends React.PureComponent<Props, State> {
public renderQuote() { public renderQuote() {
const { const {
conversationType, conversationType,
authorColor,
direction, direction,
i18n, i18n,
quote, quote,
@ -599,8 +596,6 @@ export class Message extends React.PureComponent<Props, State> {
const withContentAbove = const withContentAbove =
conversationType === 'group' && direction === 'incoming'; conversationType === 'group' && direction === 'incoming';
const quoteColor =
direction === 'incoming' ? authorColor : quote.authorColor;
const shortenedPubkey = window.shortenPubkey(quote.authorPhoneNumber); const shortenedPubkey = window.shortenPubkey(quote.authorPhoneNumber);
@ -621,7 +616,6 @@ export class Message extends React.PureComponent<Props, State> {
authorPhoneNumber={displayedPubkey} authorPhoneNumber={displayedPubkey}
authorProfileName={quote.authorProfileName} authorProfileName={quote.authorProfileName}
authorName={quote.authorName} authorName={quote.authorName}
authorColor={quoteColor}
referencedMessageNotFound={quote.referencedMessageNotFound} referencedMessageNotFound={quote.referencedMessageNotFound}
isFromMe={quote.isFromMe} isFromMe={quote.isFromMe}
withContentAbove={withContentAbove} withContentAbove={withContentAbove}
@ -668,7 +662,6 @@ export class Message extends React.PureComponent<Props, State> {
authorProfileName, authorProfileName,
collapseMetadata, collapseMetadata,
senderIsModerator, senderIsModerator,
authorColor,
conversationType, conversationType,
direction, direction,
i18n, i18n,
@ -1052,7 +1045,6 @@ export class Message extends React.PureComponent<Props, State> {
public render() { public render() {
const { const {
authorPhoneNumber, authorPhoneNumber,
authorColor,
direction, direction,
id, id,
isKickedFromGroup, isKickedFromGroup,

View File

@ -51,7 +51,6 @@ export class AddModeratorsDialog extends React.Component<Props, State> {
authorProfileName: name, authorProfileName: name,
selected: false, selected: false,
authorName: name, authorName: name,
authorColor: d.getColor(),
checkmarked: false, checkmarked: false,
existingMember, existingMember,
}; };
@ -97,7 +96,6 @@ export class AddModeratorsDialog extends React.Component<Props, State> {
authorAvatarPath: '', authorAvatarPath: '',
selected: true, selected: true,
authorName: this.state.inputBoxValue, authorName: this.state.inputBoxValue,
authorColor: '#000000',
checkmarked: true, checkmarked: true,
existingMember: false, existingMember: false,
}); });

View File

@ -34,7 +34,6 @@ export class RemoveModeratorsDialog extends React.Component<Props, State> {
const lokiProfile = d.getLokiProfile(); const lokiProfile = d.getLokiProfile();
name = lokiProfile ? lokiProfile.displayName : 'Anonymous'; name = lokiProfile ? lokiProfile.displayName : 'Anonymous';
} }
const authorColor = d.getColor ? d.getColor() : '#000000';
// TODO: should take existing members into account // TODO: should take existing members into account
const existingMember = false; const existingMember = false;
@ -44,7 +43,6 @@ export class RemoveModeratorsDialog extends React.Component<Props, State> {
authorProfileName: name, authorProfileName: name,
selected: false, selected: false,
authorName: name, authorName: name,
authorColor,
checkmarked: true, checkmarked: true,
existingMember, existingMember,
}; };

View File

@ -15,7 +15,6 @@ interface Props {
authorPhoneNumber: string; authorPhoneNumber: string;
authorProfileName?: string; authorProfileName?: string;
authorName?: string; authorName?: string;
authorColor?: ColorType;
i18n: LocalizerType; i18n: LocalizerType;
isFromMe: boolean; isFromMe: boolean;
isIncoming: boolean; isIncoming: boolean;
@ -365,7 +364,6 @@ export class Quote extends React.Component<Props, State> {
public render() { public render() {
const { const {
authorColor,
isIncoming, isIncoming,
onClick, onClick,
referencedMessageNotFound, referencedMessageNotFound,

View File

@ -52,7 +52,6 @@ export class UpdateGroupMembersDialog extends React.Component<Props, State> {
authorAvatarPath: d?.cachedProps?.avatarPath, authorAvatarPath: d?.cachedProps?.avatarPath,
selected: false, selected: false,
authorName: name, // different from ProfileName? authorName: name, // different from ProfileName?
authorColor: d.getColor(),
checkmarked: false, checkmarked: false,
existingMember, existingMember,
}; };

View File

@ -122,7 +122,6 @@ export class ActionsPanel extends React.Component<Props, State> {
onSelect?: (event: SectionType) => void; onSelect?: (event: SectionType) => void;
type: SectionType; type: SectionType;
avatarPath?: string; avatarPath?: string;
avatarColor?: string;
notificationCount?: number; notificationCount?: number;
}) => { }) => {
const handleClick = onSelect const handleClick = onSelect

View File

@ -95,7 +95,6 @@ export class SessionClosableOverlay extends React.Component<Props, State> {
authorAvatarPath: d.avatarPath, authorAvatarPath: d.avatarPath,
selected: false, selected: false,
authorName: name, authorName: name,
authorColor: d.color,
checkmarked: false, checkmarked: false,
existingMember, existingMember,
}; };

View File

@ -10,7 +10,6 @@ export interface ContactType {
authorProfileName: string; authorProfileName: string;
authorPhoneNumber: string; authorPhoneNumber: string;
authorName: string; authorName: string;
authorColor: any;
authorAvatarPath: string; authorAvatarPath: string;
checkmarked: boolean; checkmarked: boolean;
existingMember: boolean; existingMember: boolean;