Skip to content

Commit

Permalink
Remove references to non-existent messageExpired action
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanHahn-Signal committed Jun 15, 2021
1 parent 562ab5a commit 9dd7e76
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 65 deletions.
6 changes: 0 additions & 6 deletions js/expiring_messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@
sentAt: message.get('sent_at'),
});

Whisper.events.trigger(
'messageExpired',
message.id,
message.conversationId
);

const conversation = message.getConversation();
if (conversation) {
conversation.trigger('expired', message);
Expand Down
2 changes: 0 additions & 2 deletions js/modules/signal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

// The idea with this file is to make it webpackable for the style guide

const { bindActionCreators } = require('redux');
const Backbone = require('../../ts/backbone');
const Crypto = require('../../ts/Crypto');
const Curve = require('../../ts/Curve');
Expand Down Expand Up @@ -416,7 +415,6 @@ exports.setup = (options = {}) => {
};

const State = {
bindActionCreators,
createStore,
Roots,
Ducks,
Expand Down
91 changes: 36 additions & 55 deletions ts/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only

import { isNumber } from 'lodash';
import { bindActionCreators } from 'redux';
import { render } from 'react-dom';
import {
DecryptionErrorMessage,
Expand Down Expand Up @@ -42,6 +43,7 @@ import * as universalExpireTimer from './util/universalExpireTimer';
import { isDirectConversation, isGroupV2 } from './util/whatTypeOfConversation';
import { getSendOptions } from './util/getSendOptions';
import { BackOff } from './util/BackOff';
import { actionCreators } from './state/actions';

const MAX_ATTACHMENT_DOWNLOAD_AGE = 3600 * 72 * 1000;

Expand Down Expand Up @@ -951,68 +953,48 @@ export async function startApp(): Promise<void> {
const store = window.Signal.State.createStore(initialState);
window.reduxStore = store;

const actions: WhatIsThis = {};
window.reduxActions = actions;

// Binding these actions to our redux store and exposing them allows us to update
// redux when things change in the backbone world.
actions.app = window.Signal.State.bindActionCreators(
window.Signal.State.Ducks.app.actions,
store.dispatch
);
actions.calling = window.Signal.State.bindActionCreators(
window.Signal.State.Ducks.calling.actions,
store.dispatch
);
actions.conversations = window.Signal.State.bindActionCreators(
window.Signal.State.Ducks.conversations.actions,
store.dispatch
);
actions.emojis = window.Signal.State.bindActionCreators(
window.Signal.State.Ducks.emojis.actions,
store.dispatch
);
actions.expiration = window.Signal.State.bindActionCreators(
window.Signal.State.Ducks.expiration.actions,
store.dispatch
);
actions.items = window.Signal.State.bindActionCreators(
window.Signal.State.Ducks.items.actions,
store.dispatch
);
actions.linkPreviews = window.Signal.State.bindActionCreators(
window.Signal.State.Ducks.linkPreviews.actions,
store.dispatch
);
actions.network = window.Signal.State.bindActionCreators(
window.Signal.State.Ducks.network.actions,
store.dispatch
);
actions.updates = window.Signal.State.bindActionCreators(
window.Signal.State.Ducks.updates.actions,
store.dispatch
);
actions.user = window.Signal.State.bindActionCreators(
window.Signal.State.Ducks.user.actions,
store.dispatch
);
actions.search = window.Signal.State.bindActionCreators(
window.Signal.State.Ducks.search.actions,
store.dispatch
);
actions.stickers = window.Signal.State.bindActionCreators(
window.Signal.State.Ducks.stickers.actions,
store.dispatch
);
window.reduxActions = {
app: bindActionCreators(actionCreators.app, store.dispatch),
audioPlayer: bindActionCreators(
actionCreators.audioPlayer,
store.dispatch
),
calling: bindActionCreators(actionCreators.calling, store.dispatch),
conversations: bindActionCreators(
actionCreators.conversations,
store.dispatch
),
emojis: bindActionCreators(actionCreators.emojis, store.dispatch),
expiration: bindActionCreators(actionCreators.expiration, store.dispatch),
globalModals: bindActionCreators(
actionCreators.globalModals,
store.dispatch
),
items: bindActionCreators(actionCreators.items, store.dispatch),
linkPreviews: bindActionCreators(
actionCreators.linkPreviews,
store.dispatch
),
network: bindActionCreators(actionCreators.network, store.dispatch),
safetyNumber: bindActionCreators(
actionCreators.safetyNumber,
store.dispatch
),
search: bindActionCreators(actionCreators.search, store.dispatch),
stickers: bindActionCreators(actionCreators.stickers, store.dispatch),
updates: bindActionCreators(actionCreators.updates, store.dispatch),
user: bindActionCreators(actionCreators.user, store.dispatch),
};

const {
conversationAdded,
conversationChanged,
conversationRemoved,
removeAllConversations,
messageExpired,
} = actions.conversations;
const { userChanged } = actions.user;
} = window.reduxActions.conversations;
const { userChanged } = window.reduxActions.user;

convoCollection.on('remove', conversation => {
const { id } = conversation || {};
Expand Down Expand Up @@ -1056,7 +1038,6 @@ export async function startApp(): Promise<void> {
});
convoCollection.on('reset', removeAllConversations);

window.Whisper.events.on('messageExpired', messageExpired);
window.Whisper.events.on('userChanged', userChanged);

let shortcutGuideView: WhatIsThis | null = null;
Expand Down
19 changes: 19 additions & 0 deletions ts/state/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,25 @@ import { actions as search } from './ducks/search';
import { actions as stickers } from './ducks/stickers';
import { actions as updates } from './ducks/updates';
import { actions as user } from './ducks/user';
import { ReduxActions } from './types';

export const actionCreators: ReduxActions = {
app,
audioPlayer,
calling,
conversations,
emojis,
expiration,
globalModals,
items,
linkPreviews,
network,
safetyNumber,
search,
stickers,
updates,
user,
};

export const mapDispatchToProps = {
...app,
Expand Down
2 changes: 0 additions & 2 deletions ts/window.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import * as Underscore from 'underscore';
import moment from 'moment';
import PQueue from 'p-queue/dist';
import { Ref } from 'react';
import { bindActionCreators } from 'redux';
import { imageToBlurHash } from './util/imageToBlurHash';
import * as LinkPreviews from '../js/modules/link_previews.d';
import * as Util from './util';
Expand Down Expand Up @@ -484,7 +483,6 @@ declare global {
};
Views: WhatIsThis;
State: {
bindActionCreators: typeof bindActionCreators;
createStore: typeof createStore;
Roots: {
createApp: typeof createApp;
Expand Down

0 comments on commit 9dd7e76

Please sign in to comment.