| 1 | package calls |
| 2 | |
| 3 | // Team mode's knock push: who is told, when somebody is at the door of a |
| 4 | // call they are not in. A knock is a member's to answer, and in team mode |
| 5 | // a member is whoever the roster says is one at the moment the push goes: |
| 6 | // a person taken off the team gets nothing (their device rows stay, and a |
| 7 | // re-added member is reached again), and a person whose standing cannot |
| 8 | // be decided now gets nothing either — a push is said once and never |
| 9 | // retried (knocked), so the conservative answer is silence. With no push |
| 10 | // key configured nothing here runs at all: knocked returns first. |
| 11 | |
| 12 | import ( |
| 13 | "context" |
| 14 | |
| 15 | "amadan.net/oficina/home/roster" |
| 16 | |
| 17 | "amadan.net/oficina/calls/internal/calls/teamstate" |
| 18 | ) |
| 19 | |
| 20 | // teamMemberPersonIDs is every person the roster says is a Member now, |
| 21 | // each asked separately (standingOf, a fresh Access per person), never |
| 22 | // the request's or anybody else's. |
| 23 | func (a *app) teamMemberPersonIDs(ctx context.Context) ([]int64, error) { |
| 24 | people, err := teamstate.Subjects(ctx, a.team.db, a.team.issuer()) |
| 25 | if err != nil { |
| 26 | return nil, err |
| 27 | } |
| 28 | ids := make([]int64, 0, len(people)) |
| 29 | for _, ps := range people { |
| 30 | if a.team.Access(ctx, ps.Subject).State() == roster.Member { |
| 31 | ids = append(ids, ps.PersonID) |
| 32 | } |
| 33 | } |
| 34 | return ids, nil |
| 35 | } |
| 36 | |