Authored by 于良

bug fix http://jira.yoho.cn:8888/browse/YH-3284 review by 盖剑秋

@@ -14,7 +14,6 @@ import { @@ -14,7 +14,6 @@ import {
14 import {bindActionCreators} from 'redux'; 14 import {bindActionCreators} from 'redux';
15 import {connect} from 'react-redux'; 15 import {connect} from 'react-redux';
16 import {Map} from 'immutable'; 16 import {Map} from 'immutable';
17 -import timeago from 'timeago.js';  
18 import Immutable, {List, Record} from 'immutable'; 17 import Immutable, {List, Record} from 'immutable';
19 import {Actions} from 'react-native-router-flux'; 18 import {Actions} from 'react-native-router-flux';
20 19
@@ -24,6 +23,7 @@ import * as subjectPostActions from '../reducers/subject/subjectPostActions'; @@ -24,6 +23,7 @@ import * as subjectPostActions from '../reducers/subject/subjectPostActions';
24 import * as homeActions from '../reducers/home/homeActions'; 23 import * as homeActions from '../reducers/home/homeActions';
25 import * as appActions from '../reducers/app/appActions'; 24 import * as appActions from '../reducers/app/appActions';
26 import {number10KFormater} from '../utils/numberFormater'; 25 import {number10KFormater} from '../utils/numberFormater';
  26 +import timeago from '../utils/timeago';
27 27
28 const actions = [ 28 const actions = [
29 subjectPostActions, 29 subjectPostActions,
@@ -197,7 +197,7 @@ class SubjectPostContainer extends Component { @@ -197,7 +197,7 @@ class SubjectPostContainer extends Component {
197 render() { 197 render() {
198 let item = this.props.subject.items.get(this.sid); 198 let item = this.props.subject.items.get(this.sid);
199 let {headIcon,nickName,uid} = item.authorInfo; 199 let {headIcon,nickName,uid} = item.authorInfo;
200 - let timeagoStr = timeago().format(item.createTime, 'zh_CN'); 200 + let timeagoStr = timeago(item.createTime);
201 let header = { 201 let header = {
202 uid, 202 uid,
203 headIcon, 203 headIcon,
@@ -267,8 +267,13 @@ export function doReport(sid, params) { @@ -267,8 +267,13 @@ export function doReport(sid, params) {
267 267
268 export function requestPostContent(sid, postsId) { 268 export function requestPostContent(sid, postsId) {
269 return (dispatch, getState) => { 269 return (dispatch, getState) => {
  270 + let {subject, user} = getState();
  271 + let item = subject.items.get(sid);
  272 + if (!item) {
  273 + return;
  274 + }
  275 +
270 dispatch(doRequestContent(sid)); 276 dispatch(doRequestContent(sid));
271 - let {user} = getState();  
272 let uid = user.profile.uid; 277 let uid = user.profile.uid;
273 let params = {postsId, uid}; 278 let params = {postsId, uid};
274 new PostingService().getPostContent(params) 279 new PostingService().getPostContent(params)