Fix #5146: Adding an existing favorite to favorite groups leads to an error.
Show "Favgroup already contains post XXX" error when trying to add a post to a favgroup that already contains that post.
This commit is contained in:
@@ -55,6 +55,8 @@ class FavoriteGroupsController < ApplicationController
|
||||
def add_post
|
||||
@favorite_group = authorize FavoriteGroup.find(params[:id])
|
||||
@post = Post.find(params[:post_id])
|
||||
@favorite_group.add!(@post)
|
||||
@favorite_group.add(@post)
|
||||
|
||||
respond_with(@favorite_group)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user