ChunxiaZhang / Toaster

0 stars 0 forks source link

There is Follow or Unfollow menu in my own user view activity #27

Open ChunxiaZhang opened 9 years ago

ChunxiaZhang commented 9 years ago

When I go to my own repo, there is a menu right top corner for following and unfollwing. It's unreasonable to follow or unfollow myself.

ChunxiaZhang commented 9 years ago

Resolve. Cause: They didn't confirm if this user is the user who login. Solution: Add verification to confirm if this is the login user's Code: In UserViewActivity.java: private void checkFollowingUserStatus() { followingStatusChecked = false; // to verify if this this login user if (AccountUtils.getLogin(this).equals(user.login)) { return; } CheckFollowingUser userFollowingClient = new CheckFollowingUser(this, user.login); userFollowingClient.setOnCheckFollowingUser(new OnCheckFollowingUser() { @Override public void onCheckFollowUser(String username, boolean following) { isFollowing = following; followingStatusChecked = true; invalidateOptionsMenu(); } }); userFollowingClient.execute(); }