about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/components.js5
-rw-r--r--app/assets/javascripts/components/components/relative_timestamp.jsx15
-rw-r--r--app/assets/javascripts/components/components/status_list.jsx16
-rw-r--r--app/assets/javascripts/components/containers/mastodon.jsx5
-rw-r--r--app/assets/javascripts/components/features/status/components/detailed_status.jsx2
-rw-r--r--package.json1
-rw-r--r--yarn.lock4
7 files changed, 19 insertions, 29 deletions
diff --git a/app/assets/javascripts/components.js b/app/assets/javascripts/components.js
index 0ac74c70c..1604d5198 100644
--- a/app/assets/javascripts/components.js
+++ b/app/assets/javascripts/components.js
@@ -5,6 +5,11 @@ window.React    = require('react');
 window.ReactDOM = require('react-dom');
 window.Perf     = require('react-addons-perf');
 
+if (!window.Intl) {
+  require('intl');
+  require('intl/locale-data/jsonp/en.js');
+}
+
 //= require_tree ./components
 
 window.Mastodon = require('./components/containers/mastodon');
diff --git a/app/assets/javascripts/components/components/relative_timestamp.jsx b/app/assets/javascripts/components/components/relative_timestamp.jsx
index 96f99cca8..3a5b88523 100644
--- a/app/assets/javascripts/components/components/relative_timestamp.jsx
+++ b/app/assets/javascripts/components/components/relative_timestamp.jsx
@@ -4,21 +4,12 @@ import {
   FormattedRelative
 } from 'react-intl';
 
-const RelativeTimestamp = ({ timestamp, now }) => {
-  const diff = (new Date(now)) - (new Date(timestamp));
-
-  if (diff < 0) {
-    return <FormattedMessage id='relative_time.just_now' defaultMessage='Just now' />
-  } else if (diff > (3600 * 24 * 7 * 1000)) {
-    return <FormattedDate value={timestamp} />
-  } else {
-    return <FormattedRelative value={timestamp} initialNow={now} updateInterval={0} />
-  }
+const RelativeTimestamp = ({ timestamp }) => {
+  return <FormattedRelative value={new Date(timestamp)} />;
 };
 
 RelativeTimestamp.propTypes = {
-  timestamp: React.PropTypes.string.isRequired,
-  now: React.PropTypes.any
+  timestamp: React.PropTypes.string.isRequired
 };
 
 export default RelativeTimestamp;
diff --git a/app/assets/javascripts/components/components/status_list.jsx b/app/assets/javascripts/components/components/status_list.jsx
index 91fb45cf5..f989ef895 100644
--- a/app/assets/javascripts/components/components/status_list.jsx
+++ b/app/assets/javascripts/components/components/status_list.jsx
@@ -18,22 +18,8 @@ const StatusList = React.createClass({
     };
   },
 
-  getInitialState () {
-    return {
-      now: (new Date()).toString()
-    };
-  },
-
   mixins: [PureRenderMixin],
 
-  componentDidMount () {
-    this._interval = setInterval(() => this.setState({ now: (new Date()).toString() }), 60000);
-  },
-
-  componentWillUnmount () {
-    clearInterval(this._interval);
-  },
-
   handleScroll (e) {
     const { scrollTop, scrollHeight, clientHeight } = e.target;
 
@@ -61,7 +47,7 @@ const StatusList = React.createClass({
       <div className='scrollable' onScroll={this.handleScroll}>
         <div>
           {statusIds.map((statusId) => {
-            return <StatusContainer key={statusId} id={statusId} now={this.state.now} />;
+            return <StatusContainer key={statusId} id={statusId} />;
           })}
         </div>
       </div>
diff --git a/app/assets/javascripts/components/containers/mastodon.jsx b/app/assets/javascripts/components/containers/mastodon.jsx
index dbc32076b..a12b19746 100644
--- a/app/assets/javascripts/components/containers/mastodon.jsx
+++ b/app/assets/javascripts/components/containers/mastodon.jsx
@@ -32,7 +32,8 @@ import Following from '../features/following';
 import Reblogs from '../features/reblogs';
 import Favourites from '../features/favourites';
 import HashtagTimeline from '../features/hashtag_timeline';
-import { IntlProvider } from 'react-intl';
+import { IntlProvider, addLocaleData } from 'react-intl';
+import en from 'react-intl/locale-data/en';
 
 const store = configureStore();
 
@@ -40,6 +41,8 @@ const browserHistory = useRouterHistory(createBrowserHistory)({
   basename: '/web'
 });
 
+addLocaleData([...en]);
+
 const Mastodon = React.createClass({
 
   propTypes: {
diff --git a/app/assets/javascripts/components/features/status/components/detailed_status.jsx b/app/assets/javascripts/components/features/status/components/detailed_status.jsx
index 8efdf195f..76ddafb3b 100644
--- a/app/assets/javascripts/components/features/status/components/detailed_status.jsx
+++ b/app/assets/javascripts/components/features/status/components/detailed_status.jsx
@@ -54,7 +54,7 @@ const DetailedStatus = React.createClass({
         {media}
 
         <div style={{ marginTop: '15px', color: '#616b86', fontSize: '14px', lineHeight: '18px' }}>
-          <a className='detailed-status__datetime' style={{ color: 'inherit' }} href={status.get('url')} target='_blank' rel='noopener'><FormattedDate value={status.get('created_at')} hour12={false} year='numeric' month='short' day='2-digit' hour='2-digit' minute='2-digit' /></a> · <Link to={`/statuses/${status.get('id')}/reblogs`} style={{ color: 'inherit', textDecoration: 'none' }}><i className='fa fa-retweet' /><span style={{ fontWeight: '500', fontSize: '12px', marginLeft: '6px', display: 'inline-block' }}><FormattedNumber value={status.get('reblogs_count')} /></span></Link> · <Link to={`/statuses/${status.get('id')}/favourites`} style={{ color: 'inherit', textDecoration: 'none' }}><i className='fa fa-star' /><span style={{ fontWeight: '500', fontSize: '12px', marginLeft: '6px', display: 'inline-block' }}><FormattedNumber value={status.get('favourites_count')} /></span></Link>
+          <a className='detailed-status__datetime' style={{ color: 'inherit' }} href={status.get('url')} target='_blank' rel='noopener'><FormattedDate value={new Date(status.get('created_at'))} hour12={false} year='numeric' month='short' day='2-digit' hour='2-digit' minute='2-digit' /></a> · <Link to={`/statuses/${status.get('id')}/reblogs`} style={{ color: 'inherit', textDecoration: 'none' }}><i className='fa fa-retweet' /><span style={{ fontWeight: '500', fontSize: '12px', marginLeft: '6px', display: 'inline-block' }}><FormattedNumber value={status.get('reblogs_count')} /></span></Link> · <Link to={`/statuses/${status.get('id')}/favourites`} style={{ color: 'inherit', textDecoration: 'none' }}><i className='fa fa-star' /><span style={{ fontWeight: '500', fontSize: '12px', marginLeft: '6px', display: 'inline-block' }}><FormattedNumber value={status.get('favourites_count')} /></span></Link>
         </div>
       </div>
     );
diff --git a/package.json b/package.json
index 6264b62f5..2b34153d4 100644
--- a/package.json
+++ b/package.json
@@ -43,6 +43,7 @@
     "babel-plugin-transform-decorators-legacy": "^1.3.4",
     "emojione": "^2.2.6",
     "http-link-header": "^0.5.0",
+    "intl": "^1.2.5",
     "react-autosuggest": "^7.0.1",
     "react-decoration": "^1.4.0",
     "react-intl": "^2.1.5",
diff --git a/yarn.lock b/yarn.lock
index fac059911..580c0e1a6 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2497,6 +2497,10 @@ interpret@^1.0.0:
   version "1.0.1"
   resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.1.tgz#d579fb7f693b858004947af39fa0db49f795602c"
 
+intl:
+  version "1.2.5"
+  resolved "https://registry.yarnpkg.com/intl/-/intl-1.2.5.tgz#82244a2190c4e419f8371f5aa34daa3420e2abde"
+
 intl-format-cache@^2.0.5:
   version "2.0.5"
   resolved "https://registry.yarnpkg.com/intl-format-cache/-/intl-format-cache-2.0.5.tgz#b484cefcb9353f374f25de389a3ceea1af18d7c9"