[gnome-documents/wip/rishi/onedrive-lo: 1/10] documents: Use a global named constant for the OneDrive prefix



commit 49831f3bd49d0b67d749ebb79b31be3ba4cedf66
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Mar 29 15:29:58 2017 +0200

    documents: Use a global named constant for the OneDrive prefix
    
    https://bugzilla.gnome.org/show_bug.cgi?id=780718

 src/documents.js |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index cb56c70..2f54a22 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -1059,6 +1059,8 @@ const OwncloudDocument = new Lang.Class({
     }
 });
 
+const SKYDRIVE_PREFIX = 'windows-live:skydrive:';
+
 const SkydriveDocument = new Lang.Class({
     Name: 'SkydriveDocument',
     Extends: DocCommon,
@@ -1078,9 +1080,7 @@ const SkydriveDocument = new Lang.Class({
 
         let authorizer = new Zpj.GoaAuthorizer({ goa_object: source.object });
         let service = new Zpj.Skydrive({ authorizer: authorizer });
-
-        const zpj_prefix = "windows-live:skydrive:";
-        let zpj_id = this.identifier.substring(zpj_prefix.length);
+        let zpj_id = this.identifier.substring(SKYDRIVE_PREFIX.length);
 
         service.query_info_from_id_async
             (zpj_id, cancellable,
@@ -1231,7 +1231,7 @@ const DocumentManager = new Lang.Class({
 
     _identifierIsSkydrive: function(identifier) {
         return (identifier &&
-                (identifier.indexOf('windows-live:skydrive:') != -1));
+                (identifier.indexOf(SKYDRIVE_PREFIX) != -1));
     },
 
     createDocumentFromCursor: function(cursor) {


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