Commit 3ac6fa2c authored by Kevin Lyda's avatar Kevin Lyda
Browse files

Fix bug in CHANGE and in how SEEN is tracked

parent b2954eb6
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -9,13 +9,14 @@ require (
	github.com/gdamore/tcell/v2 v2.13.8
	github.com/golang-migrate/migrate/v4 v4.19.1
	github.com/jmoiron/sqlx v1.4.0
	github.com/landlock-lsm/go-landlock v0.7.0
	github.com/rivo/tview v0.42.0
	github.com/stretchr/testify v1.11.1
	github.com/urfave/cli/v3 v3.6.2
	golang.org/x/crypto v0.48.0
	golang.org/x/sys v0.41.0
	golang.org/x/term v0.40.0
	modernc.org/sqlite v1.45.0
	modernc.org/sqlite v1.46.0
)

require (
@@ -61,7 +62,6 @@ require (
	github.com/jackc/puddle/v2 v2.2.2 // indirect
	github.com/jinzhu/inflection v1.0.0 // indirect
	github.com/kr/pretty v0.3.1 // indirect
	github.com/landlock-lsm/go-landlock v0.7.0 // indirect
	github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
	github.com/mattn/go-colorable v0.1.13 // indirect
	github.com/mattn/go-isatty v0.0.20 // indirect
@@ -118,7 +118,7 @@ require (
	gotest.tools/gotestsum v1.13.0 // indirect
	honnef.co/go/tools v0.7.0 // indirect
	kernel.org/pub/linux/libs/security/libcap/psx v1.2.77 // indirect
	modernc.org/libc v1.67.7 // indirect
	modernc.org/libc v1.68.0 // indirect
	modernc.org/mathutil v1.7.1 // indirect
	modernc.org/memory v1.11.0 // indirect
	rsc.io/markdown v0.0.0-20231214224604-88bb533a6020 // indirect
+5 −0
Original line number Diff line number Diff line
@@ -469,6 +469,7 @@ modernc.org/cc/v4 v4.27.1 h1:9W30zRlYrefrDV2JE2O8VDtJ1yPGownxciz5rrbQZis=
modernc.org/ccgo/v4 v4.28.0 h1:rjznn6WWehKq7dG4JtLRKxb52Ecv8OUGah8+Z/SfpNU=
modernc.org/ccgo/v4 v4.28.0/go.mod h1:JygV3+9AV6SmPhDasu4JgquwU81XAKLd3OKTUDNOiKE=
modernc.org/ccgo/v4 v4.30.1 h1:4r4U1J6Fhj98NKfSjnPUN7Ze2c6MnAdL0hWw6+LrJpc=
modernc.org/ccgo/v4 v4.30.2 h1:4yPaaq9dXYXZ2V8s1UgrC3KIj580l2N4ClrLwnbv2so=
modernc.org/fileutil v1.3.1 h1:8vq5fe7jdtEvoCf3Zf9Nm0Q05sH6kGx0Op2CPx1wTC8=
modernc.org/fileutil v1.3.1/go.mod h1:HxmghZSZVAz/LXcMNwZPA/DRrQZEVP9VX0V4LQGQFOc=
modernc.org/fileutil v1.3.40 h1:ZGMswMNc9JOCrcrakF1HrvmergNLAmxOPjizirpfqBA=
@@ -478,6 +479,8 @@ modernc.org/libc v1.65.8 h1:7PXRJai0TXZ8uNA3srsmYzmTyrLoHImV5QxHeni108Q=
modernc.org/libc v1.65.8/go.mod h1:011EQibzzio/VX3ygj1qGFt5kMjP0lHb0qCW5/D/pQU=
modernc.org/libc v1.67.7 h1:H+gYQw2PyidyxwxQsGTwQw6+6H+xUk+plvOKW7+d3TI=
modernc.org/libc v1.67.7/go.mod h1:UjCSJFl2sYbJbReVQeVpq/MgzlbmDM4cRHIYFelnaDk=
modernc.org/libc v1.68.0 h1:PJ5ikFOV5pwpW+VqCK1hKJuEWsonkIJhhIXyuF/91pQ=
modernc.org/libc v1.68.0/go.mod h1:NnKCYeoYgsEqnY3PgvNgAeaJnso968ygU8Z0DxjoEc0=
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI=
@@ -490,6 +493,8 @@ modernc.org/sqlite v1.37.1 h1:EgHJK/FPoqC+q2YBXg7fUmES37pCHFc97sI7zSayBEs=
modernc.org/sqlite v1.37.1/go.mod h1:XwdRtsE1MpiBcL54+MbKcaDvcuej+IYSMfLN6gSKV8g=
modernc.org/sqlite v1.45.0 h1:r51cSGzKpbptxnby+EIIz5fop4VuE4qFoVEjNvWoObs=
modernc.org/sqlite v1.45.0/go.mod h1:CzbrU2lSB1DKUusvwGz7rqEKIq+NUd8GWuBBZDs9/nA=
modernc.org/sqlite v1.46.0 h1:pCVOLuhnT8Kwd0gjzPwqgQW1KW2XFpXyJB6cCw11jRE=
modernc.org/sqlite v1.46.0/go.mod h1:CzbrU2lSB1DKUusvwGz7rqEKIq+NUd8GWuBBZDs9/nA=
modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0=
modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A=
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
+1 −0
Original line number Diff line number Diff line
@@ -462,6 +462,7 @@ func ActionChange(cmd *dclish.Command) error {
			Subject:    msg.Subject,
			Message:    msg.Message,
			ID:         msg.ID,
			Folder:     this.Folder.Name,
		})
		if err != nil {
			return err
+6 −4
Original line number Diff line number Diff line
@@ -873,12 +873,12 @@ func (q *Queries) SearchSubjectReverse(ctx context.Context, column1 sql.NullStri
}

const setMessageSeen = `-- name: SetMessageSeen :exec
INSERT INTO seen (login, folder, msgid) VALUES (?, ?, ?)
INSERT OR IGNORE INTO seen (login, folder, msgid) VALUES (?, ?, ?)
`

// SetMessageSeen mark a message as seen for a user.
//
//	INSERT INTO seen (login, folder, msgid) VALUES (?, ?, ?)
//	INSERT OR IGNORE INTO seen (login, folder, msgid) VALUES (?, ?, ?)
func (q *Queries) SetMessageSeen(ctx context.Context, login string, folder string, msgid int64) error {
	_, err := q.db.ExecContext(ctx, setMessageSeen, login, folder, msgid)
	return err
@@ -904,7 +904,7 @@ UPDATE messages SET
    system = ?,
    shutdown = ?,
    expiration = ?
  WHERE id = ?
  WHERE id = ? AND folder = ?
`

type UpdateMessageParams struct {
@@ -915,6 +915,7 @@ type UpdateMessageParams struct {
	Shutdown   int64
	Expiration time.Time
	ID         int64
	Folder     string
}

// UpdateMessage updates a message.
@@ -926,7 +927,7 @@ type UpdateMessageParams struct {
//	    system = ?,
//	    shutdown = ?,
//	    expiration = ?
//	  WHERE id = ?
//	  WHERE id = ? AND folder = ?
func (q *Queries) UpdateMessage(ctx context.Context, arg UpdateMessageParams) error {
	_, err := q.db.ExecContext(ctx, updateMessage,
		arg.Subject,
@@ -936,6 +937,7 @@ func (q *Queries) UpdateMessage(ctx context.Context, arg UpdateMessageParams) er
		arg.Shutdown,
		arg.Expiration,
		arg.ID,
		arg.Folder,
	)
	return err
}
+2 −0
Original line number Diff line number Diff line
-- SQLite does not support DROP COLUMN before 3.35; use a no-op.
SELECT 1;
Loading