Skip to content

Commit 68fc202

Browse files
committed
remove pointless self vars and DRY render method of send custom events
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
1 parent ce0861d commit 68fc202

1 file changed

Lines changed: 13 additions & 36 deletions

File tree

‎src/components/views/dialogs/DevtoolsDialog.js‎

Lines changed: 13 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ class SendCustomEvent extends React.Component {
6666
this.setState({ message });
6767
}
6868

69+
_additionalFields() {
70+
return <div></div>;
71+
}
72+
6973
render() {
7074
if (this.state.message) {
7175
return <div>
@@ -78,6 +82,7 @@ class SendCustomEvent extends React.Component {
7882

7983
return <div>
8084
<div className="mx_Dialog_content">
85+
{this._additionalFields()}
8186
<div className="mx_TextInputDialog_label">
8287
<label htmlFor="eventType"> { _t('Event Type') } </label>
8388
</div>
@@ -103,40 +108,14 @@ class SendCustomStateEvent extends SendCustomEvent {
103108
this.refs.stateKey.value);
104109
}
105110

106-
render() {
107-
if (this.state.message) {
108-
return <div>
109-
<div className="mx_Dialog_content">
110-
{this.state.message}
111-
</div>
112-
{this._buttons()}
113-
</div>;
114-
}
115-
111+
_additionalFields() {
116112
return <div>
117-
<div className="mx_Dialog_content">
118-
<div className="mx_TextInputDialog_label">
119-
<label htmlFor="stateKey"> { _t('State Key') } </label>
120-
</div>
121-
<div>
122-
<input id="stateKey" ref="stateKey" className="mx_TextInputDialog_input" size="64" />
123-
</div>
124-
125-
<div className="mx_TextInputDialog_label">
126-
<label htmlFor="eventType"> { _t('Event Type') } </label>
127-
</div>
128-
<div>
129-
<input id="eventType" ref="eventType" className="mx_TextInputDialog_input" size="64" />
130-
</div>
131-
132-
<div className="mx_TextInputDialog_label">
133-
<label htmlFor="evContent"> { _t('Event Content') } </label>
134-
</div>
135-
<div>
136-
<textarea id="evContent" ref="evContent" className="mx_TextInputDialog_input" defaultValue={"{\n\n}"} cols="63" rows="5" />
137-
</div>
113+
<div className="mx_TextInputDialog_label">
114+
<label htmlFor="stateKey"> { _t('State Key') } </label>
115+
</div>
116+
<div>
117+
<input id="stateKey" ref="stateKey" className="mx_TextInputDialog_input" size="64" />
138118
</div>
139-
{this._buttons()}
140119
</div>;
141120
}
142121
}
@@ -162,16 +141,14 @@ class RoomStateExplorer extends React.Component {
162141
};
163142

164143
browseEventType(eventType) {
165-
const self = this;
166144
return () => {
167-
self.setState({ eventType });
145+
this.setState({ eventType });
168146
};
169147
}
170148

171149
onViewSourceClick(event) {
172-
const self = this;
173150
return () => {
174-
self.setState({ event: event.event });
151+
this.setState({ event: event.event });
175152
};
176153
}
177154

0 commit comments

Comments
 (0)