mccrodp / message_private

The Message Private module provides a message type and associated entity reference fields, enabling sending and receiving private messages using The Message Stack.
https://www.drupal.org/project/message_private
3 stars 7 forks source link

Create Inbox in User Account tab #22

Closed NewZeal closed 7 years ago

NewZeal commented 7 years ago

There should be a tab in the User Account called 'messages' or 'private messages'. Clicking on that should display the Inbox. Inbox could have one of two formats:

  1. Display of all incoming private messages in date order
  2. Display of all private message threads in date order. A thread is defined as a message between two people. Each thread would require a separate url, something like user/%/private-messages/% .

1 above is easier to implement but is potentially shambolic

2 conforms with people's tendency to have 'conversations' and to be able to see the conversation as a thread as on other platforms such as Facebook. However there would be complications where more than one person is on the receiving end of a message.

Threads A message thread should be a new entity. A message thread is started when a conversation starts A new message thread is started when the participants change

Inbox can be implemented using Views.

mccrodp commented 7 years ago

Thanks for this and taking a closer look. I believe this is already created in views, if it's not showing, then it's just something a little off.

Please see the below routes in https://github.com/mccrodp/message_private/blob/8.x-1.x/message_private.routing.yml:

message_private.messages:
  path: '/user/{user}/messages'
  defaults:
    _title: 'Inbox'
  description: 'Message Private Inbox'
  requirements:
    _permission: 'overview messages'

message_private.messages.inbox:
  path: '/user/{user}/messages'
  defaults:
    _title: 'Inbox'
  description: 'Message Private Inbox'
  requirements:
    _permission: 'overview messages'

message_private.messages.sent:
  path: '/user/{user}/messages/sent'
  defaults:
    _title: 'Sent'
  description: 'Message Private Sent'
  requirements:
    _permission: 'overview messages'

There is a view for this in config: https://github.com/mccrodp/message_private/blob/8.x-1.x/config/optional/views.view.message_private.yml

There was even a local tasks for "Create New Message for X user": https://github.com/mccrodp/message_private/blob/8.x-1.x/src/Plugin/Derivative/DynamicLocalTasks.php

Rather than message thread, I was thinking more along the lines of "Conversations" like facebook, in particular integration with FOS Message library to invlove the wider PHP community, but alas I had no time. Please see the following and see what you think:

https://github.com/mccrodp/message_private/issues/6 https://github.com/FriendsOfSymfony/FOSMessage/issues/19

From what you're saying it seems a lot of the functionality that was working before is now broken due to either a Message or Drupal core upgrade. Best to get that working first to see what is missing then and ideally get some tests in place. Again I had made a start but ran out of time on this https://github.com/mccrodp/message_private/issues/5

Feel free to ask any other questions. Cheers

NewZeal commented 7 years ago

Ha! My bad. I see the Views now. They weren't working for me. Anyway in the new iteration of the project the inbox needs to be grouped into conversations. I've downloaded your FOS module and will look at that and compare with using a Drupal entity for thread.

mccrodp commented 7 years ago

No worries, glad you got it working. I recommend to install the FOS Message demo to see what you think: https://github.com/tgalopin/FOSMessage-demo

I thought it worked really well and would be great to involve the Symfony community and not reinvent the wheel. Thing is my solution was just a start, it is way off at the moment, so you'd have to weigh up pros / cons.

I believe getting solid 1 - 1 messages not threaded first and then long term integration with the FOS Message library if possible is the way to go, but see what you think. Thanks again.

Let me know if you want Contributor access to the Message FOS module.