fix tests

pull/1495/head
Audric Ackermann 4 years ago
parent ea2c4437a3
commit f41bf31515
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -1,4 +1,4 @@
/* global Signal, setTimeout, clearTimeout, getMessageController, NewReceiver */ /* global Signal, setTimeout, clearTimeout, getMessageController, NewReceiver, models */
const { isNumber, omit } = require('lodash'); const { isNumber, omit } = require('lodash');
const getGuid = require('uuid/v4'); const getGuid = require('uuid/v4');
@ -143,7 +143,7 @@ async function _runJob(job) {
} }
const found = await getMessageById(messageId, { const found = await getMessageById(messageId, {
Message: window.models.Message.MessageModel, Message: models.Message.MessageModel,
}); });
if (!found) { if (!found) {
logger.error('_runJob: Source message not found, deleting job'); logger.error('_runJob: Source message not found, deleting job');
@ -227,7 +227,7 @@ async function _runJob(job) {
async function _finishJob(message, id) { async function _finishJob(message, id) {
if (message) { if (message) {
await saveMessage(message.attributes, { await saveMessage(message.attributes, {
Message: window.models.Message.MessageModel, Message: models.Message.MessageModel,
}); });
const conversation = message.getConversation(); const conversation = message.getConversation();
if (conversation) { if (conversation) {

@ -1,7 +1,5 @@
/* global Signal: false */ /* global Signal: false */
/* global Whisper: false */
/* global _: false */ /* global _: false */
/* global textsecure: false */
/* global i18n: false */ /* global i18n: false */
/* eslint-env browser */ /* eslint-env browser */

@ -879,7 +879,7 @@ async function saveSeenMessageHash(data) {
await channels.saveSeenMessageHash(_cleanData(data)); await channels.saveSeenMessageHash(_cleanData(data));
} }
async function saveMessage(data, { forceSave, Message } = {}) { async function saveMessage(data, { forceSave } = {}) {
const id = await channels.saveMessage(_cleanData(data), { forceSave }); const id = await channels.saveMessage(_cleanData(data), { forceSave });
window.Whisper.ExpiringMessagesListener.update(); window.Whisper.ExpiringMessagesListener.update();
return id; return id;

@ -6,7 +6,6 @@ const SchemaVersion = require('./schema_version');
const { const {
initializeAttachmentMetadata, initializeAttachmentMetadata,
} = require('../../../ts/types/message/initializeAttachmentMetadata'); } = require('../../../ts/types/message/initializeAttachmentMetadata');
const MessageTS = require('../../../ts/types/Message');
const Contact = require('./contact'); const Contact = require('./contact');
const GROUP = 'group'; const GROUP = 'group';

@ -1,4 +1,4 @@
/* global Whisper, i18n, textsecure, _ */ /* global Whisper, i18n, _ */
// eslint-disable-next-line func-names // eslint-disable-next-line func-names
(function() { (function() {

@ -9,7 +9,6 @@
dcodeIO, dcodeIO,
StringView, StringView,
Event, Event,
Whisper
*/ */
/* eslint-disable more/no-then */ /* eslint-disable more/no-then */

@ -1,4 +1,4 @@
/* global Signal, Whisper, assert, textsecure, _, libsignal */ /* global Signal, assert, textsecure, _, libsignal */
/* eslint-disable no-console */ /* eslint-disable no-console */

@ -1,5 +1,3 @@
/* global Whisper */
'use strict'; 'use strict';
const attributes = { const attributes = {
@ -16,6 +14,8 @@ describe('MessageCollection', () => {
before(async () => { before(async () => {
await clearDatabase(); await clearDatabase();
window.getConversationController().reset(); window.getConversationController().reset();
window.textsecure.storage.user.getNumber = () =>
'051111111111111111111111111111111111111111111111111111111111111111';
await window.getConversationController().load(); await window.getConversationController().load();
}); });
after(() => { after(() => {

@ -148,7 +148,16 @@ class ActionsPanelPrivate extends React.Component<Props> {
} }
public render(): JSX.Element { public render(): JSX.Element {
const { selectedSection, unreadMessageCount } = this.props; const {
selectedSection,
unreadMessageCount,
ourPrimaryConversation,
} = this.props;
if (!ourPrimaryConversation) {
window.log.warn('ActionsPanel: ourPrimaryConversation is not set');
return <></>;
}
const isProfilePageSelected = selectedSection === SectionType.Profile; const isProfilePageSelected = selectedSection === SectionType.Profile;
const isMessagePageSelected = selectedSection === SectionType.Message; const isMessagePageSelected = selectedSection === SectionType.Message;
@ -160,7 +169,7 @@ class ActionsPanelPrivate extends React.Component<Props> {
<div className="module-left-pane__sections-container"> <div className="module-left-pane__sections-container">
<this.Section <this.Section
type={SectionType.Profile} type={SectionType.Profile}
avatarPath={this.props.ourPrimaryConversation.avatarPath} avatarPath={ourPrimaryConversation.avatarPath}
isSelected={isProfilePageSelected} isSelected={isProfilePageSelected}
onSelect={this.handleSectionSelect} onSelect={this.handleSectionSelect}
/> />

@ -55,7 +55,7 @@ export function usingClosedConversationDetails(WrappedComponent: any) {
(conversationType === 'group' || type === 'group' || isGroup) (conversationType === 'group' || type === 'group' || isGroup)
) { ) {
const groupId = id || phoneNumber; const groupId = id || phoneNumber;
const ourPrimary = await UserUtils.getOurPubKeyFromCache(); const ourPrimary = UserUtils.getOurPubKeyFromCache();
let members = await GroupUtils.getGroupMembers(PubKey.cast(groupId)); let members = await GroupUtils.getGroupMembers(PubKey.cast(groupId));
const ourself = members.find(m => m.key !== ourPrimary.key); const ourself = members.find(m => m.key !== ourPrimary.key);

@ -614,15 +614,6 @@ export function reducer(
return state; return state;
} }
if (selectedConversation === id) {
// Inbox -> Archived: no conversation is selected
// Note: With today's stacked converastions architecture, this can result in weird
// behavior - no selected conversation in the left pane, but a conversation show
// in the right pane.
// if (!existing.isArchived && data.isArchived) {
// selectedConversation = undefined;
// }
}
return { return {
...state, ...state,
selectedConversation, selectedConversation,

Loading…
Cancel
Save