Add meetings panel to the rooms page, add checkbox for marking for autojoin
This commit is contained in:
1 parent
e9ad57524e
commit
f5f389f5d3
6 files changed
+101
-7
No files matched your search
@@ -21,8 +21,10 @@ func NewService(r *Repository) (*Service, error) {
|
||||
return &Service{r: r}, nil
|
||||
}
|
||||
|
||||
// Create validates and stores a new meeting authored by u.
|
||||
func (s *Service) Create(ctx context.Context, u *user.User, title, intent, room string, scheduledAt time.Time) (*Meeting, error) {
|
||||
// Create validates and stores a new meeting authored by u. When autoJoin is
|
||||
// true the author's "join" vote is cast immediately so the meeting reflects
|
||||
// their intent to attend.
|
||||
func (s *Service) Create(ctx context.Context, u *user.User, title, intent, room string, scheduledAt time.Time, autoJoin bool) (*Meeting, error) {
|
||||
if u == nil {
|
||||
slog.Error("nil user", slog.String("op", "service.Create"))
|
||||
return nil, ErrInternal
|
||||
@@ -47,6 +49,13 @@ func (s *Service) Create(ctx context.Context, u *user.User, title, intent, room
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Optionally record the author's own "join" vote straight away.
|
||||
if autoJoin {
|
||||
if err := s.r.UpsertVote(ctx, created.Id, u.Id, VoteJoin); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// Re-read so the response carries the author name and vote aggregates.
|
||||
return s.r.MeetingById(ctx, u.Id, created.Id)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user