JiGS-RPG-engine icon indicating copy to clipboard operation
JiGS-RPG-engine copied to clipboard

create admin view to monitor flags

Open Techbot opened this issue 1 year ago • 3 comments

There are some example views with the module and a recipe book somewhere.

pair programming required.

Techbot avatar May 11 '24 09:05 Techbot

There are basic Views visible on the /user/* pages. If the user has paragraphs and nodes flagged, these items will display, with their ID.

The 2 main things missing from the Views right now

  1. an indication of which node the flagged paragraphs are on
  2. the flag name (machine name)

Without these, a list of flagged paragraphs aren't that useful.

1 Isn't related to Flags, as such. I might have found some hints. https://www.drupal.org/project/paragraphs_admin/issues/3406566 https://www.drupal.org/forum/support/module-development-and-code-questions/2023-04-24/way-to-query-all-nodes-that-use-a-specific-paragraph-field

2 I can't find anything online about flag names and the language is confusion - on the Create flag form it is called "label". In the data base I think it's the flag_id (not to be confused with the entity id). When we were looking at how to access the flag machine name, @Techbot opted for an SQL query https://github.com/Techbot/JiGS-RPG-engine/commit/5201df2e84dcd8441ae6506832c82ea936a7514f

left23 avatar May 22 '24 19:05 left23

Patch https://www.drupal.org/project/flag/issues/2723703

Techbot avatar May 29 '24 14:05 Techbot

I think using the Flag Assign User https://www.drupal.org/project/flag_assign_user contrib module and printing the links in the template overrides resolves this issue as best we can right now.

The Flag Assign User provides a form where the admin can assign or unassign a flag for a specific user.

Selection_099

In the flag template override file, we print some handy links to the form and the flag ID and paired with the list of Missions on the /user/ID page, admins can manage the missions for users (and for testing) https://github.com/Techbot/eclecticmeme/blob/main/web/themes/custom/emc/templates/contrib/flag.html.twig#L42

Selection_098

This all gets quickly out of control if there are multiple missions flagged, or multiple users. There is no way to see the current status of a user's flagged item (whether it is flagged or not).

left23 avatar Oct 28 '24 15:10 left23