mirror of
https://github.com/element-hq/element-web
synced 2024-11-24 10:15:43 +03:00
fix: show edit button only if you have permission
This commit is contained in:
parent
29b95e6083
commit
df52ec28d6
1 changed files with 3 additions and 1 deletions
|
@ -23,6 +23,7 @@ import { _t } from "../../languageHandler";
|
|||
import * as sdk from "../../index";
|
||||
import MatrixClientContext from "../../contexts/MatrixClientContext";
|
||||
import { SendCustomEvent } from "../views/dialogs/DevtoolsDialog";
|
||||
import { canEditContent } from "../../utils/EventUtils";
|
||||
|
||||
export default class ViewSource extends React.Component {
|
||||
static propTypes = {
|
||||
|
@ -162,6 +163,7 @@ export default class ViewSource extends React.Component {
|
|||
const isEditing = this.state.isEditing;
|
||||
const roomId = mxEvent.getRoomId();
|
||||
const eventId = mxEvent.getId();
|
||||
const canEdit = canEditContent(this.props.mxEvent);
|
||||
return (
|
||||
<BaseDialog className="mx_ViewSource" onFinished={this.props.onFinished} title={_t("View Source")}>
|
||||
<div>
|
||||
|
@ -170,7 +172,7 @@ export default class ViewSource extends React.Component {
|
|||
<div className="mx_ViewSource_separator" />
|
||||
{isEditing ? this.editSourceContent() : this.viewSourceContent()}
|
||||
</div>
|
||||
{!isEditing && (
|
||||
{!isEditing && canEdit && (
|
||||
<div className="mx_Dialog_buttons">
|
||||
<button onClick={() => this.onEdit()}>{_t("Edit")}</button>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue