[gnome-notes/131-fail-to-create-new-owncloud-notes] providers: Fix creation of new notes



commit 017bb5d3f1a0326830209fd1175723772fd3461d
Author: Isaque Galdino <igaldino gmail com>
Date:   Fri Aug 9 19:40:43 2019 -0300

    providers: Fix creation of new notes
    
    After the change in the way we display last updated information (commits
    92257ffd and f7cc2aac), own/nextcloud notes started to mishaving not
    being able to create notes anymore but crashing.
    
    At first I thought it was related to the above change, but it was
    actually an old issue in Notes code which due to the change it was more
    visible.
    
    That is related to the note timestamp (mtime) used when creating new
    own/nextcloud or memo notes. The previous code was using g_get_real_time
    function, which is fine, but it was not converting it from miliseconds
    to seconds.
    
    This change fixes that, adding the missing conversion.

 src/libbiji/provider/biji-memo-provider.c      | 4 ++--
 src/libbiji/provider/biji-own-cloud-provider.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/libbiji/provider/biji-memo-provider.c b/src/libbiji/provider/biji-memo-provider.c
index b96ebfd..157ca29 100644
--- a/src/libbiji/provider/biji-memo-provider.c
+++ b/src/libbiji/provider/biji-memo-provider.c
@@ -556,9 +556,9 @@ memo_create_note (BijiProvider *provider,
 
   info.url = NULL;
   info.title = title;
-  info.mtime = g_get_real_time ();
+  info.mtime = g_get_real_time () / G_USEC_PER_SEC;
   info.content = title;
-  info.created = g_get_real_time ();
+  info.created = info.mtime;
 
   e_cal_client_get_default_object_sync (
     self->client, &icalcomp, NULL, NULL);
diff --git a/src/libbiji/provider/biji-own-cloud-provider.c b/src/libbiji/provider/biji-own-cloud-provider.c
index f6a0d4c..da7a72f 100644
--- a/src/libbiji/provider/biji-own-cloud-provider.c
+++ b/src/libbiji/provider/biji-own-cloud-provider.c
@@ -922,9 +922,9 @@ own_cloud_create_note (BijiProvider *provider,
   self = BIJI_OWN_CLOUD_PROVIDER (provider);
   info.url = NULL;
   info.title = NULL;
-  info.mtime = g_get_real_time ();
+  info.mtime = g_get_real_time () / G_USEC_PER_SEC;
   info.content = (gchar *) "";
-  info.created = g_get_real_time ();
+  info.created = info.mtime;
 
   return biji_own_cloud_note_new_from_info (
                   self,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]