mirror of
https://github.com/mjl-/mox.git
synced 2025-07-19 03:26:37 +03:00
imap metadata extension: allow keys in the /shared/ namespace too
not just /private. /shared/ is the more commonly implemented namespace, because it is easier te implement: you don't need per-user/account storage of metadata. i initially approached it from the other direction: we don't have a mechanism to share metadata with other accounts, so everything is private, and i assumed that would be what a user would prefer. but email clients make the decisions, and they'll likely try the /shared/ namespace.
This commit is contained in:
@ -31,16 +31,18 @@ func TestMetadata(t *testing.T) {
|
||||
},
|
||||
})
|
||||
|
||||
tc.transactf("ok", `setmetadata Inbox (/shared/comment "share")`)
|
||||
|
||||
tc.transactf("ok", `getmetadata inbox (/private/comment /private/unknown /shared/comment)`)
|
||||
tc.xuntagged(imapclient.UntaggedMetadataAnnotations{
|
||||
Mailbox: "Inbox",
|
||||
Annotations: []imapclient.Annotation{
|
||||
{Key: "/private/comment", IsString: true, Value: []byte("mailbox value")},
|
||||
{Key: "/shared/comment", IsString: true, Value: []byte("share")},
|
||||
},
|
||||
})
|
||||
|
||||
tc.transactf("no", `setmetadata doesnotexist (/private/comment "test")`) // Bad mailbox.
|
||||
tc.transactf("no", `setmetadata Inbox (/shared/comment "")`) // /shared/ not implemented.
|
||||
tc.transactf("no", `setmetadata Inbox (/badprefix/comment "")`)
|
||||
tc.transactf("no", `setmetadata Inbox (/private/vendor "")`) // /*/vendor must have more components.
|
||||
tc.transactf("no", `setmetadata Inbox (/private/vendor/stillbad "")`) // /*/vendor must have more components.
|
||||
@ -131,7 +133,7 @@ func TestMetadata(t *testing.T) {
|
||||
},
|
||||
})
|
||||
// Same as previous, but ask for everything below /.
|
||||
tc.transactf("ok", `getmetadata (depth infinity) inbox (/)`)
|
||||
tc.transactf("ok", `getmetadata (depth infinity) inbox ("")`)
|
||||
tc.xuntagged(imapclient.UntaggedMetadataAnnotations{
|
||||
Mailbox: "Inbox",
|
||||
Annotations: []imapclient.Annotation{
|
||||
@ -142,6 +144,7 @@ func TestMetadata(t *testing.T) {
|
||||
{Key: "/private/another", IsString: true, Value: []byte("longer")},
|
||||
{Key: "/private/comment", IsString: false, Value: []byte("test")},
|
||||
{Key: "/private/vendor/a/b", IsString: true, Value: []byte("")},
|
||||
{Key: "/shared/comment", IsString: true, Value: []byte("share")},
|
||||
},
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user