bug fix http://jira.yoho.cn:8888/browse/YH-2586 review by 阿瑟
Showing
3 changed files
with
35 additions
and
19 deletions
@@ -204,7 +204,7 @@ class HomeContainer extends React.Component { | @@ -204,7 +204,7 @@ class HomeContainer extends React.Component { | ||
204 | } | 204 | } |
205 | 205 | ||
206 | _onSaveingTheWorld() { | 206 | _onSaveingTheWorld() { |
207 | - this.props.actions.goToUser({},this.props.navigationState.name); | 207 | + this.props.actions.goToUser(); |
208 | } | 208 | } |
209 | 209 | ||
210 | render() { | 210 | render() { |
@@ -54,10 +54,12 @@ export function goToSection(section) { | @@ -54,10 +54,12 @@ export function goToSection(section) { | ||
54 | 54 | ||
55 | export function goToUserOrMe(uid) { | 55 | export function goToUserOrMe(uid) { |
56 | return (dispatch, getState) => { | 56 | return (dispatch, getState) => { |
57 | - | ||
58 | let {user} = getState(); | 57 | let {user} = getState(); |
59 | if (uid != 0 && uid == user.profile.uid) { | 58 | if (uid != 0 && uid == user.profile.uid) { |
60 | Actions.User(); | 59 | Actions.User(); |
60 | + dispatch({ | ||
61 | + type: GO_TO_USER, | ||
62 | + }); | ||
61 | } else { | 63 | } else { |
62 | Actions.UserThatNotMe(); | 64 | Actions.UserThatNotMe(); |
63 | dispatch({ | 65 | dispatch({ |
@@ -68,6 +70,24 @@ export function goToUserOrMe(uid) { | @@ -68,6 +70,24 @@ export function goToUserOrMe(uid) { | ||
68 | }; | 70 | }; |
69 | } | 71 | } |
70 | 72 | ||
73 | +export function goToUser() { | ||
74 | + return (dispatch, getState) => { | ||
75 | + let operation = () => { | ||
76 | + Actions.User(); | ||
77 | + return { | ||
78 | + type: GO_TO_USER, | ||
79 | + }; | ||
80 | + }; | ||
81 | + | ||
82 | + let {user} = getState(); | ||
83 | + if (user.profile.uid == 0) { | ||
84 | + dispatch(loginThenSyncUserInfo(operation)); | ||
85 | + } else { | ||
86 | + dispatch(operation()); | ||
87 | + } | ||
88 | + }; | ||
89 | +} | ||
90 | + | ||
71 | export function goToPost(id) { | 91 | export function goToPost(id) { |
72 | Actions.SubjectPost(); | 92 | Actions.SubjectPost(); |
73 | return { | 93 | return { |
@@ -258,14 +278,6 @@ export function resetErrorCount() { | @@ -258,14 +278,6 @@ export function resetErrorCount() { | ||
258 | }; | 278 | }; |
259 | } | 279 | } |
260 | 280 | ||
261 | -export function goToUser(user, previousScene) { | ||
262 | - Actions.User(); | ||
263 | - return { | ||
264 | - type: GO_TO_USER, | ||
265 | - payload: {...user, previousScene}, | ||
266 | - }; | ||
267 | -} | ||
268 | - | ||
269 | function parseBNS(json) { | 281 | function parseBNS(json) { |
270 | let {resourceList, forumInfo} = json; | 282 | let {resourceList, forumInfo} = json; |
271 | let {advertList, textNoticeList} = resourceList; | 283 | let {advertList, textNoticeList} = resourceList; |
@@ -59,6 +59,13 @@ const { | @@ -59,6 +59,13 @@ const { | ||
59 | 59 | ||
60 | } = require('../../constants/actionTypes').default; | 60 | } = require('../../constants/actionTypes').default; |
61 | 61 | ||
62 | +export function goToMessageCenter() { | ||
63 | + Actions.MessageCenter(); | ||
64 | + return { | ||
65 | + type: GO_TO_MESSAGE_CENTER, | ||
66 | + }; | ||
67 | +} | ||
68 | + | ||
62 | export function userDidLogout() { | 69 | export function userDidLogout() { |
63 | return { | 70 | return { |
64 | type: USER_DID_LOGOUT, | 71 | type: USER_DID_LOGOUT, |
@@ -286,13 +293,6 @@ export function reply(ptr = false) { | @@ -286,13 +293,6 @@ export function reply(ptr = false) { | ||
286 | }; | 293 | }; |
287 | } | 294 | } |
288 | 295 | ||
289 | -export function goToMessageCenter() { | ||
290 | - Actions.MessageCenter(); | ||
291 | - return { | ||
292 | - type: GO_TO_MESSAGE_CENTER, | ||
293 | - }; | ||
294 | -} | ||
295 | - | ||
296 | export function userInfoRequest() { | 296 | export function userInfoRequest() { |
297 | return { | 297 | return { |
298 | type: USER_INFO_REQUEST, | 298 | type: USER_INFO_REQUEST, |
@@ -394,8 +394,12 @@ export function loginThenSyncUserInfo(operation=()=>{}) { | @@ -394,8 +394,12 @@ export function loginThenSyncUserInfo(operation=()=>{}) { | ||
394 | return (dispatch, getState) => { | 394 | return (dispatch, getState) => { |
395 | ReactNative.NativeModules.YH_CommunityHelper.login() | 395 | ReactNative.NativeModules.YH_CommunityHelper.login() |
396 | .then(uid => { | 396 | .then(uid => { |
397 | - dispatch(setUid(uid)); | ||
398 | - dispatch(syncUserWithSSOUid(uid)); | 397 | + /* |
398 | + * 已在HomeContainer监听了登录成功的事件, | ||
399 | + * 故此处可以注释掉了,不再需要手动调用用户信息同步 | ||
400 | + */ | ||
401 | + // dispatch(setUid(uid)); | ||
402 | + // dispatch(syncUserWithSSOUid(uid)); | ||
399 | operation(); | 403 | operation(); |
400 | }) | 404 | }) |
401 | .catch(error => { | 405 | .catch(error => { |
-
Please register or login to post a comment