mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 05:55:00 +08:00
dont show remove button for original event in edit history
This commit is contained in:
parent
76a60c84ac
commit
aca41fe80a
@ -107,11 +107,19 @@ export default class MessageEditHistoryDialog extends React.PureComponent {
|
|||||||
if (this.state.originalEvent && !this.state.nextBatch) {
|
if (this.state.originalEvent && !this.state.nextBatch) {
|
||||||
allEvents = allEvents.concat(this.state.originalEvent);
|
allEvents = allEvents.concat(this.state.originalEvent);
|
||||||
}
|
}
|
||||||
|
const baseEventId = this.props.mxEvent.getId();
|
||||||
allEvents.forEach(e => {
|
allEvents.forEach(e => {
|
||||||
if (!lastEvent || wantsDateSeparator(lastEvent.getDate(), e.getDate())) {
|
if (!lastEvent || wantsDateSeparator(lastEvent.getDate(), e.getDate())) {
|
||||||
nodes.push(<li key={e.getTs() + "~"}><DateSeparator ts={e.getTs()} /></li>);
|
nodes.push(<li key={e.getTs() + "~"}><DateSeparator ts={e.getTs()} /></li>);
|
||||||
}
|
}
|
||||||
nodes.push(<EditHistoryMessage key={e.getId()} mxEvent={e} isTwelveHour={this.state.isTwelveHour} />);
|
const isBaseEvent = e.getId() === baseEventId;
|
||||||
|
nodes.push((
|
||||||
|
<EditHistoryMessage
|
||||||
|
key={e.getId()}
|
||||||
|
isBaseEvent={isBaseEvent}
|
||||||
|
mxEvent={e}
|
||||||
|
isTwelveHour={this.state.isTwelveHour}
|
||||||
|
/>));
|
||||||
lastEvent = e;
|
lastEvent = e;
|
||||||
});
|
});
|
||||||
return nodes;
|
return nodes;
|
||||||
|
@ -94,7 +94,7 @@ export default class EditHistoryMessage extends React.PureComponent {
|
|||||||
const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
|
const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
|
||||||
// hide the button when already redacted
|
// hide the button when already redacted
|
||||||
let redactButton;
|
let redactButton;
|
||||||
if (!this.props.mxEvent.isRedacted()) {
|
if (!this.props.mxEvent.isRedacted() && !this.props.isBaseEvent) {
|
||||||
redactButton = (
|
redactButton = (
|
||||||
<AccessibleButton onClick={this._onRedactClick} disabled={!this.state.canRedact}>
|
<AccessibleButton onClick={this._onRedactClick} disabled={!this.state.canRedact}>
|
||||||
{_t("Remove")}
|
{_t("Remove")}
|
||||||
|
Loading…
Reference in New Issue
Block a user