mirror of
https://github.com/SoDOff-Project/sodoff.git
synced 2026-01-13 05:31:51 -08:00
Fixed an issue where not being in a group would cause an error
This commit is contained in:
parent
1f4699a382
commit
7a3f84b49e
@ -300,6 +300,7 @@ public class GroupController : Controller {
|
|||||||
if (request.ForUserID != null) {
|
if (request.ForUserID != null) {
|
||||||
Viking? target = ctx.Vikings.FirstOrDefault(v => request.ForUserID.ToUpper() == v.Uid.ToString());
|
Viking? target = ctx.Vikings.FirstOrDefault(v => request.ForUserID.ToUpper() == v.Uid.ToString());
|
||||||
if (target == null) return Ok(new GetGroupsResult { Success = false });
|
if (target == null) return Ok(new GetGroupsResult { Success = false });
|
||||||
|
if (target.GroupMembership?.Group == null) return Ok(new GetGroupsResult { Success = true });
|
||||||
groups = [target.GroupMembership.Group];
|
groups = [target.GroupMembership.Group];
|
||||||
} else {
|
} else {
|
||||||
groups = groups.Where(g => g.Type == GroupType.Public || g.Type == GroupType.MembersOnly);
|
groups = groups.Where(g => g.Type == GroupType.Public || g.Type == GroupType.MembersOnly);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user