Skip to content

Commit

Permalink
webmail: fix displaying a message in separate window if there was no …
Browse files Browse the repository at this point in the history
…known viewmode (text or html or html with externals)

we were sending a zero value for ViewMode, which the frontend js rejected
during parsing.

noticed during testing.
  • Loading branch information
mjl- committed Oct 4, 2024
1 parent 32b549b commit edb6e8d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion webmail/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,10 @@ func fromAddrViewMode(tx *bstore.Tx, from MessageAddress) (store.ViewMode, error
err = tx.Get(&fas)
if err == bstore.ErrAbsent {
return settingsViewMode()
} else if err != nil {
return store.ModeText, err
}
return fas.ViewMode, err
return fas.ViewMode, nil
}

// FromAddressSettingsSave saves per-"From"-address settings.
Expand Down
2 changes: 2 additions & 0 deletions webmail/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ func formatFirstLine(r io.Reader) (string, error) {
}

func parsedMessage(log mlog.Log, m store.Message, state *msgState, full, msgitem bool) (pm ParsedMessage, rerr error) {
pm.ViewMode = store.ModeText // Valid default, in case this makes it to frontend.

if full || msgitem {
if !state.ensurePart(m, true) {
return pm, state.err
Expand Down

0 comments on commit edb6e8d

Please sign in to comment.