Fix notification query

This commit is contained in:
Andrea Maria Piana 2021-12-10 14:34:16 +00:00
parent ebd4511d24
commit 612d8918ea
3 changed files with 12 additions and 2 deletions

View File

@ -1 +1 @@
0.92.3
0.92.4

View File

@ -298,7 +298,7 @@ func (db sqlitePersistence) GetToProcessActivityCenterNotificationIds() ([][]byt
}
func (db sqlitePersistence) HasPendingNotificationsForChat(chatID string) (bool, error) {
rows, err := db.db.Query("SELECT 1 FROM activity_center_notifications a WHERE a.chat_id = ? NOT a.dismissed AND NOT a.accepted", chatID)
rows, err := db.db.Query("SELECT 1 FROM activity_center_notifications a WHERE a.chat_id = ? AND NOT a.dismissed AND NOT a.accepted", chatID)
if err != nil {
return false, err
}

View File

@ -1303,3 +1303,13 @@ func TestSaveCommunityChat(t *testing.T) {
require.NoError(t, err)
require.Equal(t, chat, retrievedChat)
}
func TestHasPendingNotificationsForChatSanityCheck(t *testing.T) {
db, err := openTestDB()
require.NoError(t, err)
p := NewSQLitePersistence(db)
result, err := p.HasPendingNotificationsForChat("test-chat-id")
require.NoError(t, err)
require.False(t, result)
}