How would you design email notifications for a threaded comments system? - comments

The current system features plaintext comments on pieces of content stored in a mySQL database, and I'm looking to add email notifications.
Current ideas:
Emails to each user in the thread (no matter how deep)?
Email only to the owner of the comment you are replying to?
Email to content owner for each new comment? Only root level comments?
Email only to users that check off a 'Notify me of replies' below each content piece, containing any new comment, threaded or not
Thoughts?

I'd design around the idea of notifications.
Users could pick which events they're interested in subscribing to, then indicate how they want to receive notifications by email. This way, you can accommodate users who want no notification, as well as those who want notification by email, digest email, SMS, RSS, smoke signals, carrier pigeons, and telegraph.

Ended up going with 2 settings that are changeable by the user:
Email me for any new root level comments [X] On [] Off
Email me for any new comment replies [X] On [] Off

Related

conversationId - how to detect a conversation between multiple users

The use case:
We are creating a system which analyses mail content. If we are able to categorize and archive an email based on its content, we want to automatically categorize subsequent emails in the same conversation / thread.
The issue is that the conversationId we get as part of the (mail)message is not unique when we query on behalf of different users.
An example:
A: The conversationId for a given thread in my inbox.
B: The conversationId for the same thread, but in a different user's inbox.
Values:
A:AAQkADUyZWYxNzljLTc4NjItNGMzYy1iZDYwLTE4NWEzNDg1OWUzZQAQABlanHOPI0v1ukA7KePaYv4=.
B:AAQkAGVkNGRjNWNmLTAwNTItNDA2NC1hOThhLTU5NTUyNGFjNTM5ZAAQABlanHOPI0v1ukA7KePaYv4=.
Can I use parts of this conversationId to identify the same conversation across different users? The pattern seems to be that the last 25-26 characters are unique for the given conversation. The rest is a Guid + a postfix of some sort.
Edit: My question is related to usage of the Microsoft Graph API. There are questions answered on SO related to ConversationIds and Outlook emails, but these describe cases getting emails direct from the outlook client (or maybe through the outlook api). For instance are properties like the ConversationIndex and ConversationTopic not in the message I get from the Graph API.

Google Calendar Watch and Events working together

I am creating a Node/Express Webapp that would mirror a user's calendar. It would get a notification for every change in the users calendar, and would update the DB with the latest of that user's calendar.
Lets assume that we want to monitor john.doe#gmail.com. Kindly tell me if this is the best (and only) way to do it:
Set up for Push notification - While doing so, we provide (amongst other fields):
token - A plain-text that would be echoed back. This is where I can put something like 'calOwner=john.doe#gmail.com'
id - A UUID channel id
Upon every change, my webhook will get a push notification that would contain:
token : calOwner=john.doe#gmail.com
id : the channelId - I dont understand if this field alone can be used to trace this notification message back to john.doe#gmail.com
Now that I know john.doe#gmail.com has changed, I would do a list with a synchToken. This will return me the change in john's calendar since last synch
What baffles me here is that the seemingly important fields channelId and resourceId (which appears as x-goog-resource-id in the push notification header) are useless, and the only field that ties the push message to list is an optional plain-text field token .
Kindly tell me if this is the only way to track a user's calendar.
UPDATE
Thanks #KENdi for the answer.
My struggle was with the point that simply looking at a push notification message, there is no way to trace it back to john.doe#gmail.com . I now understand why such is the case, that a push notification does not contain the calendarId, but the resourceId instead (which, in plain terms is the event object). It is so because an event can be associated with multiple calendars, and hence multiple calendarIds. Hence, it is the subscriber's responsibility to maintain association of the channel to the calendarId that he had used to create the channel at the first place.
Yes, you are correct, you need the calendar push notification, to notify you about all the changes happened in the Google Calendar.
The purpose of X-Goog-Resource-ID is an opaque value that identifies the watched resource. And this ID is stable across API versions.
Check this SO question to know more about the purpose of X-Goog-Resource-Id.

Efficient way of syncing Gmail Inbox messages using the new Gmail API?

A web application sends an email on behalf of a UserA to UserB, using the new Gmail API (Users.messages: send).
The synchronous response contains threadId, messageId which are stored in the database.
We then query the history API for any changes in user's inbox (Users.history: list).
Is there an efficient way to get all the updates since last sync (new replies, read/unread changes)?
One implementation that we tried was to filter the history API results through a custom label. Unfortunately, we noticed that once a thread/message is tagged with a specific label any subsequent responses are not labeled automatically and new replies are not included in the history API response.
A second approach was to query threads using gmail advanced search for a particular label and date (e.g. after:2014/08/29 label:MY_LABEL). The problem was that gmail does not return threads that were created before 2014/08/29 but had a reply on that date.
Any scalable suggestions would be greatly appreciated.
Not sure I understand here, users.history.list was made exactly for this. Given a previous historyId, you can then call history.list(previousHistoryid), iterate through the results to find all the message Ids that have been updated since the previous historyId. Then call messages.get() on all of those--for any messages you already knew about you can just call format=MINIMAL (to see label updates), and for new messages you can use a different format to get the message content if you need it.

Rails private messages how to create a conversation view?

I am using this gem for private messages: https://github.com/jongilbraith/simple-private-messages
I want to create a thread conversation instead of the e-mail conversation the scaffold have provided.
Example, User A have sent 10 messages to User B. User A have also sent 10 messages to User C.
Instead of looping through all the messages. (e-mail look) I want to create a threat like:
Inbox
Conversation with User A (10 messages)
Conversation with User C (10 messages)
And when clicking on the conversation the messages should be ordered after date. So it would be like a conversation.
The table for messages:
id
sender_id
recipient_id
sender_deleted
recipient_deleted
subject
body
read_at
created_at
updated_at
How do I create these views? How do I group the messages?
Short answer is: you can't with that gem. You'll have to extend it and add a Conversation model then bridge that between users and messages.
I propose, instead, you use this gem:
https://github.com/ging/mailboxer
Far more powerful than your current gem, and it comes with conversations out of the box. I've used it before to mimic a gmail-like view.
From the guide:
#alfa wants to retrieve all his conversations
alfa.mailbox.conversations
#A wants to retrieve his inbox
alfa.mailbox.inbox
#A wants to retrieve his sent conversations
alfa.mailbox.sentbox
#alfa wants to retrieve his trashed conversations
alfa.mailbox.trash
Easy as pie:
current_user.mailbox.conversations.each do |convo|
convo.subject
...
end

Approval bit not set for user x#y.z, yet messages from x#y.z require approval. Why?

See enclosed image
I have a list of users on a mailing list. Their approval bit is off, yet mailman requires an approval anyway. I want people not on the list to not be able to send messages, and people who are on the list to send messages without approval.
Thanks!
I set the value on the following page to no and it seems to work... for now:
https://example.com/cgi-bin/mailman/admin/email-example.com/?VARHELP=privacy/sender/default_member_moderation
In the above URL, change example.com with your actual domain and email-example.com with the actual email of your mailman list. For example, a#b.com should be a-b.com

Resources