Add checkbox for telegram notifications
This commit is contained in:
1 parent
e65d1ac46b
commit
d4257e7dab
10 files changed
+74
-15
No files matched your search
@@ -16,6 +16,10 @@ type createMeetingRequest struct {
|
||||
// AutoJoin asks the server to record the author's own "join" vote so the
|
||||
// meeting carries their intent to attend from the moment it is created.
|
||||
AutoJoin bool `json:"autoJoin"`
|
||||
// HasNotification controls whether notification consumers (such as the
|
||||
// Telegram bot) announce the meeting. It is a pointer so an omitted field
|
||||
// can be distinguished from an explicit false and defaults to enabled.
|
||||
HasNotification *bool `json:"hasNotification"`
|
||||
}
|
||||
|
||||
type voteMeetingRequest struct {
|
||||
@@ -36,6 +40,9 @@ type meetingResponse struct {
|
||||
JoinCount int `json:"joinCount"`
|
||||
DeclineCount int `json:"declineCount"`
|
||||
MyVote string `json:"myVote"`
|
||||
// HasNotification mirrors the stored flag so clients can show whether the
|
||||
// meeting will be announced.
|
||||
HasNotification bool `json:"hasNotification"`
|
||||
}
|
||||
|
||||
func (h *Handler) listMeetings(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -71,7 +78,14 @@ func (h *Handler) createMeeting(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
created, err := h.meetings.Create(r.Context(), u, req.Title, req.Intent, req.Room, scheduledAt, req.AutoJoin)
|
||||
// Omitted hasNotification defaults to true so existing clients keep
|
||||
// announcing meetings unless they explicitly opt out.
|
||||
hasNotification := true
|
||||
if req.HasNotification != nil {
|
||||
hasNotification = *req.HasNotification
|
||||
}
|
||||
|
||||
created, err := h.meetings.Create(r.Context(), u, req.Title, req.Intent, req.Room, scheduledAt, req.AutoJoin, hasNotification)
|
||||
if err != nil {
|
||||
h.fail(w, err)
|
||||
return
|
||||
@@ -154,5 +168,7 @@ func newMeetingResponse(m *meeting.Meeting) meetingResponse {
|
||||
JoinCount: m.JoinCount,
|
||||
DeclineCount: m.DeclineCount,
|
||||
MyVote: m.MyVote,
|
||||
|
||||
HasNotification: m.HasNotification,
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user