martin
(Martin Brennan)
16 Julio, 2026 03:48
19
martin:
Por ejemplo, este de los menús laterales de grupos, creo que lo haría funcionar de la misma manera, así que tendrías esto en la configuración:
grupos:
tipo: grupos
obligatorio: true
resolver_membresías_de_grupo: true
validaciones:
máximo: 20
Luego, en el cliente, grupos se convertiría en usuario_en_grupos como un booleano.
He implementado esto en la PR a continuación:
main ← dev/resolve-group-membership-theme-object-group
merged 12:19AM - 17 Jul 26 UTC
Followup 7e77ce4bd3889820d67b52a5788357ac6f7b2f58
We need to automatically re… solve group membership into a boolean
for theme object type settings which are of the group type, similar
to what we did in the original commit above for group list type
settings.
This behaves in the same way -- for an object setting schema like this:
```
menu_sections:
type: objects
default:
- name: section 1
groups:
- 1
- 3
schema:
name: menu section
properties:
name:
type: string
groups:
type: groups
resolve_group_membership: true
```
We replace `groups` with a boolean `user_in_groups` (groups is just
the property name, it could be foo_bar etc.) and then you can
do this on the client:
```
for (const section of settings.menu_sections) {
if (section.user_in_groups) {
// User is in at least one selected group for this section.
}
}
```
Rather than inspecting the `currentUser.groups`, which only includes
visible groups, not all groups the user is a member of. This allows
for more accurate permission checks for theme settings that are group
based.
Also c.f. https://meta.discourse.org/t/granular-group-based-permissions-for-anonymous-and-logged-in-users/402273/18?u=martin
Y @Lilly he creado una PR para tu componente de tema de menús laterales de grupos desde un fork que aplica esta funcionalidad de manera compatible con versiones anteriores:
main ← martin-brennan:dev/apply-resolve-group-changes
opened 03:43AM - 16 Jul 26 UTC
See https://github.com/discourse/discourse/pull/41756, which must
be merged fir… st
`resolve_group_membership` can now be used on group type of theme setting object settings, so instead of relying on currentUser.groups which only has visible groups in the client, we can use `user_in_groups` which is automatically resolved from the server side
This is backwards-compatible with sites that don't yet have the
core functionality deployed
Trabajaré en la parte de grupos_no_permitidos a continuación.
2 Me gusta