move func PartStructure from webhook to queue, so it isn't tracked anymore for apidiff changes

the types in webhook should be subjected to apidiff'ing, this was a shared
function. it is better off in package queue. also change the apidiff script so
it leaves apidiff/next.txt empty when there aren't any changes. makes it easier
to rotate the files after releases where nothing changed (a common occurrence).
This commit is contained in:
Mechiel Lukkien
2024-12-07 13:57:07 +01:00
parent 0871bf5219
commit 69a4995449
7 changed files with 62 additions and 53 deletions

View File

@ -44,7 +44,6 @@ import (
"github.com/mjl-/mox/store"
"github.com/mjl-/mox/webapi"
"github.com/mjl-/mox/webauth"
"github.com/mjl-/mox/webhook"
"github.com/mjl-/mox/webops"
)
@ -1263,7 +1262,7 @@ func (s server) MessageGet(ctx context.Context, req webapi.MessageGetRequest) (r
MailboxName: mb.Name,
}
structure, err := webhook.PartStructure(log, &p)
structure, err := queue.PartStructure(log, &p)
xcheckf(err, "parsing structure")
result := webapi.MessageGetResult{

View File

@ -25,7 +25,6 @@ import (
"github.com/mjl-/mox/queue"
"github.com/mjl-/mox/store"
"github.com/mjl-/mox/webapi"
"github.com/mjl-/mox/webhook"
)
var ctxbg = context.Background()
@ -418,7 +417,7 @@ func TestServer(t *testing.T) {
tcheckf(t, err, "reading raw message")
part, err := message.EnsurePart(log.Logger, true, bytes.NewReader(b.Bytes()), int64(b.Len()))
tcheckf(t, err, "parsing raw message")
structure, err := webhook.PartStructure(log, &part)
structure, err := queue.PartStructure(log, &part)
tcheckf(t, err, "part structure")
tcompare(t, structure, msgRes.Structure)