remove isClosable for convo as it is unused

pull/1459/head
Audric Ackermann 4 years ago
parent b218611831
commit 13df6c476e

@ -58,7 +58,6 @@ export interface ConversationModel
isPublic: () => boolean; isPublic: () => boolean;
isClosedGroup: () => boolean; isClosedGroup: () => boolean;
isBlocked: () => boolean; isBlocked: () => boolean;
isClosable: () => boolean;
isAdmin: (id: string) => boolean; isAdmin: (id: string) => boolean;
throttledBumpTyping: () => void; throttledBumpTyping: () => void;

@ -115,9 +115,7 @@
isClosedGroup() { isClosedGroup() {
return this.get('type') === Message.GROUP && !this.isPublic(); return this.get('type') === Message.GROUP && !this.isPublic();
}, },
isClosable() {
return this.get('closable');
},
isBlocked() { isBlocked() {
if (!this.id || this.isMe()) { if (!this.id || this.isMe()) {
return false; return false;
@ -400,7 +398,6 @@
type: this.isPrivate() ? 'direct' : 'group', type: this.isPrivate() ? 'direct' : 'group',
isMe: this.isMe(), isMe: this.isMe(),
isPublic: this.isPublic(), isPublic: this.isPublic(),
isClosable: this.isClosable(),
isTyping: typingKeys.length > 0, isTyping: typingKeys.length > 0,
lastUpdated: this.get('timestamp'), lastUpdated: this.get('timestamp'),
name: this.getName(), name: this.getName(),

@ -34,7 +34,6 @@ export type ConversationListItemProps = {
avatarPath?: string; avatarPath?: string;
isMe: boolean; isMe: boolean;
isPublic?: boolean; isPublic?: boolean;
isClosable?: boolean;
primaryDevice?: string; primaryDevice?: string;
lastUpdated: number; lastUpdated: number;

@ -38,7 +38,6 @@ interface Props {
avatarPath?: string; avatarPath?: string;
isMe: boolean; isMe: boolean;
isClosable?: boolean;
isGroup: boolean; isGroup: boolean;
isPrivate: boolean; isPrivate: boolean;
isPublic: boolean; isPublic: boolean;

@ -418,7 +418,6 @@ export class SessionConversation extends React.Component<Props, State> {
profileName: conversation.getProfileName(), profileName: conversation.getProfileName(),
avatarPath: conversation.getAvatarPath(), avatarPath: conversation.getAvatarPath(),
isMe: conversation.isMe(), isMe: conversation.isMe(),
isClosable: conversation.isClosable(),
isBlocked: conversation.isBlocked(), isBlocked: conversation.isBlocked(),
isGroup: !conversation.isPrivate(), isGroup: !conversation.isPrivate(),
isPrivate: conversation.isPrivate(), isPrivate: conversation.isPrivate(),

@ -18,7 +18,6 @@ export type PropsConversationHeaderMenu = {
triggerId: string; triggerId: string;
isMe: boolean; isMe: boolean;
isPublic?: boolean; isPublic?: boolean;
isClosable?: boolean;
isKickedFromGroup?: boolean; isKickedFromGroup?: boolean;
left?: boolean; left?: boolean;
isGroup: boolean; isGroup: boolean;
@ -44,7 +43,6 @@ export const ConversationHeaderMenu = (props: PropsConversationHeaderMenu) => {
const { const {
triggerId, triggerId,
isMe, isMe,
isClosable,
isPublic, isPublic,
isGroup, isGroup,
isKickedFromGroup, isKickedFromGroup,
@ -125,7 +123,6 @@ export const ConversationHeaderMenu = (props: PropsConversationHeaderMenu) => {
)} )}
{getDeleteContactMenuItem( {getDeleteContactMenuItem(
isMe, isMe,
isClosable,
isGroup, isGroup,
isPublic, isPublic,
onDeleteContact, onDeleteContact,

@ -16,7 +16,6 @@ export type PropsContextConversationItem = {
type: 'group' | 'direct'; type: 'group' | 'direct';
isMe: boolean; isMe: boolean;
isPublic?: boolean; isPublic?: boolean;
isClosable?: boolean;
isBlocked?: boolean; isBlocked?: boolean;
hasNickname?: boolean; hasNickname?: boolean;
isKickedFromGroup?: boolean; isKickedFromGroup?: boolean;
@ -39,7 +38,6 @@ export const ConversationListItemContextMenu = (
triggerId, triggerId,
isBlocked, isBlocked,
isMe, isMe,
isClosable,
isPublic, isPublic,
hasNickname, hasNickname,
type, type,
@ -92,7 +90,6 @@ export const ConversationListItemContextMenu = (
)} )}
{getDeleteContactMenuItem( {getDeleteContactMenuItem(
isMe, isMe,
isClosable,
type === 'group', type === 'group',
isPublic, isPublic,
onDeleteContact, onDeleteContact,

@ -33,16 +33,15 @@ function showDeleteMessages(isPublic: boolean): boolean {
} }
function showCopyId(isPublic: boolean, isGroup: boolean): boolean { function showCopyId(isPublic: boolean, isGroup: boolean): boolean {
return !isGroup; return !isGroup || isPublic;
} }
function showDeleteContact( function showDeleteContact(
isMe: boolean, isMe: boolean,
isClosable: boolean,
isGroup: boolean, isGroup: boolean,
isPublic: boolean isPublic: boolean
): boolean { ): boolean {
return !isMe && isClosable && !!(!isGroup || isPublic); return !isMe && Boolean(!isGroup || isPublic);
} }
function showAddModerators( function showAddModerators(
@ -96,20 +95,12 @@ export function getInviteContactMenuItem(
export function getDeleteContactMenuItem( export function getDeleteContactMenuItem(
isMe: boolean | undefined, isMe: boolean | undefined,
isClosable: boolean | undefined,
isGroup: boolean | undefined, isGroup: boolean | undefined,
isPublic: boolean | undefined, isPublic: boolean | undefined,
action: any, action: any,
i18n: LocalizerType i18n: LocalizerType
): JSX.Element | null { ): JSX.Element | null {
if ( if (showDeleteContact(Boolean(isMe), Boolean(isGroup), Boolean(isPublic))) {
showDeleteContact(
Boolean(isMe),
Boolean(isClosable),
Boolean(isGroup),
Boolean(isPublic)
)
) {
if (isPublic) { if (isPublic) {
return <Item onClick={action}>{i18n('leaveGroup')}</Item>; return <Item onClick={action}>{i18n('leaveGroup')}</Item>;
} }

@ -61,7 +61,6 @@ export type ConversationType = {
type: 'direct' | 'group'; type: 'direct' | 'group';
isMe: boolean; isMe: boolean;
isPublic?: boolean; isPublic?: boolean;
isClosable?: boolean;
lastUpdated: number; lastUpdated: number;
unreadCount: number; unreadCount: number;
mentionedUs: boolean; mentionedUs: boolean;
@ -158,7 +157,15 @@ const fetchMessagesForConversation = createAsyncThunk(
conversationKey: string; conversationKey: string;
count: number; count: number;
}) => { }) => {
const beforeTimestamp = Date.now();
const messages = await getMessages(conversationKey, count); const messages = await getMessages(conversationKey, count);
const afterTimestamp = Date.now();
const time = afterTimestamp - beforeTimestamp;
window.log.info(
`Loading ${messages.length} messages took ${time}ms to load.`
);
return { return {
conversationKey, conversationKey,
messages, messages,

Loading…
Cancel
Save