API: Don't mark conversations as read when fetching its messages
This commit is contained in:
parent
d2acad1aed
commit
a7ff52f366
2 changed files with 5 additions and 2 deletions
|
|
@ -24,7 +24,6 @@ module Api
|
|||
|
||||
def index
|
||||
conversation = conversation_service.find!(params.require(:conversation_id))
|
||||
conversation.set_read(current_user)
|
||||
messages_page = index_pager(conversation.messages).response
|
||||
messages_page[:data] = messages_page[:data].map {|x| message_json(x) }
|
||||
render_paged_api_response messages_page
|
||||
|
|
|
|||
|
|
@ -116,6 +116,10 @@ describe Api::V1::MessagesController do
|
|||
before do
|
||||
post api_v1_conversations_path, params: @conversation
|
||||
@conversation_guid = JSON.parse(response.body)["guid"]
|
||||
Conversation.find_by(guid: @conversation_guid)
|
||||
.conversation_visibilities
|
||||
.where(person: auth.user.person)
|
||||
.update(unread: true)
|
||||
end
|
||||
|
||||
context "retrieving messages" do
|
||||
|
|
@ -132,7 +136,7 @@ describe Api::V1::MessagesController do
|
|||
|
||||
confirm_message_format(messages[0], "first message", auth.user)
|
||||
conversation = get_conversation(@conversation_guid)
|
||||
expect(conversation[:read]).to be_truthy
|
||||
expect(conversation[:read]).to be_falsy
|
||||
end
|
||||
|
||||
context "improper credentials" do
|
||||
|
|
|
|||
Loading…
Reference in a new issue