nodebb-plugin-global-chat

Technical Support
  • Hi Devs,

    Had some time to play around with nodebb-plugin-global-chat, great plugin!

    Allow me to recommend two minor changes, as follows:

    1. In the client script, the reference to elem should be:
    var elem = $(e.target).parent();
    
    1. Displaying all users on the chat header takes a lot of space. How about displaying just the group name? See below css only change:
    $('head').append(
    			'<style type="text/css">' +
    			'[data-roomid="' + roomId + '"] [component="chat/header"] span.members' +
    			'{   visibility: hidden;' +
    			'    font-size: 0;' +
    			'}' +
    			'[data-roomid="' + roomId + '"] [component="chat/header"] span.members:after ' +
    			'{   content: "Global Chat"; ' +
    			'    font-size: 14px;' +
    			'    visibility: visible;' +
    			'    display: block;' +
    			'    position: absolute;' +
    			'    margin-top: -20px;' +
    			'}</style>');
    

    Two questions if I may:

    1. Is there an api to change the group chat slug? for example post a picture?
    2. After uninstall, the global-chat group was not deleted. This was previously discussed here: https://github.com/NodeBB/nodebb-plugin-global-chat/issues/1. Per said thread on mongo one may do the following:
    db.getCollection('objects').remove({_key: /chat:room:387:mids$/}) 
    db.getCollection('objects').remove({_key: /chat:rooms:unread$/, value: "387"}); 
    db.getCollection('objects').remove({_key: "chat:room:387:uids"}); 
    db.getCollection('objects').remove({_key: /chat:rooms$/, value: "387"});
    

    Can you please point me in the right direction on how to write a similar code for the global-chat plugin?

    Thank you!
    JJ.

  • happy to see you are working on this plugin, it is indeed a great plugin.

  • As for (2):

    I can get all uids from the room, and then issue:

    Messaging.leaveRoom(uids, roomId, callback).
    

    Would that be an acceptable solution? if the last user is removed from the room, would the room be automatically erased - so that the database won't be messed up?

    Thank you!
    JJ.

  • In the client script, the reference to elem should be

    It should probably be currentTarget instead of target, though I didn't ever see an issue with how it was.

    Displaying all users on the chat header takes a lot of space. How about displaying just the group name? See below css only change

    Thanks, I've fixed it with this CSS, inspired by yours:

    [data-roomid="${roomId}"] [component="chat/header"] .members {
      display: none;
    }
    [data-roomid="${roomId}"] [component="chat/header"]::before {
      content: "Chat with everyone";
      font-weight: 500;
    }
    

    Released [email protected]

    Changes:

    • "Chat with everyone" instead of a list of every user
    • Ability to delete the chatroom
  • Thank you @PitaJ ,
    IMHO, in init, get should be replaced with getObject, as in the below.
    Other than that, the plugin is perfect 😉
    JJ.

    waterfall([
        next => get(roomKey, next),
        (roomIdVal, next) => {
          oldRoomId = roomIdVal;
          //get(`chat:room:${roomIdVal}`, next);
          getObject(`chat:room:${roomIdVal}`, next);   
        },
    
  • @JJSagan yeah you're right. It might actually be broken on redis. Should probably be getObjectField actually.

  • This post is deleted!
  • Released [email protected]

    Changes:

    • Use the correct DB method (should work correctly on redis now)

    Thanks @JJSagan

  • It was my pleasure @PitaJ , thanks for considering my comments.

  • @PitaJ @arranka

    Hi @all

    I still have the problem of the user display bug if there are too many members despite the plugin update.

    ISSUE HERE: https://github.com/NodeBB/nodebb-plugin-global-chat/issues/6

    I have hidden the list of users with the CSS code ACP:

    .chats-full [component="chat/header"] .members {
            display: none;
        }
    
     .chats-full [component="chat/header"]::before {
            content: "-- Tchatter avec tout les membres --";
            font-weight: 500;
        }
    

    The problem is that this code hides users for all discussions and not just the Global Chat
    How to do this ? Or declare ROOMID on CSS/ACP

    Another question:

    How to rename the name of the salon?

    thanks for considering my comments.


Suggested Topics