Iterate PR

pull/21833/head
Michael Telatynski 2021-05-24 22:02:50 +01:00
parent a757f589bd
commit 4a5c634d82
6 changed files with 25 additions and 15 deletions

View File

@ -39,6 +39,7 @@ import {UIFeature} from "../../settings/UIFeature";
import {objectHasDiff} from "../../utils/objects"; import {objectHasDiff} from "../../utils/objects";
import {replaceableComponent} from "../../utils/replaceableComponent"; import {replaceableComponent} from "../../utils/replaceableComponent";
import { arrayFastClone } from "../../utils/arrays"; import { arrayFastClone } from "../../utils/arrays";
import {Action} from "../../dispatcher/actions";
const PAGINATE_SIZE = 20; const PAGINATE_SIZE = 20;
const INITIAL_SIZE = 20; const INITIAL_SIZE = 20;
@ -470,7 +471,7 @@ class TimelinePanel extends React.Component {
break; break;
} }
case "composer_insert": { case Action.ComposerInsert: {
// re-dispatch to the correct composer // re-dispatch to the correct composer
if (this.state.editState) { if (this.state.editState) {
dis.dispatch({ dis.dispatch({

View File

@ -31,6 +31,8 @@ import { isContentActionable } from '../../../utils/EventUtils';
import {MenuItem} from "../../structures/ContextMenu"; import {MenuItem} from "../../structures/ContextMenu";
import {EventType} from "matrix-js-sdk/src/@types/event"; import {EventType} from "matrix-js-sdk/src/@types/event";
import {replaceableComponent} from "../../../utils/replaceableComponent"; import {replaceableComponent} from "../../../utils/replaceableComponent";
import {ComposerInsertPayload} from "../../../dispatcher/payloads/ComposerInsertPayload";
import {Action} from "../../../dispatcher/actions";
export function canCancel(eventStatus) { export function canCancel(eventStatus) {
return eventStatus === EventStatus.QUEUED || eventStatus === EventStatus.NOT_SENT; return eventStatus === EventStatus.QUEUED || eventStatus === EventStatus.NOT_SENT;
@ -199,8 +201,8 @@ export default class MessageContextMenu extends React.Component {
}; };
onQuoteClick = () => { onQuoteClick = () => {
dis.dispatch({ dis.dispatch<ComposerInsertPayload>({
action: "composer_insert", action: Action.ComposerInsert,
event: this.props.mxEvent, event: this.props.mxEvent,
}); });
this.closeMenu(); this.closeMenu();

View File

@ -36,6 +36,8 @@ import {toRightOf} from "../../structures/ContextMenu";
import {copyPlaintext} from "../../../utils/strings"; import {copyPlaintext} from "../../../utils/strings";
import AccessibleTooltipButton from "../elements/AccessibleTooltipButton"; import AccessibleTooltipButton from "../elements/AccessibleTooltipButton";
import {replaceableComponent} from "../../../utils/replaceableComponent"; import {replaceableComponent} from "../../../utils/replaceableComponent";
import {ComposerInsertPayload} from "../../../dispatcher/payloads/ComposerInsertPayload";
import {Action} from "../../../dispatcher/actions";
@replaceableComponent("views.messages.TextualBody") @replaceableComponent("views.messages.TextualBody")
export default class TextualBody extends React.Component { export default class TextualBody extends React.Component {
@ -389,8 +391,8 @@ export default class TextualBody extends React.Component {
onEmoteSenderClick = event => { onEmoteSenderClick = event => {
const mxEvent = this.props.mxEvent; const mxEvent = this.props.mxEvent;
dis.dispatch({ dis.dispatch<ComposerInsertPayload>({
action: "composer_insert", action: Action.ComposerInsert,
userId: mxEvent.getSender(), userId: mxEvent.getSender(),
}); });
}; };

View File

@ -66,6 +66,7 @@ import { SetRightPanelPhasePayload } from "../../../dispatcher/payloads/SetRight
import RoomAvatar from "../avatars/RoomAvatar"; import RoomAvatar from "../avatars/RoomAvatar";
import RoomName from "../elements/RoomName"; import RoomName from "../elements/RoomName";
import {mediaFromMxc} from "../../../customisations/Media"; import {mediaFromMxc} from "../../../customisations/Media";
import {ComposerInsertPayload} from "../../../dispatcher/payloads/ComposerInsertPayload";
export interface IDevice { export interface IDevice {
deviceId: string; deviceId: string;
@ -366,8 +367,8 @@ const UserOptionsSection: React.FC<{
}; };
const onInsertPillButton = function() { const onInsertPillButton = function() {
dis.dispatch({ dis.dispatch<ComposerInsertPayload>({
action: "composer_insert", action: Action.ComposerInsert,
userId: member.userId, userId: member.userId,
}); });
}; };

View File

@ -46,6 +46,8 @@ import { EditorStateTransfer } from "../../../utils/EditorStateTransfer";
import { RoomPermalinkCreator } from '../../../utils/permalinks/Permalinks'; import { RoomPermalinkCreator } from '../../../utils/permalinks/Permalinks';
import {StaticNotificationState} from "../../../stores/notifications/StaticNotificationState"; import {StaticNotificationState} from "../../../stores/notifications/StaticNotificationState";
import NotificationBadge from "./NotificationBadge"; import NotificationBadge from "./NotificationBadge";
import {ComposerInsertPayload} from "../../../dispatcher/payloads/ComposerInsertPayload";
import { Action } from '../../../dispatcher/actions';
const eventTileTypes = { const eventTileTypes = {
[EventType.RoomMessage]: 'messages.MessageEvent', [EventType.RoomMessage]: 'messages.MessageEvent',
@ -698,8 +700,8 @@ export default class EventTile extends React.Component<IProps, IState> {
onSenderProfileClick = event => { onSenderProfileClick = event => {
const mxEvent = this.props.mxEvent; const mxEvent = this.props.mxEvent;
dis.dispatch({ dis.dispatch<ComposerInsertPayload>({
action: "composer_insert", action: Action.ComposerInsert,
userId: mxEvent.getSender(), userId: mxEvent.getSender(),
}); });
}; };

View File

@ -15,16 +15,16 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import { _t } from '../../../languageHandler'; import {_t} from '../../../languageHandler';
import {MatrixClientPeg} from '../../../MatrixClientPeg'; import {MatrixClientPeg} from '../../../MatrixClientPeg';
import * as sdk from '../../../index'; import * as sdk from '../../../index';
import {MatrixEvent} from "matrix-js-sdk/src/models/event"; import {MatrixEvent} from "matrix-js-sdk/src/models/event";
import {Room} from "matrix-js-sdk/src/models/room"; import {Room} from "matrix-js-sdk/src/models/room";
import {RoomMember} from "matrix-js-sdk/src/models/room-member"; import {RoomMember} from "matrix-js-sdk/src/models/room-member";
import dis from '../../../dispatcher/dispatcher'; import dis from '../../../dispatcher/dispatcher';
import { ActionPayload } from "../../../dispatcher/payloads"; import {ActionPayload} from "../../../dispatcher/payloads";
import Stickerpicker from './Stickerpicker'; import Stickerpicker from './Stickerpicker';
import { makeRoomPermalink, RoomPermalinkCreator } from '../../../utils/permalinks/Permalinks'; import {makeRoomPermalink, RoomPermalinkCreator} from '../../../utils/permalinks/Permalinks';
import ContentMessages from '../../../ContentMessages'; import ContentMessages from '../../../ContentMessages';
import E2EIcon from './E2EIcon'; import E2EIcon from './E2EIcon';
import SettingsStore from "../../../settings/SettingsStore"; import SettingsStore from "../../../settings/SettingsStore";
@ -39,8 +39,10 @@ import {VoiceRecordingStore} from "../../../stores/VoiceRecordingStore";
import {RecordingState} from "../../../voice/VoiceRecording"; import {RecordingState} from "../../../voice/VoiceRecording";
import Tooltip, {Alignment} from "../elements/Tooltip"; import Tooltip, {Alignment} from "../elements/Tooltip";
import ResizeNotifier from "../../../utils/ResizeNotifier"; import ResizeNotifier from "../../../utils/ResizeNotifier";
import { E2EStatus } from '../../../utils/ShieldUtils'; import {E2EStatus} from '../../../utils/ShieldUtils';
import SendMessageComposer from "./SendMessageComposer"; import SendMessageComposer from "./SendMessageComposer";
import {ComposerInsertPayload} from "../../../dispatcher/payloads/ComposerInsertPayload";
import {Action} from "../../../dispatcher/actions";
interface IComposerAvatarProps { interface IComposerAvatarProps {
me: object; me: object;
@ -317,8 +319,8 @@ export default class MessageComposer extends React.Component<IProps, IState> {
} }
addEmoji(emoji) { addEmoji(emoji) {
dis.dispatch({ dis.dispatch<ComposerInsertPayload>({
action: "composer_insert", action: Action.ComposerInsert,
text: emoji, text: emoji,
}); });
} }