1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-17 09:37:02 +00:00

rest: Implement MarkSeen for #58

- message: Add MarkSeen to Manager, StoreManager.
- rest: Add PATCH for /mailbox/name/id.
- rest: Add MailboxMarkSeenV1 handler.
- rest: Add Seen to model.
- rest: Update handlers to set Seen.
- rest: Add doJSONBody func.
This commit is contained in:
James Hillyerd
2018-04-01 11:13:33 -07:00
parent cc5cd7f9c3
commit dc02092cf6
11 changed files with 247 additions and 17 deletions

View File

@@ -57,3 +57,17 @@ func (m *ManagerStub) GetMetadata(mailbox string) ([]*message.Metadata, error) {
func (m *ManagerStub) MailboxForAddress(address string) (string, error) {
return policy.ParseMailboxName(address)
}
// MarkSeen marks a message as having been read.
func (m *ManagerStub) MarkSeen(mailbox, id string) error {
if mailbox == "messageerr" {
return errors.New("internal error")
}
for _, msg := range m.mailboxes[mailbox] {
if msg.ID == id {
msg.Metadata.Seen = true
return nil
}
}
return storage.ErrNotExist
}