fixed crash on leftpaneContactSection

pull/1783/head
Audric Ackermann 4 years ago
parent 3e27a397d7
commit 1b2a644e7a
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

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

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

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

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

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

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

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

Loading…
Cancel
Save