fixed crash on leftpaneContactSection

This commit is contained in:
Audric Ackermann 2021-07-12 16:00:04 +10:00
parent 3e27a397d7
commit 1b2a644e7a
No known key found for this signature in database
GPG key ID: 999F434D76324AD4
7 changed files with 25 additions and 33 deletions

View file

@ -23,7 +23,7 @@ jobs:
- name: Install node
uses: actions/setup-node@v1
with:
node-version: 10.19.0
node-version: 14.16.0
- name: Chocolatey Install Action
if: runner.os == 'Windows'

View file

@ -25,7 +25,7 @@ jobs:
- name: Install node
uses: actions/setup-node@v1
with:
node-version: 10.19.0
node-version: 14.16.0
- name: Chocolatey Install Action
if: runner.os == 'Windows'

View file

@ -23,7 +23,7 @@ jobs:
- name: Install node
uses: actions/setup-node@v1
with:
node-version: 10.19.0
node-version: 14.16.0
- name: Chocolatey Install Action
if: runner.os == 'Windows'

View file

@ -8,9 +8,7 @@ const { remove: removeUserConfig } = require('./user_config');
const { map, isString, fromPairs, forEach, last, isEmpty, isObject, isNumber } = require('lodash');
// To get long stack traces
// https://github.com/mapbox/node-sqlite3/wiki/API#sqlite3verbose
// sql.verbose();
/* eslint-disable camelcase */
module.exports = {
initialize,
@ -1407,7 +1405,7 @@ function createOrUpdate(table, data, instance) {
)`
)
.run({
id: id,
id,
json: objectToJSON(data),
});
}
@ -1483,15 +1481,7 @@ function getConversationCount() {
}
function saveConversation(data) {
const {
id,
// eslint-disable-next-line camelcase
active_at,
type,
members,
name,
profileName,
} = data;
const { id, active_at, type, members, name, profileName } = data;
globalInstance
.prepare(
@ -1700,7 +1690,7 @@ function searchMessages(query, { limit } = {}) {
LIMIT $limit;`
)
.all({
query: query,
query,
limit: limit || 100,
});
@ -2119,7 +2109,7 @@ function getLastHashBySnode(convoId, snode) {
const row = globalInstance
.prepare('SELECT * FROM lastHashes WHERE snode = $snode AND id = $id;')
.get({
snode: snode,
snode,
id: convoId,
});
@ -2226,8 +2216,8 @@ function saveUnprocessed(data) {
function updateUnprocessedAttempts(id, attempts) {
globalInstance.prepare('UPDATE unprocessed SET attempts = $attempts WHERE id = $id;').run({
id: id,
attempts: attempts,
id,
attempts,
});
}
function updateUnprocessedWithData(id, data = {}) {

View file

@ -1,4 +1,5 @@
/* global dcodeIO */
/* global dcodeIO, Internal */
/* eslint-disable no-console */
/* eslint-disable strict */
const functions = {

View file

@ -5,16 +5,18 @@ import { RowRendererParamsType } from '../LeftPane';
import { AutoSizer, List } from 'react-virtualized';
import { LeftPaneSectionHeader } from './LeftPaneSectionHeader';
import { useSelector } from 'react-redux';
import { getDirectContacts, getLeftPaneLists } from '../../state/selectors/conversations';
import { isSearching } from '../../state/selectors/search';
import { getDirectContacts } from '../../state/selectors/conversations';
const renderRow = ({ index, key, style }: RowRendererParamsType) => {
const showSearch = useSelector(isSearching);
const renderRow = (props: RowRendererParamsType) => {
const { index, key, style } = props;
const lists = showSearch ? undefined : useSelector(getLeftPaneLists);
const directContacts = (props.parent as any)?.props?.directContacts || [];
const directContacts = lists?.contacts || [];
const item = directContacts[index];
const item = directContacts?.[index];
if (!item) {
return null;
}
return <MemoConversationListItemWithDetails style={style} key={key} {...item} />;
};
@ -25,6 +27,7 @@ const ContactListItemSection = () => {
if (!directContacts) {
return null;
}
const length = Number(directContacts.length);
return (

View file

@ -16,17 +16,16 @@ import { SessionTheme } from '../../../state/ducks/SessionTheme';
import { DefaultTheme } from 'styled-components';
import { SessionMessagesList } from './SessionMessagesList';
import { LightboxGallery, MediaItemType } from '../../LightboxGallery';
import { Message } from '../../conversation/media-gallery/types/Message';
import { AttachmentType, AttachmentTypeWithPath, save } from '../../../types/Attachment';
import { ToastUtils, UserUtils } from '../../../session/utils';
import * as MIME from '../../../types/MIME';
import { SessionFileDropzone } from './SessionFileDropzone';
import {
ReduxConversationType,
PropsForMessage,
SortedMessageModelProps,
fetchMessagesForConversation,
PropsForMessage,
ReduxConversationType,
SortedMessageModelProps,
} from '../../../state/ducks/conversations';
import { MessageView } from '../../MainViewController';
import { pushUnblockToSend } from '../../../session/utils/Toast';
@ -36,7 +35,6 @@ import { getMessageById, getPubkeysInPublicConversation } from '../../../data/da
import autoBind from 'auto-bind';
import { getDecryptedMediaUrl } from '../../../session/crypto/DecryptedAttachmentsManager';
import { deleteOpenGroupMessages } from '../../../interactions/conversationInteractions';
import { ConversationTypeEnum } from '../../../models/conversation';
import { updateMentionsMembers } from '../../../state/ducks/mentionsInput';
import { sendDataExtractionNotification } from '../../../session/messages/outgoing/controlMessage/DataExtractionNotificationMessage';