Skip to content

Commit

Permalink
Fix add Group Member noise (NOJIRA)
Browse files Browse the repository at this point in the history
  • Loading branch information
Benn Oshrin committed Sep 27, 2025
1 parent 3f7da8b commit b7d403d
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions app/src/Model/Table/GroupMembersTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,17 @@ public function buildRules(RulesChecker $rules): RulesChecker {
* @return string Display field
*/

public function generateDisplayField(GroupMember $entity): string {
// Pull the group and person information to build a more useful display string

return __d('field', 'group_membership', [$entity->person->primary_name->full_name, $entity->group->name]);
public function generateDisplayField(GroupMember $entity): ?string {
// Pull the group and person information to build a more useful display string.
// Note because there is no setAddContains() (this is probably the only place
// where it would be useful if it were even conceptually a thing) we can't assume
// we have any entity information here.

if(!empty($entity->person->primary_name)) {
return __d('field', 'group_membership', [$entity->person->primary_name->full_name, $entity->group->name]);
}

return null;
}

/**
Expand Down Expand Up @@ -575,6 +582,10 @@ public function saveAttributeCollectorPetitionAttributes(int $personId, array $f
$member[$fld->enrollment_attribute->attribute] = $fld->value;
}

if(!isset($member['group_id'])) {
return null;
}

return $this->saveOrFail($this->newEntity($member));
}
}

0 comments on commit b7d403d

Please sign in to comment.