mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-17 17:47:03 +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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user