refactoring roomView / slashCommands / SendMessageComposer with the new effects configurations and fix confetti animation timeout

This commit is contained in:
nurjinn jafar 2020-10-21 13:37:36 +02:00
parent 48633f76ab
commit 1c6d28b861
7 changed files with 59 additions and 52 deletions

View file

@ -42,8 +42,8 @@ import {Key} from "../../../Keyboard";
import MatrixClientContext from "../../../contexts/MatrixClientContext";
import RateLimitedFunc from '../../../ratelimitedfunc';
import {Action} from "../../../dispatcher/actions";
import {isConfettiEmoji} from "../elements/effects/confetti";
import SettingsStore from "../../../settings/SettingsStore";
import {containsEmoji} from "../elements/effects/effectUtilities";
import effects from '../elements/effects';
function addReplyToMessageContent(content, repliedToEvent, permalinkCreator) {
const replyContent = ReplyThread.makeReplyMixIn(repliedToEvent);
@ -318,9 +318,11 @@ export default class SendMessageComposer extends React.Component {
});
}
dis.dispatch({action: "message_sent"});
if (isConfettiEmoji(content)) {
dis.dispatch({action: 'effects.confetti'});
effects.map( (effect) => {
if (containsEmoji(content, effect.emojis)) {
dis.dispatch({action: `effects.${effect.command}`});
}
});
}
this.sendHistoryManager.save(this.model, replyToEvent);