feat: Notification on new messages in conversation (#1204)

fixes: #895
fixes: #1118
fixes: #1075

Co-authored-by: Pranav Raj S <pranav@thoughtwoot.com>
This commit is contained in:
Sojan Jose 2020-09-10 19:19:15 +05:30 committed by GitHub
parent 3b92c744d6
commit 31c07771e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 259 additions and 94 deletions

View file

@ -26,7 +26,8 @@
"TITLE": "Email Notifications",
"NOTE": "Update your email notification preferences here",
"CONVERSATION_ASSIGNMENT": "Send email notifications when a conversation is assigned to me",
"CONVERSATION_CREATION": "Send email notifications when a new conversation is created"
"CONVERSATION_CREATION": "Send email notifications when a new conversation is created",
"ASSIGNED_CONVERSATION_NEW_MESSAGE": "Send email notifications when a new message is created in an assigned conversation"
},
"API": {
"UPDATE_SUCCESS": "Your notification preferences are updated successfully",
@ -37,6 +38,7 @@
"NOTE": "Update your push notification preferences here",
"CONVERSATION_ASSIGNMENT": "Send push notifications when a conversation is assigned to me",
"CONVERSATION_CREATION": "Send push notifications when a new conversation is created",
"ASSIGNED_CONVERSATION_NEW_MESSAGE": "Send push notifications when a new message is created in an assigned conversation",
"HAS_ENABLED_PUSH": "You have enabled push for this browser.",
"REQUEST_PUSH": "Enable push notifications"
},

View file

@ -43,6 +43,23 @@
}}
</label>
</div>
<div>
<input
v-model="selectedEmailFlags"
class="notification--checkbox"
type="checkbox"
value="email_assigned_conversation_new_message"
@input="handleEmailInput"
/>
<label for="assigned_conversation_new_message">
{{
$t(
'PROFILE_SETTINGS.FORM.EMAIL_NOTIFICATIONS_SECTION.ASSIGNED_CONVERSATION_NEW_MESSAGE'
)
}}
</label>
</div>
</div>
</div>
<div v-if="vapidPublicKey" class="profile--settings--row row push-row">
@ -105,6 +122,23 @@
}}
</label>
</div>
<div>
<input
v-model="selectedPushFlags"
class="notification--checkbox"
type="checkbox"
value="push_assigned_conversation_new_message"
@input="handlePushInput"
/>
<label for="assigned_conversation_new_message">
{{
$t(
'PROFILE_SETTINGS.FORM.PUSH_NOTIFICATIONS_SECTION.ASSIGNED_CONVERSATION_NEW_MESSAGE'
)
}}
</label>
</div>
</div>
</div>
</div>

View file

@ -35,7 +35,7 @@ export default [
inbox_id: 1,
status: 0,
timestamp: 1578555084,
user_last_seen_at: 0,
contact_last_seen_at: 0,
agent_last_seen_at: 1578555084,
unread_count: 0,
},
@ -75,7 +75,7 @@ export default [
inbox_id: 2,
status: 0,
timestamp: 1578555084,
user_last_seen_at: 0,
contact_last_seen_at: 0,
agent_last_seen_at: 1578555084,
unread_count: 0,
},

View file

@ -33,7 +33,7 @@ const toggleTyping = async ({ typingStatus }) => {
const setUserLastSeenAt = async ({ lastSeen }) => {
return API.post(
`/api/v1/widget/conversations/update_last_seen${window.location.search}`,
{ user_last_seen_at: lastSeen }
{ contact_last_seen_at: lastSeen }
);
};

View file

@ -17,7 +17,7 @@ export const actions = {
get: async ({ commit }) => {
try {
const { data } = await getConversationAPI();
const { user_last_seen_at: lastSeen } = data;
const { contact_last_seen_at: lastSeen } = data;
commit(SET_CONVERSATION_ATTRIBUTES, data);
commit('conversation/setMetaUserLastSeenAt', lastSeen, { root: true });
} catch (error) {