LOTS of changes to properly handle post/topic revisions

FIX: history revision can now properly be hidden
FIX: PostRevision serializer is now entirely dynamic to properly handle
hidden revisions
FIX: default history modal to "side by side" view on mobile
FIX: properly hiden which revision has been hidden
UX: inline category/user/wiki/post_type changes with the revision
details
FEATURE: new '/posts/:post_id/revisions/latest' endpoint to retrieve
latest revision
UX: do not show the hide/show revision button on mobile (no room for
them)
UX: remove CSS transitions on the buttons in the history modal
FIX: PostRevisor now handles all the changes that might create new
revisions
FIX: PostRevision.ensure_consistency! was wrong due to off by 1
mistake...
refactored topic's callbacks for better readability
extracted 'PostRevisionGuardian'
This commit is contained in:
Régis Hanol
2014-10-27 22:06:43 +01:00
parent caf31dde1e
commit e7f251c105
46 changed files with 878 additions and 949 deletions

View File

@ -49,7 +49,6 @@ describe UserAction do
end
it 'includes the events correctly' do
mystats = stats_for_user(user)
expecting = [UserAction::NEW_TOPIC, UserAction::NEW_PRIVATE_MESSAGE, UserAction::GOT_PRIVATE_MESSAGE, UserAction::BOOKMARK].sort
mystats.should == expecting
@ -66,7 +65,6 @@ describe UserAction do
stream_count.should == 0
# groups
category = Fabricate(:category, read_restricted: true)
public_topic.recover!
@ -90,18 +88,16 @@ describe UserAction do
# duplicate should not exception out
log_test_action
# recategorize belongs to the right user
category2 = Fabricate(:category)
admin = Fabricate(:admin)
public_topic.acting_user = admin
public_topic.change_category_to_id(category2.id)
public_post.revise(admin, { category_id: category2.id})
action = UserAction.stream(user_id: public_topic.user_id, guardian: Guardian.new)[0]
action.acting_user_id.should == admin.id
action.action_type.should == UserAction::EDIT
end
end
describe 'when user likes' do
@ -121,7 +117,6 @@ describe UserAction do
it "creates a new stream entry" do
PostAction.act(liker, post, PostActionType.types[:like])
likee_stream.count.should == @old_count + 1
end
context "successful like" do