mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-22 21:39:22 +00:00
Can mark conversation messages as seen
This commit is contained in:
parent
46f6e15b02
commit
c9f25a46ae
@ -139,7 +139,8 @@ export class ConversationsController {
|
|||||||
list["conversation-" + convID] = (await ConversationsHelper.GetLastMessages(convID, 10))
|
list["conversation-" + convID] = (await ConversationsHelper.GetLastMessages(convID, 10))
|
||||||
.map(e => this.ConversationMessageToAPI(e));
|
.map(e => this.ConversationMessageToAPI(e));
|
||||||
|
|
||||||
// TODO : mark the user has seen the messages
|
// Mark the user has seen the messages
|
||||||
|
await ConversationsHelper.MarkUserSeen(convID, h.getUserId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,6 +258,25 @@ export class ConversationsHelper {
|
|||||||
})).map(m => this.DBToConversationMessage(convID, m));
|
})).map(m => this.DBToConversationMessage(convID, m));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mark the user has seen the last messages of the conversation
|
||||||
|
*
|
||||||
|
* @param convID Target conversation ID
|
||||||
|
* @param userID Target user ID
|
||||||
|
*/
|
||||||
|
public static async MarkUserSeen(convID: number, userID: number) {
|
||||||
|
await DatabaseHelper.UpdateRows({
|
||||||
|
table: USERS_TABLE,
|
||||||
|
where: {
|
||||||
|
conv_id: convID,
|
||||||
|
user_id: userID
|
||||||
|
},
|
||||||
|
set: {
|
||||||
|
saw_last_message: 1
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the list of members of a conversation
|
* Get the list of members of a conversation
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user