Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[buteo-sync-plugins-social] Disable updating last modified time on ev…
…ent save. Contributes to JB#53475

Previously, the backend would automatically update the last modified
time for an event when the event was saved.  Sync plugins (which
save updates to events due to server-side changes) should avoid this.

Recently, API was added to the backend calendar API to allow this
behaviour to be disabled by sync plugins.  This commit takes this
API into use, and removes the old work-arounds.
  • Loading branch information
chriadam committed Mar 18, 2021
1 parent e0d5a9b commit c8e8544
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion rpm/buteo-sync-plugins-social.spec
Expand Up @@ -21,7 +21,7 @@ BuildRequires: pkgconfig(libsailfishkeyprovider)
BuildRequires: pkgconfig(contactcache-qt5)
BuildRequires: pkgconfig(qtcontacts-sqlite-qt5-extensions) >= 0.3.0
BuildRequires: pkgconfig(libmkcal-qt5) >= 0.5.9
BuildRequires: pkgconfig(KF5CalendarCore)
BuildRequires: pkgconfig(KF5CalendarCore) >= 5.79
BuildRequires: nemo-qml-plugin-notifications-qt5-devel
Requires: buteo-syncfw-qt5-msyncd
Requires: systemd
Expand Down
8 changes: 1 addition & 7 deletions src/google/google-calendars/googlecalendarsyncadaptor.cpp
Expand Up @@ -942,8 +942,6 @@ QString getErrorReason(const QByteArray &replyData)

KCalendarCore::Event::Ptr dissociateSingleOccurrence(const KCalendarCore::Event::Ptr &event, const QDateTime &dateTime)
{
const QDateTime modified = event->lastModified();

// Create a new incidence
KCalendarCore::Event::Ptr newEvent = KCalendarCore::Event::Ptr(event->clone());
newEvent->setCreated(QDateTime::currentDateTimeUtc());
Expand Down Expand Up @@ -974,9 +972,6 @@ KCalendarCore::Event::Ptr dissociateSingleOccurrence(const KCalendarCore::Event:
recId.time().second()));
newEvent->setRecurrenceId(recId);

// Don't update the modification date of the parent
event->setLastModified(modified);

return newEvent;
}

Expand All @@ -990,6 +985,7 @@ GoogleCalendarSyncAdaptor::GoogleCalendarSyncAdaptor(QObject *parent)
, m_storage(mKCal::ExtendedCalendar::defaultStorage(m_calendar))
, m_storageNeedsSave(false)
{
m_calendar->setUpdateLastModifiedOnChange(false);
setInitialActive(true);
}

Expand Down Expand Up @@ -3115,14 +3111,12 @@ void GoogleCalendarSyncAdaptor::applySyncFailureFlag(KCalendarCore::Event::Ptr e

if (current != updated) {
SOCIALD_LOG_DEBUG("Changing flag from" << current << "to" << updated << "for" << event->uid());
const QDateTime lastModified = event->lastModified();
if (!updated.isEmpty()) {
event->setCustomProperty(VOLATILE_APP, VOLATILE_NAME, updated);

} else {
event->removeCustomProperty(VOLATILE_APP, VOLATILE_NAME);
}
event->setLastModified(lastModified);
m_storageNeedsSave = true;
}
}
Expand Down

0 comments on commit c8e8544

Please sign in to comment.