mirror of
https://github.com/ghostersk/gowebmail.git
synced 2026-06-17 07:59:38 +01:00
fixed message rendering with html content ( white background)
This commit is contained in:
@@ -134,6 +134,10 @@ func TestConnection(account *gomailModels.EmailAccount) error {
|
||||
|
||||
func (c *Client) Close() { c.imap.Logout() }
|
||||
|
||||
func (c *Client) DeleteMailbox(name string) error {
|
||||
return c.imap.Delete(name)
|
||||
}
|
||||
|
||||
func (c *Client) ListMailboxes() ([]*imap.MailboxInfo, error) {
|
||||
ch := make(chan *imap.MailboxInfo, 64)
|
||||
done := make(chan error, 1)
|
||||
|
||||
@@ -404,6 +404,24 @@ func (h *APIHandler) CountFolderMessages(w http.ResponseWriter, r *http.Request)
|
||||
func (h *APIHandler) DeleteFolder(w http.ResponseWriter, r *http.Request) {
|
||||
userID := middleware.GetUserID(r)
|
||||
folderID := pathInt64(r, "id")
|
||||
|
||||
// Look up folder before deleting so we have its path and account
|
||||
folder, err := h.db.GetFolderByID(folderID)
|
||||
if err != nil || folder == nil {
|
||||
h.writeError(w, http.StatusNotFound, "folder not found")
|
||||
return
|
||||
}
|
||||
|
||||
// Delete on IMAP server first
|
||||
account, err := h.db.GetAccount(folder.AccountID)
|
||||
if err == nil && account != nil {
|
||||
if imapClient, cerr := email.Connect(context.Background(), account); cerr == nil {
|
||||
_ = imapClient.DeleteMailbox(folder.FullPath)
|
||||
imapClient.Close()
|
||||
}
|
||||
}
|
||||
|
||||
// Delete from local DB
|
||||
if err := h.db.DeleteFolder(folderID, userID); err != nil {
|
||||
h.writeError(w, http.StatusInternalServerError, "delete failed")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user