17

Unless I'm missing something, to grant write access to a private chat room currently requires that a room owner click on the Room drop down, select "control access" and search or copy/paste the user's name or ID, and then finally another click to change their access.

Would it be possible to add this function to the pop-up that appears when you click on someone's avatar:

enter image description here

Basicaly, it would be convenient for room owners to also have "grant write access" and "revoke write access" options in this pop-up listed under Actions.

I realize this isn't a huge deal, so maybe it's not a very big priority, but it would certainly be nice, I think, and would save a lot of time for room owners.

0

2 Answers 2

9
+50

I've added this to Porkchat:

enter image description here

It is very basic, for example it does not change function or text if the user already has write permissions, however the times I've wanted to revoke write permissions are zero. It should suffice for the use-case of simply letting users chat in private rooms.

0
3

I have also made a userscript for this. I've added this feature to my SOX (Stack Overflow Extras) userscript in v1.0.3 (in the DEV branch currently).

Here's how it looks:

enter image description here

You can give users read or write access, or remove their read/write privileges by clicking 'no'.

You can install SOX easily by following the above link, and you can also enable a bunch of other useful optional features from the control panel :)


If you just want this as a separate userscript, here's the code:

// ==UserScript==
// @name         Chat Access Adder
// @namespace    http://stackexchange.com/users/4337810/
// @version      1.0
// @description  A userscript that allows you to easily change user permissions in chat :)
// @author       ᔕᖺᘎᕊ (http://stackexchange.com/users/4337810/)
// @match        *://chat.stackoverfow.com/*
// @match        *://chat.meta.stackexchange.com/*
// @match        *://chat.stackexchange.com/*
// @grant        none
// ==/UserScript==

new MutationObserver(function( mutations ) {
    mutations.forEach(function( mutation ) {
        var newNodes = mutation.addedNodes;
        if(newNodes !== null) {
            var $nodes = $(newNodes);
            $nodes.each(function() {
                var $node = $( this );
                if($node.hasClass("user-popup")) {
                    setTimeout(function() {
                        var id = $node.find('a')[0].href.split('/')[4];
                        if($('.chatEasyAccess').length) {
                            $('.chatEasyAccess').remove();
                        }
                        $node.find('div:last-child').after('<div class="chatEasyAccess">give <b id="read-only">read</b> / <b id="read-write">write</b> / <b id="remove">no</b> access</div>');
                        $(document).on('click', '.chatEasyAccess b', function() {
                            $that = $(this);
                            $.ajax({
                                url: 'http://chat.stackexchange.com/rooms/setuseraccess/'+location.href.split('/')[4],
                                type: 'post',
                                data: {
                                    'fkey': fkey().fkey,
                                    'userAccess': $that.attr('id'),
                                    'aclUserId': id
                                },
                                success: function(d) {
                                    if(d=='') {
                                        alert('Successfully changed user access');
                                    } else {
                                        alert(d);
                                    }
                                }
                            });
                        });
                    }, 1000);
                }
            });
        }
    });    
}).observe(document.getElementById('chat-body'), {
    childList: true,
    attributes: true
});
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .