allow ShareEvent to devolve into ShareRoom using checkbox + i18n
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
e1d3c2e4c7
commit
bef435e15a
2 changed files with 24 additions and 8 deletions
|
@ -67,10 +67,11 @@ export default class ShareDialog extends React.Component {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.onCopyClick = this.onCopyClick.bind(this);
|
this.onCopyClick = this.onCopyClick.bind(this);
|
||||||
this.onLinkRecentCheckboxClick = this.onLinkRecentCheckboxClick.bind(this);
|
this.onLinkSpecificEventCheckboxClick = this.onLinkSpecificEventCheckboxClick.bind(this);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
linkRecentTicked: false,
|
// MatrixEvent defaults to share linkSpecificEvent
|
||||||
|
linkSpecificEvent: this.props.target instanceof MatrixEvent,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,9 +117,9 @@ export default class ShareDialog extends React.Component {
|
||||||
e.target.onmouseleave = close;
|
e.target.onmouseleave = close;
|
||||||
}
|
}
|
||||||
|
|
||||||
onLinkRecentCheckboxClick() {
|
onLinkSpecificEventCheckboxClick() {
|
||||||
this.setState({
|
this.setState({
|
||||||
linkRecentTicked: !this.state.linkRecentTicked,
|
linkSpecificEvent: !this.state.linkSpecificEvent,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,16 +136,16 @@ export default class ShareDialog extends React.Component {
|
||||||
if (events.length > 0) {
|
if (events.length > 0) {
|
||||||
checkbox = <div>
|
checkbox = <div>
|
||||||
<input type="checkbox"
|
<input type="checkbox"
|
||||||
value={this.state.linkRecentTicked}
|
value={this.state.linkSpecificEvent}
|
||||||
id="mx_ShareDialog_checkbox"
|
id="mx_ShareDialog_checkbox"
|
||||||
onClick={this.onLinkRecentCheckboxClick} />
|
onClick={this.onLinkSpecificEventCheckboxClick} />
|
||||||
<label htmlFor="mx_ShareDialog_checkbox">
|
<label htmlFor="mx_ShareDialog_checkbox">
|
||||||
{ _t('Link to most recent message') }
|
{ _t('Link to most recent message') }
|
||||||
</label>
|
</label>
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.state.linkRecentTicked) {
|
if (this.state.linkSpecificEvent) {
|
||||||
matrixToUrl = makeEventPermalink(this.props.target.roomId, events[events.length - 1].getId());
|
matrixToUrl = makeEventPermalink(this.props.target.roomId, events[events.length - 1].getId());
|
||||||
} else {
|
} else {
|
||||||
matrixToUrl = makeRoomPermalink(this.props.target.roomId);
|
matrixToUrl = makeRoomPermalink(this.props.target.roomId);
|
||||||
|
@ -157,7 +158,21 @@ export default class ShareDialog extends React.Component {
|
||||||
matrixToUrl = makeGroupPermalink(this.props.target.groupId);
|
matrixToUrl = makeGroupPermalink(this.props.target.groupId);
|
||||||
} else if (this.props.target instanceof MatrixEvent) {
|
} else if (this.props.target instanceof MatrixEvent) {
|
||||||
title = _t('Share Room Message');
|
title = _t('Share Room Message');
|
||||||
matrixToUrl = makeEventPermalink(this.props.target.roomId, this.props.target.eventId);
|
checkbox = <div>
|
||||||
|
<input type="checkbox"
|
||||||
|
value={this.state.linkSpecificEvent}
|
||||||
|
id="mx_ShareDialog_checkbox"
|
||||||
|
onClick={this.onLinkSpecificEventCheckboxClick} />
|
||||||
|
<label htmlFor="mx_ShareDialog_checkbox">
|
||||||
|
{ _t('Link to selected message') }
|
||||||
|
</label>
|
||||||
|
</div>;
|
||||||
|
|
||||||
|
if (this.state.linkSpecificEvent) {
|
||||||
|
matrixToUrl = makeEventPermalink(this.props.target.roomId, this.props.target.eventId);
|
||||||
|
} else {
|
||||||
|
matrixToUrl = makeRoomPermalink(this.props.target.roomId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const encodedUrl = encodeURIComponent(matrixToUrl);
|
const encodedUrl = encodeURIComponent(matrixToUrl);
|
||||||
|
|
|
@ -863,6 +863,7 @@
|
||||||
"Share User": "Share User",
|
"Share User": "Share User",
|
||||||
"Share Community": "Share Community",
|
"Share Community": "Share Community",
|
||||||
"Share Room Message": "Share Room Message",
|
"Share Room Message": "Share Room Message",
|
||||||
|
"Link to selected message": "Link to selected message",
|
||||||
"COPY": "COPY",
|
"COPY": "COPY",
|
||||||
"You are currently blacklisting unverified devices; to send messages to these devices you must verify them.": "You are currently blacklisting unverified devices; to send messages to these devices you must verify them.",
|
"You are currently blacklisting unverified devices; to send messages to these devices you must verify them.": "You are currently blacklisting unverified devices; to send messages to these devices you must verify them.",
|
||||||
"We recommend you go through the verification process for each device to confirm they belong to their legitimate owner, but you can resend the message without verifying if you prefer.": "We recommend you go through the verification process for each device to confirm they belong to their legitimate owner, but you can resend the message without verifying if you prefer.",
|
"We recommend you go through the verification process for each device to confirm they belong to their legitimate owner, but you can resend the message without verifying if you prefer.": "We recommend you go through the verification process for each device to confirm they belong to their legitimate owner, but you can resend the message without verifying if you prefer.",
|
||||||
|
|
Loading…
Reference in a new issue