~rjarry/aerc-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH aerc] msgstore: do not trigger directory change notification on initial load

Details
Message ID
<20241219135053.47070-1-remko@el-tramo.be>
DKIM signature
pass
Download raw message
Patch: +6 -2
There currently is no difference between updating the store of a
directory that was already loaded, and a directory that has not yet been
initialized. When a directory is opened, and the initial update request
is processed, all messages are therefore treated as new, and the
directory change notification (i.e. bell) is triggered.

To prevent triggering this update, track whether the directory was
already initialized, and if not, don't send out any change
notifications.

Signed-off-by: Remko Tronçon <remko@el-tramo.be>
---
 lib/msgstore.go | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/msgstore.go b/lib/msgstore.go
index 1250a9c0..f64590e0 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -56,6 +56,8 @@ type MessageStore struct {
	buildThreads  bool
	builder       *ThreadBuilder

	directoryContentsLoaded bool

	// Map of uids we've asked the worker to fetch
	onUpdate       func(store *MessageStore) // TODO: multiple onUpdate handlers
	onFilterChange func(store *MessageStore)
@@ -256,6 +258,7 @@ func (store *MessageStore) Update(msg types.WorkerMessage) {
	update := false
	updateThreads := false
	directoryChange := false
	directoryContentsWasLoaded := store.directoryContentsLoaded
	start := store.scrollOffset
	end := store.scrollOffset + store.scrollLen

@@ -281,6 +284,7 @@ func (store *MessageStore) Update(msg types.WorkerMessage) {
		if store.threadedView {
			store.runThreadBuilderNow()
		}
		store.directoryContentsLoaded = true
	case *types.DirectoryThreaded:
		if store.builder == nil {
			store.builder = NewThreadBuilder(store.iterFactory,
@@ -392,13 +396,13 @@ func (store *MessageStore) Update(msg types.WorkerMessage) {
		store.update(updateThreads)
	}

	if directoryChange && store.triggerDirectoryChange != nil {
	if directoryContentsWasLoaded && directoryChange && store.triggerDirectoryChange != nil {
		store.triggerDirectoryChange()
	}

	if len(newUids) > 0 {
		store.FetchHeaders(newUids, nil)
		if store.triggerDirectoryChange != nil {
		if directoryContentsWasLoaded && store.triggerDirectoryChange != nil {
			store.triggerDirectoryChange()
		}
	}
-- 
2.39.0

[aerc/patches] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<D6FQ75NNM9IN.3JZNBOVZP5ON9@fra01>
In-Reply-To
<20241219135053.47070-1-remko@el-tramo.be> (view parent)
DKIM signature
missing
Download raw message
aerc/patches: SUCCESS in 2m21s

[msgstore: do not trigger directory change notification on initial load][0] from [Remko Tronçon][1]

[0]: https://lists.sr.ht/~rjarry/aerc-devel/patches/56545
[1]: remko@el-tramo.be

✓ #1392985 SUCCESS aerc/patches/openbsd.yml     https://builds.sr.ht/~rjarry/job/1392985
✓ #1392984 SUCCESS aerc/patches/alpine-edge.yml https://builds.sr.ht/~rjarry/job/1392984

Applied: [PATCH aerc] msgstore: do not trigger directory change notification on initial load

Details
Message ID
<173462274404.2499896.11024008799054295921@ringo>
In-Reply-To
<20241219135053.47070-1-remko@el-tramo.be> (view parent)
DKIM signature
pass
Download raw message
Remko Tronçon <remko@el-tramo.be> wrote:
> There currently is no difference between updating the store of a
> directory that was already loaded, and a directory that has not yet been
> initialized. When a directory is opened, and the initial update request
> is processed, all messages are therefore treated as new, and the
> directory change notification (i.e. bell) is triggered.
>
> To prevent triggering this update, track whether the directory was
> already initialized, and if not, don't send out any change
> notifications.
>
> Signed-off-by: Remko Tronçon <remko@el-tramo.be>
> ---

Acked-by: Robin Jarry <robin@jarry.cc>

Applied, thanks.

To git@git.sr.ht:~rjarry/aerc
   6512eb2e29b8..8d4704775b1e  master -> master
Reply to thread Export thread (mbox)