Skip to content

Very severe gotcha in 'group' method #4

@jfrank14

Description

@jfrank14

The group method is documented to imply that it adds users to the group, but in fact it REPLACES the users in the group. If you add users A and B to a group X, and then you call it again to add users C and D, I found that the ONLY USERS IN THE GROUP are C and D, while A and B are no longer in the group.

I just learned this via a nasty shock when I was trying to add one user to a group with many existing users and found that after doing this that user was the ONLY user in the group.

The way Discourse itself adds a user to a group seems to be a POST to:

/admin/users/{userId}/groups
data: group_id={groupId}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions