Merge branch 'develop' of git+ssh://github.com/vector-im/vector-web into matthew/redesign

This commit is contained in:
Matthew Hodgson 2015-10-25 02:12:35 +00:00
commit 19d272b171
2 changed files with 32 additions and 0 deletions

View file

@ -52,9 +52,27 @@ module.exports = React.createClass({
if (this.props.onFinished) this.props.onFinished(); 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() { render: function() {
var resendButton; var resendButton;
var viewSourceButton; var viewSourceButton;
var redactButton;
if (this.props.mxEvent.status == 'not_sent') { if (this.props.mxEvent.status == 'not_sent') {
resendButton = ( resendButton = (
@ -63,6 +81,13 @@ module.exports = React.createClass({
</div> </div>
); );
} }
else {
redactButton = (
<div className="mx_ContextualMenu_field" onClick={this.onRedactClick}>
Delete
</div>
);
}
viewSourceButton = ( viewSourceButton = (
<div className="mx_ContextualMenu_field" onClick={this.onViewSourceClick}> <div className="mx_ContextualMenu_field" onClick={this.onViewSourceClick}>
View Source View Source
@ -72,6 +97,7 @@ module.exports = React.createClass({
return ( return (
<div> <div>
{resendButton} {resendButton}
{redactButton}
{viewSourceButton} {viewSourceButton}
</div> </div>
); );

View file

@ -173,6 +173,12 @@ module.exports = React.createClass({
case this.FieldErrors.InUse: case this.FieldErrors.InUse:
strings.push(keys[i]+" is already taken"); strings.push(keys[i]+" is already taken");
break; 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(', '); var errtxt = strings.join(', ');