remove dodgy heuristics for hiding dates on RRs and use DateUtils instead.
reverts 5d99d68a64
fixes https://github.com/vector-im/riot-web/issues/3523
This commit is contained in:
parent
6879f7ee6f
commit
486301cffb
2 changed files with 4 additions and 24 deletions
|
@ -295,16 +295,6 @@ module.exports = WithMatrixClient(React.createClass({
|
||||||
const receiptOffset = 15;
|
const receiptOffset = 15;
|
||||||
let left = 0;
|
let left = 0;
|
||||||
|
|
||||||
// It's possible that the receipt was sent several days AFTER the event.
|
|
||||||
// If it is, we want to display the complete date along with the HH:MM:SS,
|
|
||||||
// rather than just HH:MM:SS.
|
|
||||||
let dayAfterEvent = new Date(this.props.mxEvent.getTs());
|
|
||||||
dayAfterEvent.setDate(dayAfterEvent.getDate() + 1);
|
|
||||||
dayAfterEvent.setHours(0);
|
|
||||||
dayAfterEvent.setMinutes(0);
|
|
||||||
dayAfterEvent.setSeconds(0);
|
|
||||||
let dayAfterEventTime = dayAfterEvent.getTime();
|
|
||||||
|
|
||||||
var receipts = this.props.readReceipts || [];
|
var receipts = this.props.readReceipts || [];
|
||||||
for (var i = 0; i < receipts.length; ++i) {
|
for (var i = 0; i < receipts.length; ++i) {
|
||||||
var receipt = receipts[i];
|
var receipt = receipts[i];
|
||||||
|
@ -340,7 +330,6 @@ module.exports = WithMatrixClient(React.createClass({
|
||||||
suppressAnimation={this._suppressReadReceiptAnimation}
|
suppressAnimation={this._suppressReadReceiptAnimation}
|
||||||
onClick={this.toggleAllReadAvatars}
|
onClick={this.toggleAllReadAvatars}
|
||||||
timestamp={receipt.ts}
|
timestamp={receipt.ts}
|
||||||
showFullTimestamp={receipt.ts >= dayAfterEventTime}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,8 @@ var sdk = require('../../../index');
|
||||||
var Velociraptor = require('../../../Velociraptor');
|
var Velociraptor = require('../../../Velociraptor');
|
||||||
require('../../../VelocityBounce');
|
require('../../../VelocityBounce');
|
||||||
|
|
||||||
|
import DateUtils from '../../../DateUtils';
|
||||||
|
|
||||||
var bounce = false;
|
var bounce = false;
|
||||||
try {
|
try {
|
||||||
if (global.localStorage) {
|
if (global.localStorage) {
|
||||||
|
@ -63,9 +65,6 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
// Timestamp when the receipt was read
|
// Timestamp when the receipt was read
|
||||||
timestamp: React.PropTypes.number,
|
timestamp: React.PropTypes.number,
|
||||||
|
|
||||||
// True to show the full date/time rather than just the time
|
|
||||||
showFullTimestamp: React.PropTypes.bool,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getDefaultProps: function() {
|
getDefaultProps: function() {
|
||||||
|
@ -170,16 +169,8 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
let title;
|
let title;
|
||||||
if (this.props.timestamp) {
|
if (this.props.timestamp) {
|
||||||
const prefix = "Seen by " + this.props.member.userId + " at ";
|
title = "Seen by " + this.props.member.userId + " at " +
|
||||||
let ts = new Date(this.props.timestamp);
|
DateUtils.formatDate(new Date(this.props.timestamp));
|
||||||
if (this.props.showFullTimestamp) {
|
|
||||||
// "15/12/2016, 7:05:45 PM (@alice:matrix.org)"
|
|
||||||
title = prefix + ts.toLocaleString();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// "7:05:45 PM (@alice:matrix.org)"
|
|
||||||
title = prefix + ts.toLocaleTimeString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in a new issue