Commit 068cd9ce authored by Benjamin REIS's avatar Benjamin REIS

do not fetch device event in chat room history

parent c444c4c5
......@@ -324,11 +324,11 @@ list<shared_ptr<EventLog>> ChatRoom::getMessageHistoryRange (int begin, int end)
}
list<shared_ptr<EventLog>> ChatRoom::getHistory (int nLast) const {
return getCore()->getPrivate()->mainDb->getHistory(getChatRoomId(), nLast);
return getCore()->getPrivate()->mainDb->getHistory(getChatRoomId(), nLast, MainDb::Filter::ConferenceInfoNoDeviceFilter);
}
list<shared_ptr<EventLog>> ChatRoom::getHistoryRange (int begin, int end) const {
return getCore()->getPrivate()->mainDb->getHistoryRange(getChatRoomId(), begin, end);
return getCore()->getPrivate()->mainDb->getHistoryRange(getChatRoomId(), begin, end, MainDb::Filter::ConferenceInfoNoDeviceFilter);
}
int ChatRoom::getHistorySize () const {
......
......@@ -220,7 +220,8 @@ static constexpr const char *mapEnumToSql (const EnumToSql<T> enumToSql[], size_
static constexpr EnumToSql<MainDb::Filter> eventFilterToSql[] = {
{ MainDb::ConferenceCallFilter, "3, 4" },
{ MainDb::ConferenceChatMessageFilter, "5" },
{ MainDb::ConferenceInfoFilter, "1, 2, 6, 7, 8, 9, 10, 11, 12" }
{ MainDb::ConferenceInfoFilter, "1, 2, 6, 7, 8, 9, 10, 11, 12" },
{ MainDb::ConferenceInfoNoDeviceFilter, "1, 2, 6, 7, 8, 9, 12" }
};
static constexpr const char *mapEventFilterToSql (MainDb::Filter filter) {
......@@ -1958,7 +1959,7 @@ bool MainDb::deleteEvent (const shared_ptr<const EventLog> &eventLog) {
int MainDb::getEventCount (FilterMask mask) const {
string query = "SELECT COUNT(*) FROM event" +
buildSqlEventFilter({ ConferenceCallFilter, ConferenceChatMessageFilter, ConferenceInfoFilter }, mask);
buildSqlEventFilter({ ConferenceCallFilter, ConferenceChatMessageFilter, ConferenceInfoFilter, ConferenceInfoNoDeviceFilter }, mask);
DurationLogger durationLogger(
"Get events count with mask=" + Utils::toString(mask) + "."
......@@ -2364,7 +2365,7 @@ list<shared_ptr<EventLog>> MainDb::getHistoryRange (
" SELECT event_id FROM conference_event WHERE chat_room_id = :chatRoomId"
" )";
query += buildSqlEventFilter({
ConferenceCallFilter, ConferenceChatMessageFilter, ConferenceInfoFilter
ConferenceCallFilter, ConferenceChatMessageFilter, ConferenceInfoFilter, ConferenceInfoNoDeviceFilter
}, mask, "AND");
query += " ORDER BY creation_time DESC";
......@@ -2416,7 +2417,7 @@ int MainDb::getHistorySize (const ChatRoomId &chatRoomId, FilterMask mask) const
const string query = "SELECT COUNT(*) FROM event, conference_event"
" WHERE chat_room_id = :chatRoomId"
" AND event_id = event.id" + buildSqlEventFilter({
ConferenceCallFilter, ConferenceChatMessageFilter, ConferenceInfoFilter
ConferenceCallFilter, ConferenceChatMessageFilter, ConferenceInfoFilter, ConferenceInfoNoDeviceFilter
}, mask, "AND");
return L_SAFE_TRANSACTION {
......@@ -2436,7 +2437,7 @@ int MainDb::getHistorySize (const ChatRoomId &chatRoomId, FilterMask mask) const
void MainDb::cleanHistory (const ChatRoomId &chatRoomId, FilterMask mask) {
const string query = "SELECT event_id FROM conference_event WHERE chat_room_id = :chatRoomId" +
buildSqlEventFilter({
ConferenceCallFilter, ConferenceChatMessageFilter, ConferenceInfoFilter
ConferenceCallFilter, ConferenceChatMessageFilter, ConferenceInfoFilter, ConferenceInfoNoDeviceFilter
}, mask);
DurationLogger durationLogger(
......
......@@ -50,7 +50,8 @@ public:
NoFilter = 0x0,
ConferenceCallFilter = 0x1,
ConferenceChatMessageFilter = 0x2,
ConferenceInfoFilter = 0x4
ConferenceInfoFilter = 0x4,
ConferenceInfoNoDeviceFilter = 0x6
};
typedef EnumMask<Filter> FilterMask;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment