Chat Effects & Commands in thread context (#7138)
This commit is contained in:
parent
e549438e2a
commit
256c468c15
15 changed files with 108 additions and 31 deletions
|
@ -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")) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue