Merge branch 'master' of stigma.nowoczesnapolska.org.pl:platforma
[redakcja.git] / apps / api / handlers / library_handlers.py
index be504e9..f7d5784 100644 (file)
@@ -261,8 +261,8 @@ class DocumentHandler(BaseHandler):
             # 'dc_url': reverse('docdc_view', args=[doc.id]),
             'gallery_url': reverse('docgallery_view', args=[doc.id]),
             'merge_url': reverse('docmerge_view', args=[doc.id]),
             # 'dc_url': reverse('docdc_view', args=[doc.id]),
             'gallery_url': reverse('docgallery_view', args=[doc.id]),
             'merge_url': reverse('docmerge_view', args=[doc.id]),
-            'user_revision': doc.revision,
-            'user_timestamp': doc.revision.timestamp,
+            'revision': doc.revision,
+            'timestamp': doc.revision.timestamp,
             # 'public_revision': doc.revision,
             # 'public_timestamp': doc.revision.timestamp,
         }   
             # 'public_revision': doc.revision,
             # 'public_timestamp': doc.revision.timestamp,
         }   
@@ -628,6 +628,8 @@ class MergeHandler(BaseHandler):
             # update user document
             if changed:
                 user_doc_new = user_doc.latest()
             # update user document
             if changed:
                 user_doc_new = user_doc.latest()
+            else:
+                user_doc_new = user_doc
                 
             # shared document is the same
             doc_new = doc
                 
             # shared document is the same
             doc_new = doc
@@ -680,6 +682,8 @@ class MergeHandler(BaseHandler):
             # update shared version if needed
             if changed:
                 doc_new = doc.latest()
             # update shared version if needed
             if changed:
                 doc_new = doc.latest()
+            else:
+                doc_new = doc
 
             # the user wersion is the same
             user_doc_new = base_doc
 
             # the user wersion is the same
             user_doc_new = base_doc
@@ -691,9 +695,16 @@ class MergeHandler(BaseHandler):
         return response.SuccessAllOk().django_response({
             "name": user_doc_new.id,
             "user": user_doc_new.owner,
         return response.SuccessAllOk().django_response({
             "name": user_doc_new.id,
             "user": user_doc_new.owner,
-            "parent_revision": user_doc_new.revision,
-            "parent_shared_revision": doc.revision,
+
             "revision": user_doc_new.revision,
             "revision": user_doc_new.revision,
-            "shared_revision": doc_new.revision,
             'timestamp': user_doc_new.revision.timestamp,
             'timestamp': user_doc_new.revision.timestamp,
+
+            "parent_revision": user_doc_new.revision,
+            "parent_timestamp": user_doc_new.revision.timestamp,
+
+            "shared_revision": doc_new.revision,
+            "shared_timestamp": doc_new.revision.timestamp,
+
+            "shared_parent_revision": doc.revision,
+            "shared_parent_timestamp": doc.revision.timestamp,
         })
\ No newline at end of file
         })
\ No newline at end of file