diff options
author | Mario <mario@mariovavti.com> | 2020-11-05 08:46:42 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2020-11-05 08:46:42 +0000 |
commit | bafbf0416462c6f18c3fb6c8c06a063c8d6fdae6 (patch) | |
tree | 8929845be585b09d0f420621281c5531e1efad3e /view/js/acl.js | |
parent | 6f93d9848c43019d43ea76c27d42d657ba031cd7 (diff) | |
parent | fdefa101d84dc2a9424eaedbdb003a4c30ec5d01 (diff) | |
download | volse-hubzilla-bafbf0416462c6f18c3fb6c8c06a063c8d6fdae6.tar.gz volse-hubzilla-bafbf0416462c6f18c3fb6c8c06a063c8d6fdae6.tar.bz2 volse-hubzilla-bafbf0416462c6f18c3fb6c8c06a063c8d6fdae6.zip |
Merge branch '5.0RC'5.0
Diffstat (limited to 'view/js/acl.js')
-rw-r--r-- | view/js/acl.js | 74 |
1 files changed, 67 insertions, 7 deletions
diff --git a/view/js/acl.js b/view/js/acl.js index 9415113dd..4597184ea 100644 --- a/view/js/acl.js +++ b/view/js/acl.js @@ -12,8 +12,13 @@ function ACL(backend_url) { that.deny_cid = []; that.deny_gid = []; - that.group_uids = []; - that.group_ids = []; + that.group_uids = {}; + that.group_ids = {}; + that.contact_uids = {}; + that.contact_ids = {}; + + that.bang = ''; + that.selected_id = ''; that.info = $("#acl-info"); @@ -78,6 +83,8 @@ ACL.prototype.get_form_data = function(event) { that.deny_cid = (that.form_id.data('deny_cid') || []); that.deny_gid = (that.form_id.data('deny_gid') || []); + that.bang = (that.form_id.data('bang') || ''); + that.update_view(); that.on_submit(); @@ -147,15 +154,31 @@ ACL.prototype.on_showall = function(event) { }; ACL.prototype.on_showgroup = function(event) { - var xid = that.acl_select.children(":selected").val(); + + var xid = that.acl_select.val(); + var cid = ''; + + if(xid.length && xid.substr(0,1) == '^') { + cid = xid.slice(1); + xid = ''; + } // preventDefault() isn't called here as we want state changes from update_view() to be applied to the radiobutton event.stopPropagation(); - that.allow_cid = []; - that.allow_gid = [xid]; - that.deny_cid = []; - that.deny_gid = []; + if (xid.length) { + that.allow_cid = []; + that.allow_gid = [xid]; + that.deny_cid = []; + that.deny_gid = []; + + } + else { + that.allow_cid = [cid]; + that.allow_gid = []; + that.deny_cid = []; + that.deny_gid = []; + } that.update_view(); that.on_submit(); @@ -307,8 +330,26 @@ ACL.prototype.update_view = function(value) { $('#dbtn-jotnets').hide(); $('.profile-jot-net input').attr('disabled', 'disabled'); } + else if (that.allow_gid.length === 0 && that.allow_cid.length === 1 && that.deny_gid.length === 0 && that.deny_cid.length === 0 && value !== 'custom') { + + if(that.bang && that.bang !== that.allow_cid[0]) { + that.update_view('custom'); + return; + } + + that.list.hide(); //hide acl-list + that.info.hide(); //show acl-info + that.selected_id = that.contact_ids[that.allow_cid[0]]; + that.update_select('\\^' + that.selected_id); + + /* jot acl */ + $('#jot-perms-icon, #dialog-perms-icon, #' + that.form_id[0].id + ' .jot-perms-icon').removeClass('fa-unlock').addClass('fa-lock'); + $('#dbtn-jotnets').hide(); + $('.profile-jot-net input').attr('disabled', 'disabled'); + } else { + that.list.show(); //show acl-list datasrc2src('#acl-list-content .list-group-item img[data-src]'); that.info.hide(); //hide acl-info @@ -382,6 +423,21 @@ ACL.prototype.update_view = function(value) { bthide.removeClass("btn-outline-danger").addClass("btn-danger"); $(this).removeClass("groupshow"); } + $(that.contact_uids[id]).each(function(i, v) { + if(uclass == "grouphide") + // we need attr selection here because the id can include an @ (diaspora/friendica xchans) + $('[id="g' + v + '"]').removeClass("groupshow"); + if(uclass !== "") { + var cls = $('[id="g' + v + '"]').attr('class'); + if( cls === undefined) + return true; + var hiding = cls.indexOf('grouphide'); + if(hiding == -1) + $('[id="g' + v + '"]').addClass(uclass); + } + }); + break; + } }); } @@ -415,9 +471,13 @@ ACL.prototype.populate = function(data) { that.group_uids[this.xid] = this.uids; that.group_ids[this.xid] = this.id; } + else { + that.contact_ids[this.xid] = this.id; + } if (this.self === 'abook-self') { that.self[0] = this.xid; } + that.list_content.append(html); }); }; |