mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-14 12:07:29 -06:00
[bugfix] avoid v. long notification clear query (#3007)
This commit is contained in:
parent
b789fe2bc7
commit
db803617db
2 changed files with 57 additions and 72 deletions
|
|
@ -73,7 +73,7 @@ func (suite *NotificationTestSuite) spamNotifs() {
|
|||
Read: util.Ptr(false),
|
||||
}
|
||||
|
||||
if err := suite.db.Put(context.Background(), notif); err != nil {
|
||||
if err := suite.db.PutNotification(context.Background(), notif); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
|
@ -133,9 +133,8 @@ func (suite *NotificationTestSuite) TestGetAccountNotificationsWithoutSpam() {
|
|||
func (suite *NotificationTestSuite) TestDeleteNotificationsWithSpam() {
|
||||
suite.spamNotifs()
|
||||
testAccount := suite.testAccounts["local_account_1"]
|
||||
err := suite.db.DeleteNotifications(context.Background(), nil, testAccount.ID, "")
|
||||
suite.NoError(err)
|
||||
|
||||
// Test getting notifs first.
|
||||
notifications, err := suite.db.GetAccountNotifications(
|
||||
gtscontext.SetBarebones(context.Background()),
|
||||
testAccount.ID,
|
||||
|
|
@ -145,8 +144,29 @@ func (suite *NotificationTestSuite) TestDeleteNotificationsWithSpam() {
|
|||
20,
|
||||
nil,
|
||||
)
|
||||
suite.NoError(err)
|
||||
suite.Nil(notifications)
|
||||
if err != nil {
|
||||
suite.FailNow(err.Error())
|
||||
}
|
||||
suite.Len(notifications, 20)
|
||||
|
||||
// Now delete.
|
||||
if err := suite.db.DeleteNotifications(context.Background(), nil, testAccount.ID, ""); err != nil {
|
||||
suite.FailNow(err.Error())
|
||||
}
|
||||
|
||||
// Now try getting again.
|
||||
notifications, err = suite.db.GetAccountNotifications(
|
||||
gtscontext.SetBarebones(context.Background()),
|
||||
testAccount.ID,
|
||||
id.Highest,
|
||||
id.Lowest,
|
||||
"",
|
||||
20,
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
suite.FailNow(err.Error())
|
||||
}
|
||||
suite.Empty(notifications)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue