Iterate PR

This commit is contained in:
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

@ -41,6 +41,8 @@ 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,
}); });
} }