Chat Effects & Commands in thread context (#7138)
This commit is contained in:
@@ -957,7 +957,11 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
||||
|
||||
CHAT_EFFECTS.forEach(effect => {
|
||||
if (containsEmoji(ev.getContent(), effect.emojis) || ev.getContent().msgtype === effect.msgType) {
|
||||
dis.dispatch({ action: `effects.${effect.command}` });
|
||||
// For initial threads launch, chat effects are disabled
|
||||
// see #19731
|
||||
if (!SettingsStore.getValue("feature_thread") || !ev.isThreadRelation) {
|
||||
dis.dispatch({ action: `effects.${effect.command}` });
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -24,6 +24,7 @@ import { Room } from 'matrix-js-sdk/src/models/room';
|
||||
import SettingsStore from "../../../settings/SettingsStore";
|
||||
import Autocompleter from '../../../autocomplete/Autocompleter';
|
||||
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
||||
import RoomContext from '../../../contexts/RoomContext';
|
||||
|
||||
const MAX_PROVIDER_MATCHES = 20;
|
||||
|
||||
@@ -57,11 +58,11 @@ export default class Autocomplete extends React.PureComponent<IProps, IState> {
|
||||
debounceCompletionsRequest: number;
|
||||
private containerRef = createRef<HTMLDivElement>();
|
||||
|
||||
public static contextType = RoomContext;
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.autocompleter = new Autocompleter(props.room);
|
||||
|
||||
this.state = {
|
||||
// list of completionResults, each containing completions
|
||||
completions: [],
|
||||
@@ -82,6 +83,7 @@ export default class Autocomplete extends React.PureComponent<IProps, IState> {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.autocompleter = new Autocompleter(this.props.room, this.context.timelineRenderingType);
|
||||
this.applyNewProps();
|
||||
}
|
||||
|
||||
|
||||
@@ -492,7 +492,12 @@ export class SendMessageComposer extends React.Component<ISendMessageComposerPro
|
||||
dis.dispatch({ action: "message_sent" });
|
||||
CHAT_EFFECTS.forEach((effect) => {
|
||||
if (containsEmoji(content, effect.emojis)) {
|
||||
dis.dispatch({ action: `effects.${effect.command}` });
|
||||
// For initial threads launch, chat effects are disabled
|
||||
// see #19731
|
||||
const isNotThread = this.props.relation?.rel_type !== RelationType.Thread;
|
||||
if (!SettingsStore.getValue("feature_thread") || !isNotThread) {
|
||||
dis.dispatch({ action: `effects.${effect.command}` });
|
||||
}
|
||||
}
|
||||
});
|
||||
if (SettingsStore.getValue("Performance.addSendMessageTimingMetadata")) {
|
||||
|
||||
Reference in New Issue
Block a user