Skip to:
Content

bbPress.org

Opened 8 years ago

Closed 8 years ago

#1905 closed defect (fixed)

Subscribe/Favourite ajax links issue

Reported by: TFUME Owned by: MZAWeb
Milestone: 2.3 Priority: normal
Severity: normal Version: 2.1
Component: Component - Forums Keywords: has-patch needs-testing
Cc: jmdodd@…, wordpress@…

Description

Topic Subscribe and Favorite ajax links stop changing after two clicks.

EG:
Click 1 -> Subscribe changes to Unsubscribe
Click 2 -> Unsubscribe changes to Subscribe
Click 3 -> Links stays on Subscribe but the user does actually subscribe to the topic and visible in profile

Can be replicated on new bbPress.org website with 2.1 forums.

Attachments (1)

1905.diff (20.6 KB) - added by MZAWeb 8 years ago.

Download all attachments as: .zip

Change History (17)

#1 @johnjamesjacoby
8 years ago

  • Milestone changed from Awaiting Review to 2.2

#2 @jmdodd
8 years ago

  • Cc jmdodd@… added

#3 @MZAWeb
8 years ago

  • Cc wordpress@… added

First click fires an ajax call. Second click fires an ajax call. Third click fires 2 ajax calls, and from there it doubles with each click.

After 5 clicks: http://screenshots.mzaweb.com/hJTq

#4 follow-up: @MZAWeb
8 years ago

There's a nesting of callbacks. Removing the last line of subsLinkSetup in templates/default/js/topic.js fixes this issue. Not sure what that line is intending to do.

The line is:

subscriptionToggle.get(0).wpList.process( subscriptionToggle );

#5 @MZAWeb
8 years ago

  • Cc wordpress@… removed

#6 @MZAWeb
8 years ago

  • Cc wordpress@… added

#8 in reply to: ↑ 4 @MZAWeb
8 years ago

Ok, researched a bit more. For wp 3.4.x this in fact fixes the issue:

Removing the last line of subsLinkSetup in templates/default/js/topic.js fixes this issue.

subscriptionToggle.get(0).wpList.process( subscriptionToggle );

But due to http://core.trac.wordpress.org/changeset/22396 this will probably break again in 3.5

#9 @johnjamesjacoby
8 years ago

Well, that's annoying.

#10 @johnjamesjacoby
8 years ago

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

(In [4511]) Ajax:

  • Remove call to wpList.process().
  • Fixes duplicate ajax requests on topic subscriptions and favorites.
  • Props MZAWeb.
  • Fixes #1905 for WordPress 3.4.

#11 @johnjamesjacoby
8 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening to rethink for WordPress 3.5. Maybe we can do this without relying on wp-lists.

#12 follow-up: @MZAWeb
8 years ago

Never got to play with wpList, but if you're ok with going pure wp_ajax_ I'd gladly take a stab at it

#13 in reply to: ↑ 12 @johnjamesjacoby
8 years ago

Replying to MZAWeb:

Never got to play with wpList, but if you're ok with going pure wp_ajax_ I'd gladly take a stab at it

Please do. There doesn't seem to be a lot to gain by relying on admin scripts, as we'll perpetually run into this situation again and again.

@MZAWeb
8 years ago

#14 @MZAWeb
8 years ago

  • Keywords has-patch needs-testing added

Done. Looking good.

#15 @MZAWeb
8 years ago

  • Owner set to MZAWeb
  • Status changed from reopened to new

#16 @johnjamesjacoby
8 years ago

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

(In [4543]) Subscriptions/Favorites:

  • Improvements to AJAX handling.
  • Introduces bbp_ajax_response() function in common/functions.php, to handle JSON output.
  • Adds AJAX failure responses.
  • Props MZAWeb.
  • Fixes #1905.
Note: See TracTickets for help on using tickets.