ansonphong / postworld

Wordpress Theme Development Framework
GNU General Public License v2.0
7 stars 0 forks source link

Deleted Posts in Cached Feed Outline #77

Closed ansonphong closed 10 years ago

ansonphong commented 10 years ago

Hi Michel, There's a glitch I ran into today whereby if a post were listed as favorites or view later for instance, and I retrieve that list of favorites from the DB which is saved as a feed_outline, and go to display it. Now if one of the posts has been deleted since it was added to the feed outline, then when we go to display the feed, then we receive this Angular Error:

Error: [ngRepeat:dupes]

Is there an easy way to solve this in the feed controller itself?

Ideally we also run maintenance cron tasks on all the favorites, and update them when posts are deleted, or build in a recursive delete function on the post which removes all instances of the post ID throughout the database. Although for now this seems like the easiest method --- if the post doesn't exist, then somehow just ignore it or skip over it.

ansonphong commented 10 years ago

Sometimes the feed crashes when there is a deleted post in it. Other times it displays like this :

image

michelhabib commented 10 years ago

i will recreate the issue here and send you a fix today.

ansonphong commented 10 years ago

Great thanks.

Is it also possible to after live-deleting a post, actually remove it from the feed?

How would that work, would we put an emit action deletePost which emits upwards to the parent feedController, which has a listener which when it hears deletePost then walks the posts object and removes the right post? Is this how it would work?

I'm trying to implement the delete post functionality - and I have got it deleting just fine with a confirm box, although the best I've been able to do to actually delete it from the feed is emit to the postdata - post_title:"deleted"

michelhabib commented 10 years ago

live-deleting a post:- Will the deletion happen in the same web page where the live-feed [or load-feed] exists? I can experiment with that once i figure the other exception above.

ansonphong commented 10 years ago

yes - the live deleting will happen right on the post. would you like to download the RSV2 repo and configure it to see it in-place, or do you prefer to work out of context in the dev environment?

On Tue, Nov 12, 2013 at 5:31 AM, michelhabib notifications@github.comwrote:

live-deleting a post:- Will the deletion happen in the same web page where the live-feed [or load-feed] exists? I can experiment with that once i figure the other exception above.

— Reply to this email directly or view it on GitHubhttps://github.com/phongmedia/postworld/issues/77#issuecomment-28293063 .

ansonphong commented 10 years ago

This is a visual example : image

michelhabib commented 10 years ago

yes, i prefer working in postworld first, just to make as general as possible. I am just trying to get the ideas together for the original issue, we have the following cases:- When a post is deleted, it can exist in 3 different places:- 1- Posts table, and that is not a problem, it will not appear again in the live feed. 2- Registered Feed, and this has to be re-registered again in order to update the post ids. 3- cached outline, and this has to be removed manually from the javascript code that entered the post id [that is deleted afterwards]

i made an update that ignores deleted posts. [it might need a little tweak on the UI to remove any extra html tags that appear for deleted posts]. you will also need to put the following in ng-repeat in order to avoid the error above:- track by $index

<div>
    <h2>{{title}} </h2> 
    <div id="scrollMe"  class="infinite-scroll">
      <div infinite-scroll='getNext()' infinite-scroll-disabled='busy' infinite-scroll-parent>
        <div ng-repeat='post in items track by $index' >
            <div feed-item ng-include="templateUrl" post="post" feed-id='args.feed_id'></div>
            <hr>
          <div style='clear: both;'></div>
        </div>
        <div ng-show='busy' class="text-center"><img src="http://www.showoffimports.nl/sandbox/live/ajaxLoad.gif"></div>
        <div ng-show='!busy' class="text-center"><strong>{{scrollMessage}}</strong></div>
      </div>
    </div>
</div>

I didn't try to handle this error from the AngularJS Code, since doing so will mess with many functions, especially with scrolling the feeds, showing Ads, etc... so it has to be handled using the ways above.

The latest code is pushed, and unfortunately you would need to do the above addition in load-feed in order to avoid the error message.

ansonphong commented 10 years ago

ok I'll give that a try, thanks. for the othe rissue getting posts to disappear after quick-delete - I solved that one by putting ng-hide on a variable which is set after it's deleted.