williamparry / imgur-Extension

Former repository for the imgur Community Extension

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Imgur's "All" album defaults to undefined

jmlind opened this issue · comments

Images that are tied to my account but aren't within a specific gallery come up in the dropdown as the "undefined" gallery. Previous version just had my username.

Images were from http://lowriskff.imgur.com/all/. The images were correct, only the naming of the "gallery" in the dropdown was incorrect.

Screenshot

Edit, from below: Seems to be only contained in the time after authenticating with imgur.com and before reloading the extension page.

In the console of that page could you type:

model.authenticated.fetchUser()

It should return you an object like this:

{id: 12345, url: "williamparry", bio: null, reputation: 71, created: 12345} 

I'd like to know if your "url" property is being returned properly.

Yep, looks like the url is returning properly. Scrubbed output:

{id: 12345, url: "lowriskFF", bio: null, reputation: 26, created: 12345}

Can you try this now?

model.authenticated.getAccount()

Testing whether it gets stored properly or not. You should be able to go:

model.authenticated.getAccount().url

And have your username returned.

Are there any console errors?

Yep, model seems to be stored properly (everything matches), and the username is returned as expected. No console errors.

Hum. See, this is the code:

var defaultAlbumOpt = UTILS.DOM.create('option');
defaultAlbumOpt.value = '_userAlbum';
defaultAlbumOpt.text = model.authenticated.getAccount().url;
ENavSelect.appendChild(defaultAlbumOpt);

What version of Chrome are you running?

Chrome version 26.0.1410.64 m.

Also, I just thought to close the extension page and reload it -- album is now named correctly. Seems to be only contained in the time after authenticating with imgur.com and before reloading the extension page.

I cleared authentication, re-authenticated and it worked fine for me. Although, I do remember that when I was creating albums through the UI, there was a delay in the name being returned (which is why I took it out). Strange that it didn't disappear when you refreshed the page.

[Edit] Just saw that it did fix itself on reload. This might be an API delay issue.

I can't reproduce, but I'll leave this open in case something comes to mind. Thanks!

Yeah, that is a bit strange. I just reinstalled the extension to test again. Once I authenticate, it just has "-this computer-" and "undefined". When I refresh the extension page, it has those two, plus my other albums from imgur.com. It keeps the "undefined" even when I close down the extension page.

It is correctly updated to my username when I tell it to fetch the user again:

model.authenticated.fetchUser()

And then refresh the extension page.

It was listening for EVENT_SUCCESS but all that was registered was EVENT_COMPLETE.

I've updated the model to fire EVENT_SUCCESS.

Could you clear authentication, reload the app from the extensions page and try again?

Works just fine on a fresh install!

Hot sauce.