You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-28 15:22:05 +03:00
mass s/Quote/Reply
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@ -23,7 +23,7 @@ import {MatrixEvent} from 'matrix-js-sdk';
|
|||||||
import {makeUserPermalink} from "../../../matrix-to";
|
import {makeUserPermalink} from "../../../matrix-to";
|
||||||
import SettingsStore from "../../../settings/SettingsStore";
|
import SettingsStore from "../../../settings/SettingsStore";
|
||||||
|
|
||||||
export default class Quote extends React.Component {
|
export default class Reply extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
// The parent event
|
// The parent event
|
||||||
parentEv: PropTypes.instanceOf(MatrixEvent),
|
parentEv: PropTypes.instanceOf(MatrixEvent),
|
||||||
@ -68,7 +68,7 @@ export default class Quote extends React.Component {
|
|||||||
|
|
||||||
async initialize() {
|
async initialize() {
|
||||||
const {parentEv} = this.props;
|
const {parentEv} = this.props;
|
||||||
const inReplyTo = Quote.getInReplyTo(parentEv);
|
const inReplyTo = Reply.getInReplyTo(parentEv);
|
||||||
|
|
||||||
const ev = await this.getEvent(this.room, inReplyTo['event_id']);
|
const ev = await this.getEvent(this.room, inReplyTo['event_id']);
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -79,7 +79,7 @@ export default class Quote extends React.Component {
|
|||||||
async loadNextEvent() {
|
async loadNextEvent() {
|
||||||
this.props.onWidgetLoad();
|
this.props.onWidgetLoad();
|
||||||
const ev = this.state.events[0];
|
const ev = this.state.events[0];
|
||||||
const inReplyTo = Quote.getInReplyTo(ev);
|
const inReplyTo = Reply.getInReplyTo(ev);
|
||||||
|
|
||||||
if (!inReplyTo) {
|
if (!inReplyTo) {
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -139,8 +139,8 @@ export default class Quote extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static getQuote(parentEv, onWidgetLoad) {
|
static getQuote(parentEv, onWidgetLoad) {
|
||||||
if (!SettingsStore.isFeatureEnabled("feature_rich_quoting") || !Quote.getInReplyTo(parentEv)) return null;
|
if (!SettingsStore.isFeatureEnabled("feature_rich_quoting") || !Reply.getInReplyTo(parentEv)) return null;
|
||||||
return <Quote parentEv={parentEv} onWidgetLoad={onWidgetLoad} />;
|
return <Reply parentEv={parentEv} onWidgetLoad={onWidgetLoad} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -149,10 +149,10 @@ export default class Quote extends React.Component {
|
|||||||
const ev = this.state.loadedEv;
|
const ev = this.state.loadedEv;
|
||||||
const Pill = sdk.getComponent('elements.Pill');
|
const Pill = sdk.getComponent('elements.Pill');
|
||||||
const room = MatrixClientPeg.get().getRoom(ev.getRoomId());
|
const room = MatrixClientPeg.get().getRoom(ev.getRoomId());
|
||||||
header = <blockquote className="mx_Quote">
|
header = <blockquote className="mx_Reply">
|
||||||
{
|
{
|
||||||
_t('<a>In reply to</a> <pill>', {}, {
|
_t('<a>In reply to</a> <pill>', {}, {
|
||||||
'a': (sub) => <a onClick={this.onQuoteClick} className="mx_Quote_show">{ sub }</a>,
|
'a': (sub) => <a onClick={this.onQuoteClick} className="mx_Reply_show">{ sub }</a>,
|
||||||
'pill': <Pill type={Pill.TYPE_USER_MENTION} room={room}
|
'pill': <Pill type={Pill.TYPE_USER_MENTION} room={room}
|
||||||
url={makeUserPermalink(ev.getSender())} shouldShowPillAvatar={true} />,
|
url={makeUserPermalink(ev.getSender())} shouldShowPillAvatar={true} />,
|
||||||
})
|
})
|
||||||
@ -171,9 +171,9 @@ export default class Quote extends React.Component {
|
|||||||
dateSep = <a href={this.props.url}><DateSeparator ts={ev.getTs()} /></a>;
|
dateSep = <a href={this.props.url}><DateSeparator ts={ev.getTs()} /></a>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <blockquote className="mx_Quote" key={ev.getId()}>
|
return <blockquote className="mx_Reply" key={ev.getId()}>
|
||||||
{ dateSep }
|
{ dateSep }
|
||||||
<EventTile mxEvent={ev} tileShape="quote" />
|
<EventTile mxEvent={ev} tileShape="reply" />
|
||||||
</blockquote>;
|
</blockquote>;
|
||||||
});
|
});
|
||||||
|
|
@ -182,7 +182,6 @@ module.exports = React.createClass({
|
|||||||
|
|
||||||
// If the link is a (localised) matrix.to link, replace it with a pill
|
// If the link is a (localised) matrix.to link, replace it with a pill
|
||||||
const Pill = sdk.getComponent('elements.Pill');
|
const Pill = sdk.getComponent('elements.Pill');
|
||||||
const Quote = sdk.getComponent('elements.Quote');
|
|
||||||
if (Pill.isMessagePillUrl(href)) {
|
if (Pill.isMessagePillUrl(href)) {
|
||||||
const pillContainer = document.createElement('span');
|
const pillContainer = document.createElement('span');
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ limitations under the License.
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
||||||
import Quote from "../elements/Quote";
|
import Reply from "../elements/Reply";
|
||||||
|
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
@ -589,12 +589,12 @@ module.exports = withMatrixClient(React.createClass({
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
case 'quote': {
|
case 'reply': {
|
||||||
return (
|
return (
|
||||||
<div className={classes}>
|
<div className={classes}>
|
||||||
{ avatar }
|
{ avatar }
|
||||||
{ sender }
|
{ sender }
|
||||||
<div className="mx_EventTile_line mx_EventTile_quote">
|
<div className="mx_EventTile_line mx_EventTile_reply">
|
||||||
<a href={permalink} onClick={this.onPermalinkClicked}>
|
<a href={permalink} onClick={this.onPermalinkClicked}>
|
||||||
{ timestamp }
|
{ timestamp }
|
||||||
</a>
|
</a>
|
||||||
@ -622,7 +622,7 @@ module.exports = withMatrixClient(React.createClass({
|
|||||||
{ timestamp }
|
{ timestamp }
|
||||||
</a>
|
</a>
|
||||||
{ this._renderE2EPadlock() }
|
{ this._renderE2EPadlock() }
|
||||||
{ Quote.getQuote(this.props.mxEvent, this.props.onWidgetLoad) }
|
{ Reply.getQuote(this.props.mxEvent, this.props.onWidgetLoad) }
|
||||||
<EventTileType ref="tile"
|
<EventTileType ref="tile"
|
||||||
mxEvent={this.props.mxEvent}
|
mxEvent={this.props.mxEvent}
|
||||||
highlights={this.props.highlights}
|
highlights={this.props.highlights}
|
||||||
|
@ -52,9 +52,9 @@ const REGEX_MATRIXTO_MARKDOWN_GLOBAL = new RegExp(MATRIXTO_MD_LINK_PATTERN, 'g')
|
|||||||
import {asciiRegexp, shortnameToUnicode, emojioneList, asciiList, mapUnicodeToShort} from 'emojione';
|
import {asciiRegexp, shortnameToUnicode, emojioneList, asciiList, mapUnicodeToShort} from 'emojione';
|
||||||
import SettingsStore, {SettingLevel} from "../../../settings/SettingsStore";
|
import SettingsStore, {SettingLevel} from "../../../settings/SettingsStore";
|
||||||
import {makeUserPermalink} from "../../../matrix-to";
|
import {makeUserPermalink} from "../../../matrix-to";
|
||||||
import QuotePreview from "./QuotePreview";
|
import ReplyPreview from "./ReplyPreview";
|
||||||
import RoomViewStore from '../../../stores/RoomViewStore';
|
import RoomViewStore from '../../../stores/RoomViewStore';
|
||||||
import Quote from "../elements/Quote";
|
import Reply from "../elements/Reply";
|
||||||
import {ContentHelpers} from 'matrix-js-sdk';
|
import {ContentHelpers} from 'matrix-js-sdk';
|
||||||
|
|
||||||
const EMOJI_SHORTNAMES = Object.keys(emojioneList);
|
const EMOJI_SHORTNAMES = Object.keys(emojioneList);
|
||||||
@ -839,7 +839,7 @@ export default class MessageComposerInput extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const quotingEv = RoomViewStore.getQuotingEvent();
|
const quotingEv = RoomViewStore.getQuotingEvent();
|
||||||
const content = quotingEv ? Quote.getRelationship(quotingEv) : {};
|
const content = quotingEv ? Reply.getRelationship(quotingEv) : {};
|
||||||
// we have finished quoting, clear the quotingEvent
|
// we have finished quoting, clear the quotingEvent
|
||||||
// TODO maybe delay this until the event actually sends?
|
// TODO maybe delay this until the event actually sends?
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
@ -1159,7 +1159,7 @@ export default class MessageComposerInput extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<div className="mx_MessageComposer_input_wrapper">
|
<div className="mx_MessageComposer_input_wrapper">
|
||||||
<div className="mx_MessageComposer_autocomplete_wrapper">
|
<div className="mx_MessageComposer_autocomplete_wrapper">
|
||||||
{ SettingsStore.isFeatureEnabled("feature_rich_quoting") && <QuotePreview /> }
|
{ SettingsStore.isFeatureEnabled("feature_rich_quoting") && <ReplyPreview /> }
|
||||||
<Autocomplete
|
<Autocomplete
|
||||||
ref={(e) => this.autocomplete = e}
|
ref={(e) => this.autocomplete = e}
|
||||||
room={this.props.room}
|
room={this.props.room}
|
||||||
|
@ -27,7 +27,7 @@ function cancelQuoting() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class QuotePreview extends React.Component {
|
export default class ReplyPreview extends React.Component {
|
||||||
constructor(props, context) {
|
constructor(props, context) {
|
||||||
super(props, context);
|
super(props, context);
|
||||||
|
|
||||||
@ -61,17 +61,17 @@ export default class QuotePreview extends React.Component {
|
|||||||
const EventTile = sdk.getComponent('rooms.EventTile');
|
const EventTile = sdk.getComponent('rooms.EventTile');
|
||||||
const EmojiText = sdk.getComponent('views.elements.EmojiText');
|
const EmojiText = sdk.getComponent('views.elements.EmojiText');
|
||||||
|
|
||||||
return <div className="mx_QuotePreview">
|
return <div className="mx_ReplyPreview">
|
||||||
<div className="mx_QuotePreview_section">
|
<div className="mx_ReplyPreview_section">
|
||||||
<EmojiText element="div" className="mx_QuotePreview_header mx_QuotePreview_title">
|
<EmojiText element="div" className="mx_ReplyPreview_header mx_ReplyPreview_title">
|
||||||
{ '💬 ' + _t('Replying') }
|
{ '💬 ' + _t('Replying') }
|
||||||
</EmojiText>
|
</EmojiText>
|
||||||
<div className="mx_QuotePreview_header mx_QuotePreview_cancel">
|
<div className="mx_ReplyPreview_header mx_ReplyPreview_cancel">
|
||||||
<img className="mx_filterFlipColor" src="img/cancel.svg" width="18" height="18"
|
<img className="mx_filterFlipColor" src="img/cancel.svg" width="18" height="18"
|
||||||
onClick={cancelQuoting} />
|
onClick={cancelQuoting} />
|
||||||
</div>
|
</div>
|
||||||
<div className="mx_QuotePreview_clear" />
|
<div className="mx_ReplyPreview_clear" />
|
||||||
<EventTile mxEvent={this.state.event} last={true} tileShape="quote" onWidgetLoad={dummyOnWidgetLoad} />
|
<EventTile mxEvent={this.state.event} last={true} tileShape="reply" onWidgetLoad={dummyOnWidgetLoad} />
|
||||||
</div>
|
</div>
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
Reference in New Issue
Block a user