Skip to content

Commit

Permalink
Fix review comments.
Browse files Browse the repository at this point in the history
Signed-off-by: alex-z <[email protected]>
  • Loading branch information
allexzander committed Jul 17, 2023
1 parent 219275e commit db76f74
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 26 deletions.
35 changes: 13 additions & 22 deletions src/gui/tray/activitylistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,6 @@ void ActivityListModel::startFetchJob()

void ActivityListModel::setFinalList(const ActivityList &finalList)
{
QMutexLocker locker(&_finalListMutex);
_finalList = finalList;

emit allConflictsChanged();
Expand Down Expand Up @@ -669,17 +668,14 @@ void ActivityListModel::removeActivityFromActivityList(const Activity &activity)
qCInfo(lcActivity) << "Activity/Notification/Error successfully dismissed: " << activity._subject;
qCInfo(lcActivity) << "Trying to remove Activity/Notification/Error from view... ";

{
QMutexLocker locker(&_finalListMutex);
const auto index = _finalList.indexOf(activity);
if (index != -1) {
qCInfo(lcActivity) << "Activity/Notification/Error successfully removed from the list.";
qCInfo(lcActivity) << "Updating Activity/Notification/Error view.";

beginRemoveRows({}, index, index);
_finalList.removeAt(index);
endRemoveRows();
}
const auto index = _finalList.indexOf(activity);
if (index != -1) {
qCInfo(lcActivity) << "Activity/Notification/Error successfully removed from the list.";
qCInfo(lcActivity) << "Updating Activity/Notification/Error view.";

beginRemoveRows({}, index, index);
_finalList.removeAt(index);
endRemoveRows();
}

if (activity._type != Activity::ActivityType &&
Expand All @@ -696,14 +692,12 @@ void ActivityListModel::removeActivityFromActivityList(const Activity &activity)
void ActivityListModel::checkAndRemoveSeenActivities(const OCC::ActivityList &newActivities)
{
ActivityList activitiesToRemove;
{
QMutexLocker locker(&_finalListMutex);
for (const auto &activity : _finalList) {
if (activity._objectType == QStringLiteral("chat") && !newActivities.contains(activity)) {
activitiesToRemove.push_back(activity);
}
for (const auto &activity : _finalList) {
if (activity._objectType == QStringLiteral("chat") && !newActivities.contains(activity)) {
activitiesToRemove.push_back(activity);
}
}

for (const auto &toRemove : activitiesToRemove) {
removeActivityFromActivityList(toRemove);
}
Expand Down Expand Up @@ -960,10 +954,7 @@ void ActivityListModel::slotRefreshActivityInitial()

void ActivityListModel::slotRemoveAccount()
{
{
QMutexLocker locker(&_finalListMutex);
_finalList.clear();
}
_finalList.clear();
_activityLists.clear();
_presentedActivities.clear();
setAndRefreshCurrentlyFetching(false);
Expand Down
1 change: 0 additions & 1 deletion src/gui/tray/activitylistmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ private slots:
ActivityList _listOfIgnoredFiles;
ActivityList _notificationErrorsLists;
ActivityList _finalList;
QMutex _finalListMutex;

QSet<qint64> _presentedActivities;

Expand Down
2 changes: 0 additions & 2 deletions src/gui/tray/usermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ void User::slotBuildNotificationDisplay(const ActivityList &list)

void User::slotNotificationFetchFinished()
{
QMutexLocker locker(&_isNotificationFetchRunningMutex);
_isNotificationFetchRunning = false;
}

Expand Down Expand Up @@ -451,7 +450,6 @@ void User::slotRefreshNotifications()
// start a server notification handler if no notification requests
// are running
if (_notificationRequestsRunning == 0) {
QMutexLocker locker(&_isNotificationFetchRunningMutex);
if (_isNotificationFetchRunning) {
qCDebug(lcActivity) << "Notification fetch is already running.";
return;
Expand Down
1 change: 0 additions & 1 deletion src/gui/tray/usermodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ private slots:

int _lastChatNotificationsReceivedCount = 0;

QMutex _isNotificationFetchRunningMutex;
bool _isNotificationFetchRunning = false;
};

Expand Down

0 comments on commit db76f74

Please sign in to comment.