diff --git a/models/contacts.go b/models/contacts.go index cfea6f3a1..8d35893aa 100644 --- a/models/contacts.go +++ b/models/contacts.go @@ -1080,7 +1080,7 @@ func UpdateContactModifiedOn(ctx context.Context, tx Queryer, contactIDs []Conta // UpdateContactLastSeenOn updates last seen on (and modified on) on the passed in contact func UpdateContactLastSeenOn(ctx context.Context, tx Queryer, contactID ContactID, lastSeenOn time.Time) error { - _, err := tx.ExecContext(ctx, `UPDATE contacts_contact SET last_seen_on = $2, modified_on = NOW() WHERE id = $1 AND last_seen_on IS NULL OR last_seen_on < $2`, contactID, lastSeenOn) + _, err := tx.ExecContext(ctx, `UPDATE contacts_contact SET last_seen_on = $2, modified_on = NOW() WHERE id = $1`, contactID, lastSeenOn) return err } diff --git a/models/contacts_test.go b/models/contacts_test.go index 0906a3091..aba1f53a4 100644 --- a/models/contacts_test.go +++ b/models/contacts_test.go @@ -374,14 +374,6 @@ func TestUpdateContactLastSeenAndModifiedOn(t *testing.T) { require.NoError(t, err) assert.True(t, t2.Equal(*cathy.LastSeenOn())) assert.True(t, cathy.ModifiedOn().After(t2)) - - // can't accidently overwrite a newer date - err = cathy.UpdateLastSeenOn(ctx, db, time.Date(2010, 1, 1, 12, 0, 0, 0, time.UTC)) - require.NoError(t, err) - - cathy, err = LoadContact(ctx, db, oa, CathyID) - require.NoError(t, err) - assert.True(t, t2.Equal(*cathy.LastSeenOn())) } func TestUpdateContactModifiedBy(t *testing.T) {