1:1
This commit is contained in:
@@ -65,7 +65,7 @@ func (h *InboxHandler) List(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, inboxListResponse(inboxes))
|
||||
c.JSON(http.StatusOK, inboxListResponse(inboxes, h.svc.DB(), inboxSerializationAdmin(c)))
|
||||
}
|
||||
|
||||
// @Summary Get a single inbox
|
||||
@@ -103,7 +103,7 @@ func (h *InboxHandler) Get(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, serializeInbox(inbox))
|
||||
c.JSON(http.StatusOK, serializeInbox(inbox, h.svc.DB(), inboxSerializationAdmin(c)))
|
||||
}
|
||||
|
||||
// @Summary Create a new inbox
|
||||
@@ -147,10 +147,10 @@ func (h *InboxHandler) Create(c *gin.Context) {
|
||||
AuditableType: "Inbox",
|
||||
AuditableID: inbox.ID,
|
||||
Action: "create",
|
||||
AuditedChanges: serializeInbox(inbox),
|
||||
AuditedChanges: serializeInbox(inbox, h.svc.DB(), true),
|
||||
})
|
||||
|
||||
c.JSON(http.StatusOK, serializeInbox(inbox))
|
||||
c.JSON(http.StatusOK, serializeInbox(inbox, h.svc.DB(), inboxSerializationAdmin(c)))
|
||||
}
|
||||
|
||||
// WhatsAppAuthorization handles Chatwoot's embedded signup callback for
|
||||
@@ -238,10 +238,10 @@ func (h *InboxHandler) Update(c *gin.Context) {
|
||||
AuditableType: "Inbox",
|
||||
AuditableID: inbox.ID,
|
||||
Action: "update",
|
||||
AuditedChanges: serializeInbox(inbox),
|
||||
AuditedChanges: serializeInbox(inbox, h.svc.DB(), true),
|
||||
})
|
||||
|
||||
c.JSON(http.StatusOK, serializeInbox(inbox))
|
||||
c.JSON(http.StatusOK, serializeInbox(inbox, h.svc.DB(), inboxSerializationAdmin(c)))
|
||||
}
|
||||
|
||||
// @Summary Delete an inbox
|
||||
@@ -937,5 +937,9 @@ func (h *InboxHandler) ResetSecret(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, serializeInbox(inbox))
|
||||
c.JSON(http.StatusOK, serializeInbox(inbox, h.svc.DB(), inboxSerializationAdmin(c)))
|
||||
}
|
||||
|
||||
func inboxSerializationAdmin(c *gin.Context) bool {
|
||||
return getRole(c) == "administrator"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user