nodebb-plugin-global-chat



  • 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.


  • Gamers

    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.


  • Global Moderator

    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 nodebb-plugin-global-chat@1.1.0

    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);   
        },
    

  • Global Moderator

    @JJSagan yeah you're right. It might actually be broken on redis. Should probably be getObjectField actually.



  • This post is deleted!

  • Global Moderator

    Released nodebb-plugin-global-chat@1.1.1

    Changes:

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

    Thanks @JJSagan



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


 

Suggested Topics

  • 5
  • 1
  • 3
  • 17
  • 13
| |