Fix error on create bookmark for topic
This commit is contained in:
parent
af92444948
commit
dc02586d99
|
@ -551,7 +551,7 @@ class TopicsController < ApplicationController
|
|||
bookmark_manager = BookmarkManager.new(current_user)
|
||||
bookmark_manager.create(post_id: first_post.id)
|
||||
|
||||
if bookmark_manager.errors
|
||||
if bookmark_manager.errors.any?
|
||||
return render_json_error(bookmark_manager, status: 400)
|
||||
end
|
||||
else
|
||||
|
|
|
@ -2376,6 +2376,7 @@ RSpec.describe TopicsController do
|
|||
post = create_post
|
||||
post2 = create_post(topic_id: post.topic_id)
|
||||
put "/t/#{post.topic_id}/bookmark.json"
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
bookmarks_for_topic = Bookmark.where(topic: post.topic, user: user)
|
||||
expect(bookmarks_for_topic.count).to eq(1)
|
||||
|
|
Loading…
Reference in New Issue