We could consider making chat messages nodes and we would have all the goodies that come with it. We would then have out of the box integration with Rules, eg user posts new message, etc.

Comments

giorgio79 created an issue. See original summary.

glekli’s picture

Title: Turn chat messages into nodes for out of the box integration with Rules, Views etc. » Turn chatrooms and messages into entities
Version: 7.x-2.x-dev » 8.x-1.x-dev

Thanks for the suggestion. I have started working on the D8 upgrade and I'll consider implementing entities for that.
In the meantime, everybody feel free to share your thoughts on this.

giorgio79’s picture

Another idea would be to reuse message entities and display them in a chat format. In D7 we can achieve sg similar to ChatRoom with Privatemsg with NodeJS. See it here https://www.drupal.org/project/privatemsg_nodejs You can see a video on it here https://www.youtube.com/watch?v=f8XAT1oB1eA&ab_channel=ASYNCDrupal

Now for D8, there are some seismic shifts and the message stack creators seem to be joining forces. What you could do is join up with them, and have chatroom display message entities in the chatroom format instead of doing everything on your own. Take a look at the last comments here https://www.drupal.org/node/2134735#comment-10609242

mccrodp’s picture

Hi all. Maintainer of message_private here. Myself and @dpi have been discussing and planning our vision for private messaging in D8; which ended up being a sort of Facebook Messages, Slack, Discourse hybrid, so it had some overlap with Chatrooms to a degree.

Unfortunately it doesn't look like myself or @dpi had the time necessary to make this a reality due to the current state of other contrib modules, nodejs expertise, etc., so it was parked for the time being. Would be interested in chatting via IRC or email with Chatroom maintainers about prospects, so ping me if interested :)

glekli’s picture

Thanks for reaching out. I'm not too familiar with message_private's architecture. Could you please briefly describe what would be the potential benefits of relying on it?

My concerns at this point are the following:

- message_private has 9 dependencies. Making Chatroom dependent on it would bring the number of dependencies up to 11. This seems like a drastic jump from the current 1, unless it's justified with benefits.

- It does not seem like message_private or message are actively being ported to D8. Adding dependency on them would delay Chatroom's D8 upgrade. Practically, we wouldn't be able to start Chatroom D8 until the dependencies have made a fair about of progress.

dpi’s picture

Relying on message stack is not intended; chat messages as Drupal entities are the goal, per this issue.

An inline AJAX live chatroom style user interface ("Facebook Messages, Slack"... is what we are looking to achieve.

Anonymous’s picture

i agree with #5 and #6, let's keep this issue scoped to porting the data storage to entities.

dpi, re. "An inline AJAX live chatroom style user interface ("Facebook Messages, Slack"... is what we are looking to achieve." - for D8 or D7? the chatroom interface is themable as is, so i'm interested in blockers to achieving your goals.

mccrodp’s picture

Yes, I agree too. We found integrating with the Message Stack may be a blocker anyway (no current release) and may not even provide that many benefits that D8 already does out of the box via implementing custom entities.

Was just notified due to the mention above, so just checking where the overlap is between Chat room v.s. traditional Private Messaging v.s. more modern Private Messaging like Facebook Messages. The latter seems to have some similar functionality, so trying to figure out if Chat Room will take care of private messaging in D8 to avoid effort duplication.

I guess I need to install and test the D7 version also for starters as I have no experience with it yet :) Just wanted to highlight discussions already made on this topic and get your thoughts.

dpi’s picture

Re: #7 Not saying that we can or cannot achieve this already.

Lets keep our project collaborations in a different issue / IRC.

Anonymous’s picture

re. #8 - the main thing chatroom needs for 'facebook style' messaging is a nicer UI.

from a plumbing (data and realtime connections) perspective, the pieces are already there.

mccrodp’s picture

That sounds awesome @beejeebus. That's what I wanted to hear :) Going to look into Chat Room module more, then get back to you on another issue / IRC if I see anything I can help out with. Apologies for off topic.

Anonymous’s picture

Component: User interface » Code
Assigned: Unassigned »

hacking on this today.

  • beejeebus committed 814d49a on 8.x-1.x
    #2630490: first rough code. Installs, but not much else works.
    
Anonymous’s picture

pushed some rough code to 8.x-1.x. it installs, but not much else. i'll keep pushing to others can play along at home.

glekli’s picture

Adding some progress report. I have made the following updates:

- Added fields for 'view roles' and 'post roles' to the entity.
- Built the entity form to add and edit chatrooms (/chatroom/add, /chatroom/[cid]/edit)
- Started updating the view page (/chatroom/[cid]). Some parts are still missing in the chat window.
- Started moving stuff from the old chatroom class to the new entity class.
- Started moving themes to twig files.

glekli’s picture

Status: Active » Fixed

Entities are in place now, so I think we can consider this a done deal. This enhancement involves the following:

#1. Chatrooms and chatroom messages are now entities.

#2. Chatroom CRUD operations can be performed at the standard entity paths - In brief, those are /chatroom/(add|%cid(/edit|/delete)?)

#3. The custom field formatter will be gone, and the old functionality (chatrooms embedded in nodes) will be achievable by adding an entity reference to nodes.

#4. I don't think we need CRUD forms for chatroom messages. Those will be handled in the context of a chatroom because they are meaningless outside of a chatroom.

#5. Although access is mostly controlled by standard entity access control, we can retain the functionality to select certain roles that have read/write access to individual chatrooms. At this point, I'm uncertain if this feature could conflict with other access control functionality.

#6. Some custom chatroom hooks are gone, and replaced by standard entity hooks.

Please reopen if there is any concern regarding the changes.

Anonymous’s picture

yay! nice work Gergely :-)

giorgio79’s picture

Nice :)

Re #7 so chat messages as message entities are postponed for now and shall be discussed in a different issue? Eg facebook like chat or chatroom could be themes for displaying message entities...

PS

#5 concern for too many dependencies
I noticed installing nodejs had hundreds of dependencies, and installing that module already requires someone technical. Drush can easily download all the dependencies automatically, so I do not see any issues with the number of additional dependencies a message integration would bring.

Anonymous’s picture

i've created #2640462: Facebook/Google chat style chat interface - giorgio79, please continue the discussion about a nice UI over there.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.