mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 14:05:04 +08:00
s/Quote/Reply/ and ES6 tweaks
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
9baf71c4fc
commit
9603b21199
@ -40,38 +40,36 @@ function wantsDateSeparator(parentEvent, event) {
|
||||
return parentEventDate.getDay() !== eventDate.getDay();
|
||||
}
|
||||
|
||||
const Quote = React.createClass({
|
||||
statics: {
|
||||
isMessageUrl: (url) => {
|
||||
return !!REGEX_LOCAL_MATRIXTO.exec(url);
|
||||
},
|
||||
},
|
||||
export default class Quote extends React.Component {
|
||||
static isMessageUrl(url) {
|
||||
return !!REGEX_LOCAL_MATRIXTO.exec(url);
|
||||
}
|
||||
|
||||
childContextTypes: {
|
||||
matrixClient: React.PropTypes.object,
|
||||
},
|
||||
static childContextTypes = {
|
||||
matrixClient: PropTypes.object,
|
||||
};
|
||||
|
||||
props: {
|
||||
static propTypes = {
|
||||
// The matrix.to url of the event
|
||||
url: PropTypes.string,
|
||||
// The parent event
|
||||
parentEv: PropTypes.instanceOf(MatrixEvent),
|
||||
// Whether to include an avatar in the pill
|
||||
shouldShowPillAvatar: PropTypes.bool,
|
||||
},
|
||||
};
|
||||
|
||||
getChildContext: function() {
|
||||
return {
|
||||
matrixClient: MatrixClientPeg.get(),
|
||||
};
|
||||
},
|
||||
constructor(props, context) {
|
||||
super(props, context);
|
||||
|
||||
getInitialState() {
|
||||
return {
|
||||
this.state = {
|
||||
// The event related to this quote
|
||||
event: null,
|
||||
};
|
||||
},
|
||||
}
|
||||
|
||||
getChildContext() {
|
||||
return {
|
||||
matrixClient: MatrixClientPeg.get(),
|
||||
};
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
let roomId;
|
||||
@ -96,11 +94,11 @@ const Quote = React.createClass({
|
||||
// Only try and load the event if we know about the room
|
||||
// otherwise we just leave a `Quote` anchor which can be used to navigate/join the room manually.
|
||||
if (room) this.getEvent(room, eventId);
|
||||
},
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
this.componentWillReceiveProps(this.props);
|
||||
},
|
||||
}
|
||||
|
||||
async getEvent(room, eventId) {
|
||||
let event = room.findEventById(eventId);
|
||||
@ -112,9 +110,9 @@ const Quote = React.createClass({
|
||||
await MatrixClientPeg.get().getEventTimeline(room.getUnfilteredTimelineSet(), eventId);
|
||||
event = room.findEventById(eventId);
|
||||
this.setState({room, event});
|
||||
},
|
||||
}
|
||||
|
||||
render: function() {
|
||||
render() {
|
||||
const ev = this.state.event;
|
||||
if (ev) {
|
||||
const EventTile = sdk.getComponent('views.rooms.EventTile');
|
||||
@ -135,7 +133,5 @@ const Quote = React.createClass({
|
||||
<a href={this.props.url}>{ _t('Quote') }</a>
|
||||
<br />
|
||||
</div>;
|
||||
},
|
||||
});
|
||||
|
||||
export default Quote;
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ module.exports = React.createClass({
|
||||
const quoteContainer = document.createElement('span');
|
||||
|
||||
const quote =
|
||||
<Quote url={href} parentEv={this.props.mxEvent} shouldShowPillAvatar={shouldShowPillAvatar} />;
|
||||
<Quote url={href} parentEv={this.props.mxEvent} />;
|
||||
|
||||
ReactDOM.render(quote, quoteContainer);
|
||||
node.parentNode.replaceChild(quoteContainer, node);
|
||||
|
@ -64,9 +64,7 @@ export default class QuotePreview extends React.Component {
|
||||
return <div className="mx_QuotePreview">
|
||||
<div className="mx_QuotePreview_section">
|
||||
<EmojiText element="div" className="mx_QuotePreview_header mx_QuotePreview_title">
|
||||
<span>
|
||||
💬 { _t('Quoting') }
|
||||
</span>
|
||||
{ '💬' + _t('Replying') }
|
||||
</EmojiText>
|
||||
<div className="mx_QuotePreview_header mx_QuotePreview_cancel">
|
||||
<img className="mx_filterFlipColor" src="img/cancel.svg" width="18" height="18"
|
||||
|
@ -940,6 +940,6 @@
|
||||
"The export file will be protected with a passphrase. You should enter the passphrase here, to decrypt the file.": "The export file will be protected with a passphrase. You should enter the passphrase here, to decrypt the file.",
|
||||
"File to import": "File to import",
|
||||
"Import": "Import",
|
||||
"Quoting": "Quoting",
|
||||
"Rich Quoting": "Rich Quoting"
|
||||
"Message Replies": "Message Replies",
|
||||
"Replying": "Replying"
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ export const SETTINGS = {
|
||||
// },
|
||||
"feature_rich_quoting": {
|
||||
isFeature: true,
|
||||
displayName: _td("Rich Quoting"),
|
||||
displayName: _td("Message Replies"),
|
||||
supportedLevels: LEVELS_FEATURE,
|
||||
default: false,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user