2015-10-21 19:50:40 +03:00
|
|
|
/*
|
2016-01-07 07:06:39 +03:00
|
|
|
Copyright 2015, 2016 OpenMarket Ltd
|
2015-10-21 19:50:40 +03:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
2015-11-27 18:02:32 +03:00
|
|
|
var React = require('react');
|
2017-03-03 20:35:42 +03:00
|
|
|
var MatrixClientPeg = require('../../../MatrixClientPeg');
|
2015-10-21 19:50:40 +03:00
|
|
|
|
2015-11-27 18:02:32 +03:00
|
|
|
module.exports = React.createClass({
|
2015-11-30 18:19:43 +03:00
|
|
|
displayName: 'UnknownBody',
|
2015-10-21 19:50:40 +03:00
|
|
|
|
2015-11-27 18:02:32 +03:00
|
|
|
render: function() {
|
2017-03-03 20:35:42 +03:00
|
|
|
const ev = this.props.mxEvent;
|
|
|
|
var text = ev.getContent().body;
|
|
|
|
if (ev.isRedacted()) {
|
|
|
|
const room = MatrixClientPeg.get().getRoom(ev.getRoomId());
|
|
|
|
const because = ev.getUnsigned().redacted_because;
|
|
|
|
const name = room.getMember(because.sender).name || because.sender;
|
|
|
|
text = "This event was redacted by " + name;
|
2017-03-03 19:45:29 +03:00
|
|
|
}
|
2015-11-27 18:02:32 +03:00
|
|
|
return (
|
2016-01-03 03:11:11 +03:00
|
|
|
<span className="mx_UnknownBody">
|
2017-03-03 19:45:29 +03:00
|
|
|
{text}
|
2015-11-27 18:02:32 +03:00
|
|
|
</span>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
});
|