Fix notification query
This commit is contained in:
parent
ebd4511d24
commit
612d8918ea
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue