kendraio / kendra_hub

Kendra Hub
https://www.kendra.io/kendra-hub
GNU General Public License v2.0
4 stars 1 forks source link

Add messaging system #52

Closed BBGuy closed 9 years ago

BBGuy commented 9 years ago

We need to add a messaging system that can perform the following

BBGuy commented 9 years ago

Use the Message module

We will use the Message as this uses a fieldable entity and can be associated with users for user to user communication and with Assets for conflict resolution. The Message module is designed for rules integration i.e. when updating an asset generate an automatic message. For normal Messages like user to user we will need to write custom code, however we want a single system for all messages and this looks like the ideal module

Step one: Setup basic messaging

Step two will be for asset Messaging around conflict resolution.

andystiller commented 9 years ago

I have create a custom module that adds a create message form to the user form that allows the logged in user to send a message to the selected user. I have also created a messages type that includes a message title, message body and message recipient. To view the messges I have created 2 views. The "My Messages" show the messages sent to the selected user and the "User Messages" view shows all user messages sent.

The new custom module, the message module and the message nofity module have been commited on a new 52 branch.

I have exported the "My Messages" view https://www.dropbox.com/s/d9hkwk18l66wta8/my_messages_view.txt?dl=0, "User Messages" view https://www.dropbox.com/s/kcyqudmjams2s8m/user_message_view.txt?dl=0 and the "User Message" type https://www.dropbox.com/s/kcyqudmjams2s8m/user_message_view.txt?dl=0.

dahacouk commented 9 years ago

Just interested why and how we are using dropbox as part of our development process? Maybe Skype Friday morning? Cheers!

andystiller commented 9 years ago

Unfortunately Github doesn't allow us attach files and @BBGuy wanted views and message type exported for easy deployment . We're using Dropbox to host the exported views and message types as test files so they can be attached to this issue.

dahacouk commented 9 years ago

Coolio!

andystiller commented 9 years ago

I have just added a new view that will add a table of messages for the currently logged in user. This has a block and can be used on the notifications page. I have exported the view to https://www.dropbox.com/s/6r6pmwjyp7twhc5/message_notifcations_view.txt?dl=0.

andystiller commented 9 years ago

I have added email notification of user messages using the Message_notify module. After checking the code and testing I have changes the email address the message is sent ot to be the recipients email address. The email address is obtained by loading the recipient user and getting thier email address.

andystiller commented 9 years ago

The Message Subscribe module requires the Flag module to be installed. It is designed to send notification messages users that events have occured on the site. It uses the flag module to flag a users interest in node. The Message Subscribe UI module provides some standards views. It requires some flags to be configured before the views can be used.

andystiller commented 9 years ago

Deployment to Dev

BBGuy commented 9 years ago

Great work @andystiller below are the requirements we went over plus the next stage Completed

Needs finishing

Next stage

Notes:

BBGuy commented 9 years ago

@dahacouk Now that we have user to user communications we need to think about discoverability of users, for this I have created #56

BBGuy commented 9 years ago

@andystiller you code has now been pushed to live so can be setup

BBGuy commented 9 years ago

@andystiller one other small issue I came across

andystiller commented 9 years ago

Deployment to Live

andystiller commented 9 years ago

The email title and body needed to be configured for the message in the message display settings.

andystiller commented 9 years ago

Further work on the email system

andystiller commented 9 years ago

The message sender (the users full name) can be included in the Message Title using Tokens provided by the Message Module. This allows the sender to beincluded inthe email subject line while leaving the sender of the message as the site email address. The other advantage is that the name also appears in the User Messages administration view.

andystiller commented 9 years ago

The message body needs to be configured display as plain text to in the Manage Display (Notify - Email body). If the Message body is dispalyed with default formatting characters can get escaped (HTML codes).

andystiller commented 9 years ago

Some users don't have a full name configured so for now I will make the code and the configuration use the username instead of the Full name.

andystiller commented 9 years ago

System Messages

To create system messages the most flexible and easiest to congiure way would be to clode the "User Message" type and change the email /title settings so that email notifications would have the correct format. This has the other advantage of making the filtering of messages easier. It would also allow better Rules integration.

andystiller commented 9 years ago

To create the System Message it is best clone the "User Message" rather than import a new Message type as cloning creates all the fields. The Description and Mesage text should be edited after cloning.

The Account Approved and assigned Asset Author messages have been created in Rules. https://www.dropbox.com/s/8ik1es1qt56tvku/asset_author_rule.txt?dl=0 https://www.dropbox.com/s/lpoci01nciuxn93/user_approved_rule.txt?dl=0

I have also updated the User Message administration view to include a System Message administration view. https://www.dropbox.com/s/kcyqudmjams2s8m/user_message_view.txt?dl=0

andystiller commented 9 years ago

Deploy to dev

Deploy to live

andystiller commented 9 years ago

The subject field of emails sent doesn't have a space between the message text and the message title.

andystiller commented 9 years ago

The notification view has been updated to include system messages and the minor formatting problems have been worked around. There is a new issue #57 to handle the remaining minor formatting problems.

dahacouk commented 9 years ago

Not sure about doing this. Please use the real name? If there isn't a real name then we'll need to look at our options. Usernames should never be used for display other than the URL (I think).

On 8 Jan 2015, at 14:14, andystiller notifications@github.com wrote:

Some users don't have a full name configured so for now I will make the code and the configuration use the username instead of the Full name.


Reply to this email directly or view it on GitHub: https://github.com/kendrainitiative/kendra_hub/issues/52#issuecomment-69183833

BBGuy commented 9 years ago

@andystiller Can you make sure the real name is required, this will make sure all new users got one. Can you also go over all existing users not many and make sure they all got a real name and finally update all views, messages & email to use the real name

andystiller commented 9 years ago

I have tested on my local copy and the Full Name field is required when registering a user either through the create new account screen or the /admin/people page.

andystiller commented 9 years ago

I have tested on my local copy and the Full Name field is required when registering a user either through the create new account screen or the /admin/people page. I have updated the dev and live sites to make sure all users have a full name defined.

andystiller commented 9 years ago

After a lot of thought and a discussion with @BBGuy I think that there should be change to messaging system. The current system has the owner of the message as the sender and a message recipient as a separate field. This makes sense for user messages but not for the system and entity message types.

The changes will allow for extra states of the message (eg. read, hidden) that can be changed by the recipient of the message.

If we make the owner of the message the recipient and only have an extra sender field for the user message that would make more sense and allow for the notification view to show all message types to the user.

Work required

Use cases

User messages

Single recipient The owner of the message is the recipient and the sender is stored in a new field, If the sender wants a copy of the message it would be system message to the sender with the name of the recipient and a copy of the user message body in the system message body.

Multiple recipients The owner of the message is the recipient and the sender is stored in a new field, If the sender wants a copy of the message it would be system message to the sender with a list of recipients and a copy of the user message body in the system message body.

System Message

A system message would be sent from the site to a single recipient. The exact formatting of the message body would depend on the systems message being sent.

Entity Message

Claim request For a claim request the owner of the message will be asset author and the sender can be derived from author of the claim request. The body of the request will include a link to the claim request along with any other information required,

andystiller commented 9 years ago

I have updated the code, views and rules to follow the changes outlined in the last comment.

I have also created and tested a new message type called an Entity Message. This type of message can be sent when an entity (e.g. an Asset or Claim Request) is created or changed. The Entity Message has an Entity reference field to Node.

andystiller commented 9 years ago

Deploy to dev

Deploy to live

andystiller commented 9 years ago

The main work on the messaging system is now complete. The following issues continue the work on the messaging system and extend the functionality: