Domain's group assigment is not preserved between dis/re-enabling via web UI black/whitelist

I disabled some domains via web UI blacklist and re-enabled them also via blacklist. They got not associated with the Group "unassociated" but instead "non selected". This breaks the blocking because all my clients are in the default group unassociated.

  Pi-hole version is v4.3.2-435-g5878502 (Latest: v4.4)
  AdminLTE version is v4.3.2-433-g0b4a5de (Latest: v4.3.3)
  FTL version is vDev-71e8498 (Latest: v4.3.1)

https://tricorder.pi-hole.net/9a70f7jyfb

edit
Same happens to whitelist....

edit2
Expected behavior: Group assignment should be preserved when dis/enabling via webUI black/whitelist.

Another thing is when you disable or enable then go to the next page (pressing next then previous) and go back, the toggle resets,
that is, it does not keep the updated toggle state.

@yubiuser
I've ckecked this and can confirm the issue.
Pihole -v says the same as shown above.

@chillax
Sometimes your browser isn't reloading the site correctly. I often press STRG-F5 to force a reload after adding, deleting or manipulating entries in the domain lists.

I understand that, but that is not the problem.

The problem is both pages/tabs Blacklist and Group management -> Domains

they both use the same groups-domain.js which looks like it is written specifically for Domains page.
When you toggle enable or disable, the Domains page supply the group id while Blacklist page
doesn't, thus this never get's executed in Blacklist or Whitelist

this is in groups.php line 510

So one solution could be to just copy-paste Domains table to both Blacklist and Whitelist page and adapt it.

Edit ok the table is pretty much the same missing a single column, group assignment, which is needed to provide the group id.

in groups-domains.js

My vim is messing up the git diff so im just gonna post the solution here. @DanSchaper

Only delete then insert group to domain associations if groups parameter is set.
line 496 in /groups.php add

if (isset($_POST['groups']) {
then in line 530 add (right after commit)
}

Can you PR that at https://github.com/pi-hole/AdminLTE ?

i will try, gosh i hate git

3 Likes

https://github.com/pi-hole/AdminLTE/pull/1172

1 Like

This PR has been merged into v5.0

Can confirm it's working.

Thanks to @chillax

1 Like