diff --git a/src/skins/vector/views/molecules/MessageContextMenu.js b/src/skins/vector/views/molecules/MessageContextMenu.js index 66f1d6d4c8..249d9a3437 100644 --- a/src/skins/vector/views/molecules/MessageContextMenu.js +++ b/src/skins/vector/views/molecules/MessageContextMenu.js @@ -52,9 +52,27 @@ module.exports = React.createClass({ if (this.props.onFinished) this.props.onFinished(); }, + onRedactClick: function() { + MatrixClientPeg.get().redactEvent( + this.props.mxEvent.getRoomId(), this.props.mxEvent.getId() + ).done(function() { + // message should disappear by itself + }, function(e) { + var ErrorDialog = sdk.getComponent("organisms.ErrorDialog"); + // display error message stating you couldn't delete this. + var code = e.errcode || e.statusCode; + Modal.createDialog(ErrorDialog, { + title: "Error", + description: "You cannot delete this message. (" + code + ")" + }); + }); + if (this.props.onFinished) this.props.onFinished(); + }, + render: function() { var resendButton; var viewSourceButton; + var redactButton; if (this.props.mxEvent.status == 'not_sent') { resendButton = ( @@ -63,6 +81,13 @@ module.exports = React.createClass({ ); } + else { + redactButton = ( +
+ Delete +
+ ); + } viewSourceButton = (
View Source @@ -72,6 +97,7 @@ module.exports = React.createClass({ return (
{resendButton} + {redactButton} {viewSourceButton}
); diff --git a/src/skins/vector/views/templates/Register.js b/src/skins/vector/views/templates/Register.js index 638dac1515..6db0786eeb 100644 --- a/src/skins/vector/views/templates/Register.js +++ b/src/skins/vector/views/templates/Register.js @@ -173,6 +173,12 @@ module.exports = React.createClass({ case this.FieldErrors.InUse: strings.push(keys[i]+" is already taken"); break; + case this.FieldErrors.Length: + strings.push(keys[i] + " is not long enough."); + break; + default: + console.error("Unhandled FieldError: %s", bad[keys[i]]); + break; } } var errtxt = strings.join(', ');