mirror of
https://github.com/discourse/discourse.git
synced 2026-08-13 06:25:11 -05:00
DEV: Remove PostAction/UserAction bookmark refs (#16681)
We have not used anything related to bookmarks for PostAction or UserAction records since 2020, bookmarks are their own thing now. Deleting all this is just cleaning up old cruft.
This commit is contained in:
@@ -23,7 +23,7 @@ RSpec.describe PostActionsController do
|
||||
end
|
||||
|
||||
it "returns 404 when the post action type doesn't exist for that user" do
|
||||
delete "/post_actions/#{post.id}.json", params: { post_action_type_id: PostActionType.types[:bookmark] }
|
||||
delete "/post_actions/#{post.id}.json", params: { post_action_type_id: PostActionType.types[:like] }
|
||||
expect(response.status).to eq(404)
|
||||
end
|
||||
|
||||
@@ -32,36 +32,31 @@ RSpec.describe PostActionsController do
|
||||
PostAction.create!(
|
||||
user_id: user.id,
|
||||
post_id: post.id,
|
||||
post_action_type_id: PostActionType.types[:bookmark]
|
||||
post_action_type_id: PostActionType.types[:like]
|
||||
)
|
||||
end
|
||||
|
||||
it 'returns success' do
|
||||
delete "/post_actions/#{post.id}.json", params: { post_action_type_id: PostActionType.types[:bookmark] }
|
||||
delete "/post_actions/#{post.id}.json", params: { post_action_type_id: PostActionType.types[:like] }
|
||||
expect(response.status).to eq(200)
|
||||
end
|
||||
|
||||
it 'deletes the action' do
|
||||
delete "/post_actions/#{post.id}.json", params: {
|
||||
post_action_type_id: PostActionType.types[:bookmark]
|
||||
post_action_type_id: PostActionType.types[:like]
|
||||
}
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(PostAction.exists?(
|
||||
user_id: user.id,
|
||||
post_id: post.id,
|
||||
post_action_type_id: PostActionType.types[:bookmark],
|
||||
post_action_type_id: PostActionType.types[:like],
|
||||
deleted_at: nil
|
||||
)).to eq(false)
|
||||
end
|
||||
|
||||
it "isn't deleted when the user doesn't have permission" do
|
||||
pa = PostAction.create!(
|
||||
post: post,
|
||||
user: user,
|
||||
post_action_type_id: PostActionType.types[:like],
|
||||
created_at: 1.day.ago
|
||||
)
|
||||
post_action.update!(created_at: 1.day.ago)
|
||||
|
||||
delete "/post_actions/#{post.id}.json", params: {
|
||||
post_action_type_id: PostActionType.types[:like]
|
||||
@@ -85,7 +80,7 @@ RSpec.describe PostActionsController do
|
||||
|
||||
post "/post_actions.json", params: {
|
||||
id: pm.id,
|
||||
post_action_type_id: PostActionType.types[:bookmark]
|
||||
post_action_type_id: PostActionType.types[:like]
|
||||
}
|
||||
|
||||
expect(response.status).to eq(403)
|
||||
|
||||
Reference in New Issue
Block a user