javulorg / javul

http://www.javul.org
MIT License
0 stars 6 forks source link

(reopen later if needed) Notification System (On-Site+Email) #4

Closed javulorg closed 7 years ago

javulorg commented 7 years ago

Also see #36

Re-open as needed or use this for any information on specs.

Notifications for various items for example, Watched items. Laravel has a notification system. I hope it’s not too hard to use. Basically what we want is when user logs in, there are some popups at the top near the ‘Alerts’ icon. Just show 5 items for now and two links: Dismiss | See all Alerts. ‘See all Alerts’ will show a page called ‘My Alerts’, listing all alerts.

Alerts are of two kinds, Onsite and Email. Here are some alerts:

Account creation = Email (no need to have option to turn it off, as it will always be on for new accounts or anyone who enters their email in the account settings). So if user creates account and enters their email, they get an email saying "Welcome to Javul, your account has been created. Please click here to confirm your email." (if an email was entered in the Account creation process)

Email confirmation email = Email (cannot turn off. Email confirmation will always be there if a user enters their email in the Account settings)

Forum replies = Both Onsite and Email (Onsite will always be on. Email alert can be turned off). These same settings are for all below: Watched items Inbox (feature created by Kaushik) Funds received
Task management

In any alert (On site or Email), we want to give a link to the item if possible so they can visit that link to see more detail on that item.

acipher commented 7 years ago

when user registered into system by default email alerts for all items like (forum replies,watched items) are on. right? and site notification are always on.

Can you please explain below point. what link should be on site and email notification?

In any alert (On site or Email), we want to give a link to the item if possible so they can visit that link to see more detail on that item.

javulorg commented 7 years ago

Ok I will work on this and will give more detail soon.

javulorg commented 7 years ago

This is one of the last issues and and one that requires the most work. Let me know and I can simplify some of the work if needed.

Notification types

  1. On-site alert. This is an example: https://content.linkedin.com/content/dam/blog/en-us/corporate/blog/2012/09/notifications.jpg We dont need user profile pictures, just the text content. Format will be shown later. At the bottom of our popup section, we will have these two links: See all Alerts | Close Close: Close the popup See all Alerts: Opens a new page that shows alerts. Existing "Alerts" link at top also goes to same page. On-site Alerts are shown only once in the Popup. Old alerts can be accessed by clicking on the "Alerts" link at the top. In the notifications table, I suggest to create a boolean database called "mesg_read". When a new alert is created, its "mesg_read" value is "false". When user is shown the alert, we only want to show the ones with the "false" attribute". After that the value is changed to "true".

  2. By email Will be described later. All alerts sent by email will have this text at the bottom: "Change Alert Options" which will take them to the page view where they can change their alerts. To enable this, you can use an Anchor link or transfer Alert toggle switches to a new page (I prefer them to be on a separate page titled "Alert Settings"). Link to this page can be accessed somewhere in the Account Settings link. Subject of the email should be appropriate for the type of email sent. You can use this format for the subject. From: Javul.org Email subjects are given below for each type of alert.

Notification events

1. User account creation If user entered email during registration, send them a welcome message by email. Also send them a message using the existing Inbox functionality. It will say: "Welcome to Javul.org. Here are a few links to get you started." Email subject: Welcome to Javul.org

2. Forum activity If user A is the creator of a forum thread and anyone else replies to that thread, User A will get alerts. If they have an email in their user profile, they will get an email notification. They will also get onsite alert formatted like this: "User X replied to your forum thread "Name of thread" (Unit: XYZ) Links created are in bold. We are linking user, name of forum thread and the Unit. The same message can be used for the email alert also. When logged in, they can see the new alert and click on its links. Links to various items are needed for all kinds of alerts. No alerts generated if User A replies to their own thread (we don't need to alert a user because of their own activity) Subject for Email alert: User X replied to your forum thread "Name of thread"

Thats all we need for now for Forum alerts.

3. Watched items We dont need to send an alert if a user just adds an item to their watch list. For example User A adds Unit XYZ to their watchlist. No alert is generated on this action. However we alert the user by email/on-site if there is any activity on the watched items. For example if User A adds Unit XYZ to their watch list, we want to show them alerts for any activity in Unit XYZ. So if anyone creates or edits a Objective, Task, Issue, User A will get alerts about that activity according to the activity. For example if User B creates Objective in that unit, the alert to User A will say: "User B created/edited objective ABC in Unit XYZ" Similarly watched items can be: Unit, Objective, Task, Issue. Creation, edit or any change of the watched item in any way can generate an alert. If Objective is watched, then alerts are also generated for any Tasks associated with that Objective.

For Watched Items, its possible that the current DB structure stores the watched items ID's in the user table. It may be best to also store user ID's in the Watched items table. For example we can have a field called "Watching_Users" and add user ID in that data field when any user adds it to their watched list. Otherwise it will be an expensive query to search for watched items in the User table. Subject for Email alert: Watched Item Alert: User B created/edited objective ABC in Unit XYZ

4. Inbox Send email when a message is received in the Inbox. "User B sent you a message on Javul.org" Include link to the Inbox in the email. We dont need on-site alert for Inbox as Kaushik already included a visual alert for the Inbox. Subject for Email alert: "User B sent you a message"

5. Funds received/sent Send email/on-site alert for any payment received/sent. "You have received a payment of $50 for the task ABC in Unit XYZ" Links are in bold, for the Task and Unit. We can also have alerts a for Payment sent. If anyone donates to a user or Unit, they are sent an email so they have a record of the payment sent. "You donated $50 to user X, or Unit ABC" Subject for Email alert: "Payment of $50 received for Task A, or from User B" "Payment of $50 sent to user X or Unit Y"

6. Task management If a user is assigned a task or they bid on it, we want to send them alerts about any activity. e.g. "Task XYZ at unit ABC has been assigned to you" "marked as complete" (any other options for Task alerts) Subject of email alert: "Task XYZ at unit ABC has been assigned to you"

Let me know and I can clarify further. These are just suggestions:

  1. Two main functions for Email and Forum Alerts can be created for example SendEmailAlert(user ID, subject of message, content of message) SendOnSiteAlert (user ID, content of message) These can then be reused.
  2. Create DB structure and create alerts first for simple events like "Inbox" and then for other events.
javulorg commented 7 years ago

I revised this issue a little: minor edits, clarifications and added subjects for emails.

javulorg commented 7 years ago

Links for Laravel's notification system: https://laravel-news.com/laravel-notifications-easily-send-quick-updates-through-slack-sms-email-and-more https://laravel.com/docs/5.4/notifications

javulorg commented 7 years ago

Revised Task for this issue:

Suppose User A adds Objective ABC to their watch list. Now when User B edits that objective, User A will get an email alert: Subject of email: "Watchlist Activity: User B edited Objective ABC" From: Javul org

   "_User B_   edited  _Objective ABC_   for   _Unit XYZ_.

   _Manage Alert Settings_  |  _Edit Watch list_"

There will be links in the email for the underlined words. Last two links will go to their respective pages so alert settings and watchlist can be changed if needed.

acipher commented 7 years ago

It is done. can you please check?

Please let me know if needs to change anything.

FYI: 1) if someone (who is not unit creator) edit the unit information then email is send to unit creator. do we need to keep this functionality 2) we are sending mail to logged in user while editing unit/objective/task. do we need to keep this?

Please check alert and email sending functionality for all modules you mentioned above. and let me know if we need to change anything. .

javulorg commented 7 years ago

Both of the above two features can be turned off. Thanks for making the notification system! Looks good. I tested the Email and On-site alert but it didnt work. Could you check that these steps can work?

  1. Using Chrome, User A logged in and sets Email settings to 'On' in the settings for Watched items and adds objective ABC to the watch list: image User A also sets their email in the account settings.

  2. Using Firefox, User B logs in and edits objective ABC.

  3. In Chrome, User A should get the on-site alert and email alert about the edit.

Maybe it will work if it requires new users to be created? I can then test with new users.

acipher commented 7 years ago

it's working now.

Can you please re-test it?

javulorg commented 7 years ago

It works now, thanks. One minor change. If there are any new notifications waiting to be seen, can the bell be colored orange? That way the user will know there are notifications: image Once the notifications are seen, the color can change back to blue.

acipher commented 7 years ago

Made the color of bell to orange. if there are any new notifications waiting to be seen.

Please check.

javulorg commented 7 years ago

Thanks! It works. Closing this.

javulorg commented 7 years ago

Re-opening: This notification feature needs to be checked for any missing implementation.

javulorg commented 7 years ago

Closing as done for now.