post versions: add ability to search post versions by tags.

* Add ability to search /post_versions by added tags, removed tags, or
  changed tags (added or removed).

* Add 'History' link to the sidebar of the /posts index. This is a
  shortcut for a /post_versions search of the current tag.
This commit is contained in:
evazion
2019-09-26 20:28:30 -05:00
parent 12de26d2cf
commit 2b4ee0ee8f
7 changed files with 56 additions and 16 deletions

View File

@@ -7,7 +7,7 @@ class PostVersionsControllerTest < ActionDispatch::IntegrationTest
context "The post versions controller" do
context "index action" do
setup do
setup do
@user.as_current do
@post = create(:post)
travel(2.hours) do
@@ -34,6 +34,17 @@ class PostVersionsControllerTest < ActionDispatch::IntegrationTest
assert_response :success
assert_select "#post-version-#{@post2.versions[0].id}", false
end
should "list all versions for search[changed_tags]" do
get post_versions_path, as: :json, params: { search: { changed_tags: "1" }}
assert_response :success
assert_equal @versions[1].id, response.parsed_body[1]["id"].to_i
assert_equal @versions[2].id, response.parsed_body[0]["id"].to_i
get post_versions_path, as: :json, params: { search: { changed_tags: "1 2" }}
assert_response :success
assert_equal @versions[1].id, response.parsed_body[0]["id"].to_i
end
end
end
end