Skip to:
Content

Opened 13 months ago

Closed 11 months ago

Last modified 11 months ago

#4897 closed enhancement (fixed)

Loading more activities after an update displays last activity in double

Reported by: imath Owned by: boonebgorges
Milestone: 1.8 Priority: low
Severity: minor Version: 1.7
Component: Activity Keywords: has-patch needs-testing
Cc:

Description

Hi,

I hope, i'll succeed to explain this minor "issue" in english!!

Let's say, there's 21 activities in database. When i go on Activity directory, i have 20 activities displayed and the load more link.
Now imagine, i post a new activity, i have 21 activities displayed and the load more link.
Now if i click on the load more link, the activity just before the load more link will be displayed again, and we get the same id in double (for instance : #activity-20)

So i thought, the easiest way to avoid this, is to "remove from display" the activity just before the load more link in case of a new update.

You'll find the javascript enhancement in the diff attached to this ticket

Attachments (3)

4897.diff (1.2 KB) - added by imath 13 months ago.
4897.01.diff (4.0 KB) - added by imath 13 months ago.
4897.02.diff (4.1 KB) - added by imath 12 months ago.

Download all attachments as: .zip

Change History (12)

imath13 months ago

comment:1 boonebgorges13 months ago

  • Milestone changed from Awaiting Review to Future Release
  • Priority changed from normal to low

imath13 months ago

comment:2 imath13 months ago

4987.01.diff seems to be better. I've noticed in a plugin i'm working on that if the order of the query changes then the previous method is not working well.

comment:3 follow-up: DJPaul12 months ago

  • Keywords needs-refresh added; has-patch 2nd-opinion removed
  • Milestone changed from Future Release to 1.8

imath; interested in getting this into 1.8?

The patch needs another look, if only because doing this is unsafe: :)

$qs[] = 'exclude=' . $_POST['exclude_just_posted']

comment:4 in reply to: ↑ 3 imath12 months ago

Replying to DJPaul:

imath; interested in getting this into 1.8?

Yes !! i'll check this tomorrow to make it safer ;)

imath12 months ago

comment:5 imath12 months ago

  • Keywords has-patch added; needs-refresh removed

Just added 4897.02.diff (using wp_parse_id_list() to be sure ids are int)

comment:6 DJPaul12 months ago

  • Keywords needs-testing added

comment:7 follow-up: boonebgorges11 months ago

Great patch, imath. I've cleaned it up a bit, but the technique works well for me.

comment:8 boonebgorges11 months ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from new to closed

In 7116:

Exclude dynamically added activity items when clicking Load More in directory

This prevents duplicate items appearing after Load More due to the numeric
offset caused by AJAX-inserted activity items.

Fixes #4897

Props imath

comment:9 in reply to: ↑ 7 imath11 months ago

Replying to boonebgorges:

Great patch, imath. I've cleaned it up a bit, but the technique works well for me.

Thanks @boone ;)

Note: See TracTickets for help on using tickets.