Opened 12 years ago
Closed 12 years ago
#5633 closed defect (bug) (fixed)
Group Administration - Add new members metabox & changing opinion
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 2.1 | Priority: | normal |
| Severity: | normal | Version: | 2.0 |
| Component: | Groups | Keywords: | has-patch |
| Cc: |
Description
While on a particular Group Administration, it's possible to use the "Add new members" metabox to add a user to the current group using the autocomplete feature.
If i select a member, a new li is created in the ul#bp-groups-new-members-list and an hidden text field containing the user id is created. This hidden field ( new_members[] ) is the one used to actually get the members to add to the group.
The problem is when before updating the group i decide to change my mind about one of the users i want to add. If i click on the x link, it removes the li but not the corresponding hidden field new_members[]. As a result this member will "wrongly" be added when updating the group.
I suggest the attached patch to make sure it's not the case.
Attachments (2)
Change History (6)
#2
follow-up:
↓ 3
@
12 years ago
Short of re-working all the JS to not have use a hidden field(s), patch looks OK
I guess I probably originally wrote this, but I don't know why I would have done it this way. First thought was no-js support, but this technique certainly does not do *that*.
imath, your patch is fine, but if you felt like rewriting this section so that the hidden input is not required, feel free. (Maybe put data- fields into the #bp-groups-new-members-list items containing the user IDs, and then pre-submit, grab all of those IDs and put them into a single hidden input. Or even into .bp-suggest-user as comma-separated user_login values, which would have the bonus of providing true no-js support.)
#3
in reply to:
↑ 2
@
12 years ago
Replying to boonebgorges:
... Or even into
.bp-suggest-useras comma-separated user_login values, which would have the bonus of providing true no-js support.)
Thanks DJPaul & boonebgorges for your feedbacks. I like the "true no-js support" option. 5633.02.patch is trying to achieve it.
Short of re-working all the JS to not have use a hidden field(s), patch looks OK, but there's some small improvements:
===instead of==. You might have to typecast.val()for this.$(this)and$(e.target)more than once, you should store these in variables and use those.