Skip to:
Content

BuddyPress.org

Opened 6 years ago

Closed 6 years ago

#6050 closed defect (bug) (fixed)

Activity admin JS referenceError 'postboxes'

Reported by: hnla Owned by: imath
Milestone: 2.2 Priority: normal
Severity: normal Version:
Component: Activity Keywords: has-patch
Cc: hnla

Description

Reported on the forum (https://buddypress.org/support/topic/activity-referenceerror-postboxes-not-defined/) to be causing an issue with another plugin causing it to fail!

In our admin.js bp-activity ( line 170 )we run:
postboxes.add_postbox_toggles( bp_activity_admin_vars.page );

Along with comment about re-setting the metabox toggles so they are still collapsible in single activity admin screens; however this runs on the top level screen as well.

As a workaround I suggested this fix to check if postboxes is defined.

This appears to stop the error notice and single edit screens metabox toggle still works.

I'm not sure really why we need this postbox toggle reset, guess there's a reason but it's not apparent.

Attachments (1)

6050.patch (646 bytes) - added by hnla 6 years ago.
Add check for postboxes defined

Download all attachments as: .zip

Change History (7)

@hnla
6 years ago

Add check for postboxes defined

#1 @imath
6 years ago

  • Milestone changed from Awaiting Review to 2.2

I'm not sure really why we need this postbox toggle reset, guess there's a reason but it's not apparent.

The reason is: as the activity admin is using wp_enqueue_script( 'comment' ), wp-admin/js/comment.js is loaded and sets the postboxes to the comment screen id postboxes.add_postbox_toggles('comment'); at line 4. Meaning if we don't reset this, collapse fails and the states are not saved for the activity screen but the comment screen.

Thanks a lot for the patch, i think it's ok.

#2 @hnla
6 years ago

@imath ah ok thanks for the explanation, makes sense, assumed there was a reason :)

Only thing that worries me about patching this or perhaps shouldn't worry me/us as we're clearly, if in a minor way, in error - is that these types of errors are all to common, if we fix ours what's that say about many others I'm seeing and if we fix ours wonder if we have others we ought to fix as well?

#3 @imath
6 years ago

I'm really sorry Hugo, but i don't understand :( I've tried to google translate, and it's worse in french. Feeling really bad about my english level right now.

#4 @hnla
6 years ago

@imath - it's not your English level , rather the ability of this loosely constructed language that allows native english speakers to write utter gibberish due to lack of firm rules or understanding of those that do exist :)

To re-phrase: I see many reference errors, and those appear to cause no issues, if we fix up one do we not need to audit and fix any others? then what about all the WP ones I'm seeing (not that they are our concern directly).

#5 @imath
6 years ago

Thanks for your message and the re-phrase.

IMHO, i think it's better to fix all, those that appears to cause no issues today might not tomorrow.

#6 @imath
6 years ago

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

In 9202:

In Activity Administration, avoid a javascript error by making sure the postbox object is defined.

props hnla

Fixes #6050

Note: See TracTickets for help on using tickets.