fixes #1439
This commit is contained in:
@@ -26,7 +26,7 @@ class Post < ActiveRecord::Base
|
||||
has_one :artist_commentary
|
||||
has_many :flags, :class_name => "PostFlag", :dependent => :destroy
|
||||
has_many :appeals, :class_name => "PostAppeal", :dependent => :destroy
|
||||
has_many :versions, :class_name => "PostVersion", :dependent => :destroy, :order => "post_versions.id ASC"
|
||||
has_many :versions, :class_name => "PostVersion", :dependent => :destroy, :order => "post_versions.updated_at ASC, post_versions.id ASC"
|
||||
has_many :votes, :class_name => "PostVote", :dependent => :destroy
|
||||
has_many :notes, :dependent => :destroy
|
||||
has_many :comments, :order => "comments.id", :dependent => :destroy
|
||||
|
||||
@@ -65,7 +65,7 @@ class PostVersion < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def sequence_for_post
|
||||
versions = PostVersion.where(:post_id => post_id).order("updated_at desc").all
|
||||
versions = PostVersion.where(:post_id => post_id).order("updated_at desc, id desc").all
|
||||
diffs = []
|
||||
versions.each_index do |i|
|
||||
if i < versions.size - 1
|
||||
@@ -130,7 +130,12 @@ class PostVersion < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def previous
|
||||
PostVersion.where("post_id = ? and updated_at < ?", post_id, updated_at).order("updated_at desc").first
|
||||
if updated_at.to_i == Time.zone.parse("2007-03-14T19:38:12Z").to_i
|
||||
# Old post versions which didn't have updated_at set correctly
|
||||
PostVersion.where("post_id = ? and updated_at = ? and id < ?", post_id, updated_at, id).order("updated_at desc, id desc").first
|
||||
else
|
||||
PostVersion.where("post_id = ? and updated_at < ?", post_id, updated_at).order("updated_at desc, id desc").first
|
||||
end
|
||||
end
|
||||
|
||||
def truncated_source
|
||||
|
||||
Reference in New Issue
Block a user