Favorite star doesn't un-fav when filled and clicked
Reported by Ed Finkler | April 21st, 2010 @ 10:11 PM | in Version 0.10
So you've got a favorite, and the star is filled, but if you click the star it actually tries to re-fav the status, rather than toggle off the fav state.
Comments and changes to this ticket
-
Mark Armendariz April 23rd, 2010 @ 10:31 PM
- Assigned user set to Ed Finkler
Just downloaded your codebase moments ago to see if i could offer any help. Still trying to wrap my head around things, but I found a fix for this - although it's far too early for me to suggest it as a change as I've no idea what it could Possibly break. At any rate...
In Spaz.Data.makeFavorite(), you are explicitly adding the "favorited" class directly:
$('.timeline-entry[data-status-id='+postid+']').addClass('favorited');
But in spaz.controller, under '.status-action-fav', you're using the Spaz.UI.getElementFromStatusId() method to get the element meant to be un/favorited. I'm not sure what it's returning, but it's definitely returning the wrong element, and hence, the $(element).hasClass('favorited') always returns false.
In Spaz.UI.getElementFromStatusId(), I replaced the current line (which is far less precise) with the one from Spaz.Data.makeFavorite():
Spaz.UI.getElementFromStatusId = function(id) { // var element = $('.entry-id:contains('+id+')').parent().get()[0]; // Original var element = $('.timeline-entry[data-status-id='+id+']') if (element) { sch.dump(element.id); return element } return false; };
And now it works great, although there's no telling what that may have shattered.
I don't really use spaz much, but I'm a fan of the project. Rock on.
Mark (enobrev)
-
Mark Armendariz April 23rd, 2010 @ 10:31 PM
- Assigned user cleared.
-
Ed Finkler May 10th, 2010 @ 01:26 PM
- Assigned user set to Ed Finkler
-
Ed Finkler June 14th, 2010 @ 09:27 AM
- State changed from new to resolved
Finally got this fixed up. Thanks Mark!
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
The Spaz Desktop project