[gnome-documents/wip/rishi/init-getting-started: 8/9] documents, query: Use the standard dialect of String.prototype.replace



commit 85d3bfcadb06b473b73032a77713927162d25843
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Dec 14 14:25:31 2017 +0100

    documents, query: Use the standard dialect of String.prototype.replace
    
    The Gecko-specific dialect doesn't work with GJS 1.50.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=791613

 src/documents.js |    2 +-
 src/query.js     |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index 6d8a1f5..a4a580f 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -279,7 +279,7 @@ const DocCommon = new Lang.Class({
     },
 
     _sanitizeTitle: function() {
-        this.name = this.name.replace('Microsoft Word - ', '', 'g');
+        this.name = this.name.replace(/Microsoft Word - /g, '');
     },
 
     populateFromCursor: function(cursor) {
diff --git a/src/query.js b/src/query.js
index 744527b..141b8de 100644
--- a/src/query.js
+++ b/src/query.js
@@ -199,7 +199,7 @@ var QueryBuilder = new Lang.Class({
 
     buildSingleQuery: function(flags, resource) {
         let sparql = this._buildQueryInternal(false, flags, null);
-        sparql = sparql.replace('?urn', '<' + resource + '>', 'g');
+        sparql = sparql.replace(/\?urn/g, '<' + resource + '>');
 
         return this._createQuery(sparql);
     },
@@ -223,7 +223,7 @@ var QueryBuilder = new Lang.Class({
              'tracker:coalesce(nfo:fileLastModified(?urn), nie:contentLastModified(?urn)) AS ?mtime ' +
              'WHERE { ?urn nie:isPartOf ?collUrn } ' +
              'ORDER BY DESC (?mtime)' +
-             'LIMIT 4').replace('?collUrn', '<' + resource + '>');
+             'LIMIT 4').replace(/\?collUrn/, '<' + resource + '>');
 
         return this._createQuery(sparql);
     },
@@ -234,7 +234,7 @@ var QueryBuilder = new Lang.Class({
             ('SELECT ' +
              '?urn ' +
              'WHERE { ?urn a nfo:DataContainer . ?docUrn nie:isPartOf ?urn }'
-            ).replace('?docUrn', '<' + resource + '>');
+            ).replace(/\?docUrn/, '<' + resource + '>');
 
         return this._createQuery(sparql);
     },


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