fossasia / loklak_webclient

loklak web application
http://loklak-web.herokuapp.com
MIT License
1.56k stars 49 forks source link

Fix #575 | Making the User profile box consistent for Report page as home page #576

Closed akashdeepsinghal closed 8 years ago

akashdeepsinghal commented 8 years ago

Old

screen shot 2016-03-15 at 1 39 23 pm

v/s

New

screen shot 2016-03-15 at 1 38 38 pm
aneeshd16 commented 8 years ago

@akigupta131 This is a wrong approach to solving the problem. The values in the view should come from the analyze controller, and not from the actual values of the logged in user. This is so that the data can be processed before binding it to the view.

akashdeepsinghal commented 8 years ago

@aneeshd16 In the home view, value comes from root right? I mean if we have stored the values for logged in user in rootScope, then whenever we switch to a different view, user is same so those are not going to be changed. So why call an API for again? (Though I have not removed the API call) PS: My bad, if I misunderstood something.

sudheesh001 commented 8 years ago

A better approach would be to not show the empty profile card until the data is obtained to display the information of the user. I agree with @aneeshd16 that this is not how the values should come in from.

akashdeepsinghal commented 8 years ago

@aneeshd16 @sudheesh001 I asked earlier too, Does the profile box on reports page show data(Display Picture, Banner Name etc) for the logged in user or the name I am 'creating new report' for?

Earlier, I got answer from Aneesh that it shows data for logged in user. And if that is the case, I am still not getting, why is that approach not right.

sudheesh001 commented 8 years ago

@akigupta131 It looks like it's definitely providing the results for the currently logged in user and when an explicit query is made it can give the new results for the new user who is queried.

akashdeepsinghal commented 8 years ago

@aneeshd16 But since I was under impression that data is for logged in user, according to our discussion (Or I might have confused), so I made the solution for logged in user and not for the one for whom query is made. So my solution will not work.

Though some changes can be made to the current main code (not mine) for stabilizing this issue.

EDIT:

I guess no change needed in loklak_webclient.

I was accessing from localhost. And I don't know why, contrary to Loklak API Docs, I am not recieving any data on localhost while I receive full data from Loklac server API. PFA the screenshots.

Localhost:- http://localhost:9000/api/user.json?screen_name=loklak_app

screen shot 2016-03-21 at 5 08 34 pm

V/S

Loklak Server:- http://loklak.org/api/user.json?screen_name=akigupta131

screen shot 2016-03-21 at 5 09 40 pm

So since data.user is empty, The code from analyze.js ends the further processing and

                var followerstotal=data.user.followers_count;
                vm.topology = data.topology;
                $scope.followerstotal=data.user.followers_count;
                $scope.followingstotal=data.user.friends_count;
                $scope.name=data.user.name;
                $scope.profilepicurl=data.user.profile_image_url_https;
                $scope.profilebanner=data.user.profile_banner_url;
                $scope.tweetcount=data.user.statuses_count;

All the entries are left undefined. Also, that is the reason why All the analysis data is undefined.

screen shot 2016-03-28 at 12 36 26 pm
leonmak commented 8 years ago

closing as #575 postponed due to it being related to loklak_server