changeset f081934d2365 in sao:default
details: https://hg.tryton.org/sao?cmd=changeset;node=f081934d2365
description:
        Allow sharing view searches

        We add a rule to give read access to all view searches without a user.
        We manage the delete access on client side thanks to the _delete 
attribute.
        If the user does not have the delete right, the bookmark star is 
disabled.

        issue9515
        review323751002
diffstat:

 src/common.js |  2 +-
 src/screen.js |  4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diffs (39 lines):

diff -r 9b6458a3595f -r f081934d2365 src/common.js
--- a/src/common.js     Thu Sep 24 22:56:58 2020 +0200
+++ b/src/common.js     Thu Sep 24 23:00:52 2020 +0200
@@ -525,7 +525,7 @@
                 if (this.searches[model] === undefined) {
                     this.searches[model] = [];
                 }
-                this.searches[model].push([id, name, domain]);
+                this.searches[model].push([id, name, domain, true]);
             }.bind(this));
         },
         remove: function(model, id) {
diff -r 9b6458a3595f -r f081934d2365 src/screen.js
--- a/src/screen.js     Thu Sep 24 22:56:58 2020 +0200
+++ b/src/screen.js     Thu Sep 24 23:00:52 2020 +0200
@@ -302,20 +302,22 @@
             if (current_text) {
                 var current_domain = this.screen.domain_parser.parse(
                         current_text);
-                this.but_star.prop('disabled', !current_text);
                 var star = this.get_star();
                 var bookmarks = this.bookmarks();
                 for (var i=0; i < bookmarks.length; i++) {
                     var id = bookmarks[i][0];
                     var name = bookmarks[i][1];
                     var domain = bookmarks[i][2];
+                    var access = bookmarks[i][3];
                     var text = this.screen.domain_parser.string(domain);
                     if ((text === current_text) ||
                             (Sao.common.compare(domain, current_domain))) {
                         this.set_star(true);
+                        this.but_star.prop('disabled', !access);
                         return id;
                     }
                 }
+                this.but_star.prop('disabled', !current_text);
             }
             this.set_star(false);
         },

Reply via email to