--- Posting actions ---
(key string)
| 240 | view := &mailView{ |
| 241 | vc: vc, |
| 242 | topicViewport: viewport.New(viewport.WithWidth(0), viewport.WithHeight(0)), |
| 243 | searchList: contentList{hideSeenState: true}, |
| 244 | } |
| 245 | if vc.loadCover != nil { |
| 246 | view.cover = parseCoverPreset(vc.loadCover()) |
| 247 | } |
| 248 | return view |
| 249 | } |
| 250 | |
| 251 | func (v *mailView) Init() tea.Cmd { |
| 252 | if len(v.boxes) == 0 { |
| 253 | return v.requestSources() |
| 254 | } |
| 255 | if v.boxIndex < len(v.boxes) { |
| 256 | return v.requestPostings(v.boxes[v.boxIndex]) |
| 257 | } |
| 258 | return nil |
| 259 | } |
| 260 | |
| 261 | func (v *mailView) Update(msg tea.Msg) (tea.Cmd, bool) { |
| 262 | switch msg := msg.(type) { |
| 263 | case mailSourcesLoadedMsg: |
| 264 | if msg.requestID != v.sourceRequestID { |
| 265 | return nil, true |
| 266 | } |
| 267 | v.screenerCount = msg.screenerCount |
| 268 | sources := msg.sources |
| 269 | if msg.folderErr != nil { |
| 270 | v.folderDiscoveryErr = msg.folderErr.Error() |
| 271 | for _, source := range v.boxes { |
| 272 | if source.Kind == mail.KindFolder { |
| 273 | sources = append(sources, source) |
| 274 | } |
| 275 | } |
| 276 | } else { |
| 277 | v.folderDiscoveryErr = "" |
| 278 | } |
| 279 | if msg.collectionErr != nil { |
| 280 | v.collectionDiscoveryErr = msg.collectionErr.Error() |
| 281 | for _, source := range v.boxes { |
| 282 | if source.Kind == mail.KindCollection { |
| 283 | sources = append(sources, source) |
| 284 | } |
| 285 | } |
| 286 | } else { |
| 287 | v.collectionDiscoveryErr = "" |
| 288 | } |
| 289 | v.updateSourceDiscoveryNotice() |
no test coverage detected