mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-18 16:17:03 +00:00
fix: draft mime type instead of composermode
This commit is contained in:
@ -495,12 +495,7 @@ func (b *sendPreferencesBuilder) setEncryptionPreferences(mailSettings pmapi.Mai
|
|||||||
if b.shouldSign() && b.getScheme() == pgpInline {
|
if b.shouldSign() && b.getScheme() == pgpInline {
|
||||||
b.withMIMEType("text/plain")
|
b.withMIMEType("text/plain")
|
||||||
} else {
|
} else {
|
||||||
switch mailSettings.ComposerMode {
|
b.withMIMETypeDefault(mailSettings.DraftMIMEType)
|
||||||
case pmapi.ComposerModeNormal:
|
|
||||||
b.withMIMETypeDefault("text/html")
|
|
||||||
case pmapi.ComposerModePlain:
|
|
||||||
b.withMIMETypeDefault("text/plain")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -51,7 +51,7 @@ func TestPreferencesBuilder(t *testing.T) {
|
|||||||
contactMeta: &ContactMetadata{},
|
contactMeta: &ContactMetadata{},
|
||||||
receivedKeys: []pmapi.PublicKey{{PublicKey: testPublicKey}},
|
receivedKeys: []pmapi.PublicKey{{PublicKey: testPublicKey}},
|
||||||
isInternal: true,
|
isInternal: true,
|
||||||
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, ComposerMode: pmapi.ComposerModeNormal},
|
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, DraftMIMEType: "text/html"},
|
||||||
|
|
||||||
wantEncrypt: true,
|
wantEncrypt: true,
|
||||||
wantSign: true,
|
wantSign: true,
|
||||||
@ -66,7 +66,7 @@ func TestPreferencesBuilder(t *testing.T) {
|
|||||||
contactMeta: &ContactMetadata{MIMEType: "text/plain"},
|
contactMeta: &ContactMetadata{MIMEType: "text/plain"},
|
||||||
receivedKeys: []pmapi.PublicKey{{PublicKey: testPublicKey}},
|
receivedKeys: []pmapi.PublicKey{{PublicKey: testPublicKey}},
|
||||||
isInternal: true,
|
isInternal: true,
|
||||||
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, ComposerMode: pmapi.ComposerModeNormal},
|
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, DraftMIMEType: "text/html"},
|
||||||
|
|
||||||
wantEncrypt: true,
|
wantEncrypt: true,
|
||||||
wantSign: true,
|
wantSign: true,
|
||||||
@ -81,7 +81,7 @@ func TestPreferencesBuilder(t *testing.T) {
|
|||||||
contactMeta: &ContactMetadata{Keys: []string{testContactKey}},
|
contactMeta: &ContactMetadata{Keys: []string{testContactKey}},
|
||||||
receivedKeys: []pmapi.PublicKey{{PublicKey: testPublicKey}},
|
receivedKeys: []pmapi.PublicKey{{PublicKey: testPublicKey}},
|
||||||
isInternal: true,
|
isInternal: true,
|
||||||
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, ComposerMode: pmapi.ComposerModeNormal},
|
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, DraftMIMEType: "text/html"},
|
||||||
|
|
||||||
wantEncrypt: true,
|
wantEncrypt: true,
|
||||||
wantSign: true,
|
wantSign: true,
|
||||||
@ -97,7 +97,7 @@ func TestPreferencesBuilder(t *testing.T) {
|
|||||||
contactMeta: &ContactMetadata{Keys: []string{testOtherContactKey}},
|
contactMeta: &ContactMetadata{Keys: []string{testOtherContactKey}},
|
||||||
receivedKeys: []pmapi.PublicKey{{PublicKey: testPublicKey}},
|
receivedKeys: []pmapi.PublicKey{{PublicKey: testPublicKey}},
|
||||||
isInternal: true,
|
isInternal: true,
|
||||||
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, ComposerMode: pmapi.ComposerModeNormal},
|
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, DraftMIMEType: "text/html"},
|
||||||
|
|
||||||
wantEncrypt: true,
|
wantEncrypt: true,
|
||||||
wantSign: true,
|
wantSign: true,
|
||||||
@ -112,7 +112,7 @@ func TestPreferencesBuilder(t *testing.T) {
|
|||||||
contactMeta: &ContactMetadata{},
|
contactMeta: &ContactMetadata{},
|
||||||
receivedKeys: []pmapi.PublicKey{{PublicKey: testPublicKey}},
|
receivedKeys: []pmapi.PublicKey{{PublicKey: testPublicKey}},
|
||||||
isInternal: false,
|
isInternal: false,
|
||||||
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, ComposerMode: pmapi.ComposerModeNormal},
|
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, DraftMIMEType: "text/html"},
|
||||||
|
|
||||||
wantEncrypt: true,
|
wantEncrypt: true,
|
||||||
wantSign: true,
|
wantSign: true,
|
||||||
@ -127,7 +127,7 @@ func TestPreferencesBuilder(t *testing.T) {
|
|||||||
contactMeta: &ContactMetadata{MIMEType: "text/plain"},
|
contactMeta: &ContactMetadata{MIMEType: "text/plain"},
|
||||||
receivedKeys: []pmapi.PublicKey{{PublicKey: testPublicKey}},
|
receivedKeys: []pmapi.PublicKey{{PublicKey: testPublicKey}},
|
||||||
isInternal: false,
|
isInternal: false,
|
||||||
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, ComposerMode: pmapi.ComposerModeNormal},
|
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, DraftMIMEType: "text/html"},
|
||||||
|
|
||||||
wantEncrypt: true,
|
wantEncrypt: true,
|
||||||
wantSign: true,
|
wantSign: true,
|
||||||
@ -142,7 +142,7 @@ func TestPreferencesBuilder(t *testing.T) {
|
|||||||
contactMeta: &ContactMetadata{},
|
contactMeta: &ContactMetadata{},
|
||||||
receivedKeys: []pmapi.PublicKey{{PublicKey: testPublicKey}},
|
receivedKeys: []pmapi.PublicKey{{PublicKey: testPublicKey}},
|
||||||
isInternal: false,
|
isInternal: false,
|
||||||
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPInlinePackage, ComposerMode: pmapi.ComposerModeNormal},
|
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPInlinePackage, DraftMIMEType: "text/html"},
|
||||||
|
|
||||||
wantEncrypt: true,
|
wantEncrypt: true,
|
||||||
wantSign: true,
|
wantSign: true,
|
||||||
@ -157,7 +157,7 @@ func TestPreferencesBuilder(t *testing.T) {
|
|||||||
contactMeta: &ContactMetadata{Scheme: pgpInline},
|
contactMeta: &ContactMetadata{Scheme: pgpInline},
|
||||||
receivedKeys: []pmapi.PublicKey{{PublicKey: testPublicKey}},
|
receivedKeys: []pmapi.PublicKey{{PublicKey: testPublicKey}},
|
||||||
isInternal: false,
|
isInternal: false,
|
||||||
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, ComposerMode: pmapi.ComposerModeNormal},
|
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, DraftMIMEType: "text/html"},
|
||||||
|
|
||||||
wantEncrypt: true,
|
wantEncrypt: true,
|
||||||
wantSign: true,
|
wantSign: true,
|
||||||
@ -172,7 +172,7 @@ func TestPreferencesBuilder(t *testing.T) {
|
|||||||
contactMeta: &ContactMetadata{Scheme: pgpMIME},
|
contactMeta: &ContactMetadata{Scheme: pgpMIME},
|
||||||
receivedKeys: []pmapi.PublicKey{{PublicKey: testPublicKey}},
|
receivedKeys: []pmapi.PublicKey{{PublicKey: testPublicKey}},
|
||||||
isInternal: false,
|
isInternal: false,
|
||||||
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPInlinePackage, ComposerMode: pmapi.ComposerModeNormal},
|
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPInlinePackage, DraftMIMEType: "text/html"},
|
||||||
|
|
||||||
wantEncrypt: true,
|
wantEncrypt: true,
|
||||||
wantSign: true,
|
wantSign: true,
|
||||||
@ -187,7 +187,7 @@ func TestPreferencesBuilder(t *testing.T) {
|
|||||||
contactMeta: &ContactMetadata{Keys: []string{testContactKey}},
|
contactMeta: &ContactMetadata{Keys: []string{testContactKey}},
|
||||||
receivedKeys: []pmapi.PublicKey{{PublicKey: testPublicKey}},
|
receivedKeys: []pmapi.PublicKey{{PublicKey: testPublicKey}},
|
||||||
isInternal: false,
|
isInternal: false,
|
||||||
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, ComposerMode: pmapi.ComposerModeNormal},
|
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, DraftMIMEType: "text/html"},
|
||||||
|
|
||||||
wantEncrypt: true,
|
wantEncrypt: true,
|
||||||
wantSign: true,
|
wantSign: true,
|
||||||
@ -203,7 +203,7 @@ func TestPreferencesBuilder(t *testing.T) {
|
|||||||
contactMeta: &ContactMetadata{Keys: []string{testOtherContactKey}},
|
contactMeta: &ContactMetadata{Keys: []string{testOtherContactKey}},
|
||||||
receivedKeys: []pmapi.PublicKey{{PublicKey: testPublicKey}},
|
receivedKeys: []pmapi.PublicKey{{PublicKey: testPublicKey}},
|
||||||
isInternal: false,
|
isInternal: false,
|
||||||
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, ComposerMode: pmapi.ComposerModeNormal},
|
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, DraftMIMEType: "text/html"},
|
||||||
|
|
||||||
wantEncrypt: true,
|
wantEncrypt: true,
|
||||||
wantSign: true,
|
wantSign: true,
|
||||||
@ -218,7 +218,7 @@ func TestPreferencesBuilder(t *testing.T) {
|
|||||||
contactMeta: &ContactMetadata{},
|
contactMeta: &ContactMetadata{},
|
||||||
receivedKeys: []pmapi.PublicKey{},
|
receivedKeys: []pmapi.PublicKey{},
|
||||||
isInternal: false,
|
isInternal: false,
|
||||||
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, ComposerMode: pmapi.ComposerModeNormal},
|
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, DraftMIMEType: "text/html"},
|
||||||
|
|
||||||
wantEncrypt: false,
|
wantEncrypt: false,
|
||||||
wantSign: false,
|
wantSign: false,
|
||||||
@ -232,7 +232,7 @@ func TestPreferencesBuilder(t *testing.T) {
|
|||||||
contactMeta: &ContactMetadata{MIMEType: "text/plain"},
|
contactMeta: &ContactMetadata{MIMEType: "text/plain"},
|
||||||
receivedKeys: []pmapi.PublicKey{},
|
receivedKeys: []pmapi.PublicKey{},
|
||||||
isInternal: false,
|
isInternal: false,
|
||||||
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, ComposerMode: pmapi.ComposerModeNormal},
|
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, DraftMIMEType: "text/html"},
|
||||||
|
|
||||||
wantEncrypt: false,
|
wantEncrypt: false,
|
||||||
wantSign: false,
|
wantSign: false,
|
||||||
@ -246,7 +246,7 @@ func TestPreferencesBuilder(t *testing.T) {
|
|||||||
contactMeta: &ContactMetadata{Sign: true},
|
contactMeta: &ContactMetadata{Sign: true},
|
||||||
receivedKeys: []pmapi.PublicKey{},
|
receivedKeys: []pmapi.PublicKey{},
|
||||||
isInternal: false,
|
isInternal: false,
|
||||||
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, ComposerMode: pmapi.ComposerModeNormal},
|
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, DraftMIMEType: "text/html"},
|
||||||
|
|
||||||
wantEncrypt: false,
|
wantEncrypt: false,
|
||||||
wantSign: true,
|
wantSign: true,
|
||||||
@ -260,7 +260,7 @@ func TestPreferencesBuilder(t *testing.T) {
|
|||||||
contactMeta: &ContactMetadata{Keys: []string{testContactKey}},
|
contactMeta: &ContactMetadata{Keys: []string{testContactKey}},
|
||||||
receivedKeys: []pmapi.PublicKey{},
|
receivedKeys: []pmapi.PublicKey{},
|
||||||
isInternal: false,
|
isInternal: false,
|
||||||
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, ComposerMode: pmapi.ComposerModeNormal},
|
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, DraftMIMEType: "text/html"},
|
||||||
|
|
||||||
wantEncrypt: false,
|
wantEncrypt: false,
|
||||||
wantSign: false,
|
wantSign: false,
|
||||||
@ -275,7 +275,7 @@ func TestPreferencesBuilder(t *testing.T) {
|
|||||||
contactMeta: &ContactMetadata{Keys: []string{testContactKey}, Encrypt: true, Sign: true},
|
contactMeta: &ContactMetadata{Keys: []string{testContactKey}, Encrypt: true, Sign: true},
|
||||||
receivedKeys: []pmapi.PublicKey{},
|
receivedKeys: []pmapi.PublicKey{},
|
||||||
isInternal: false,
|
isInternal: false,
|
||||||
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, ComposerMode: pmapi.ComposerModeNormal},
|
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, DraftMIMEType: "text/html"},
|
||||||
|
|
||||||
wantEncrypt: true,
|
wantEncrypt: true,
|
||||||
wantSign: true,
|
wantSign: true,
|
||||||
@ -290,7 +290,7 @@ func TestPreferencesBuilder(t *testing.T) {
|
|||||||
contactMeta: &ContactMetadata{Keys: []string{testContactKey}, Encrypt: true, Sign: true, Scheme: pgpInline},
|
contactMeta: &ContactMetadata{Keys: []string{testContactKey}, Encrypt: true, Sign: true, Scheme: pgpInline},
|
||||||
receivedKeys: []pmapi.PublicKey{},
|
receivedKeys: []pmapi.PublicKey{},
|
||||||
isInternal: false,
|
isInternal: false,
|
||||||
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, ComposerMode: pmapi.ComposerModeNormal},
|
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPMIMEPackage, DraftMIMEType: "text/html"},
|
||||||
|
|
||||||
wantEncrypt: true,
|
wantEncrypt: true,
|
||||||
wantSign: true,
|
wantSign: true,
|
||||||
@ -305,7 +305,7 @@ func TestPreferencesBuilder(t *testing.T) {
|
|||||||
contactMeta: &ContactMetadata{Keys: []string{testContactKey}, Encrypt: true, Sign: true},
|
contactMeta: &ContactMetadata{Keys: []string{testContactKey}, Encrypt: true, Sign: true},
|
||||||
receivedKeys: []pmapi.PublicKey{},
|
receivedKeys: []pmapi.PublicKey{},
|
||||||
isInternal: false,
|
isInternal: false,
|
||||||
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPInlinePackage, ComposerMode: pmapi.ComposerModeNormal},
|
mailSettings: pmapi.MailSettings{PGPScheme: pmapi.PGPInlinePackage, DraftMIMEType: "text/html"},
|
||||||
|
|
||||||
wantEncrypt: true,
|
wantEncrypt: true,
|
||||||
wantSign: true,
|
wantSign: true,
|
||||||
|
|||||||
@ -97,11 +97,6 @@ type MailSettings struct {
|
|||||||
// AutoResponder string
|
// AutoResponder string
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
|
||||||
ComposerModePlain = 0
|
|
||||||
ComposerModeNormal = 1
|
|
||||||
)
|
|
||||||
|
|
||||||
// GetMailSettings gets contact details specified by contact ID.
|
// GetMailSettings gets contact details specified by contact ID.
|
||||||
func (c *client) GetMailSettings() (settings MailSettings, err error) {
|
func (c *client) GetMailSettings() (settings MailSettings, err error) {
|
||||||
req, err := c.NewRequest("GET", "/mail/v4/settings", nil)
|
req, err := c.NewRequest("GET", "/mail/v4/settings", nil)
|
||||||
|
|||||||
Reference in New Issue
Block a user