fixes #1461
This commit is contained in:
@@ -3,13 +3,13 @@ class Post < ActiveRecord::Base
|
||||
class DisapprovalError < Exception ; end
|
||||
class SearchError < Exception ; end
|
||||
|
||||
attr_accessor :old_tag_string, :old_parent_id, :has_constraints, :disable_versioning
|
||||
attr_accessor :old_tag_string, :old_parent_id, :old_source, :old_rating, :has_constraints, :disable_versioning
|
||||
after_destroy :delete_files
|
||||
after_destroy :delete_remote_files
|
||||
after_save :create_version
|
||||
after_save :update_parent_on_save
|
||||
after_save :apply_post_metatags, :on => :create
|
||||
before_save :merge_old_tags
|
||||
before_save :merge_old_changes
|
||||
before_save :normalize_tags
|
||||
before_save :create_tags
|
||||
before_save :update_tag_post_counts
|
||||
@@ -34,7 +34,7 @@ class Post < ActiveRecord::Base
|
||||
has_many :favorites
|
||||
validates_uniqueness_of :md5
|
||||
validate :post_is_not_its_own_parent
|
||||
attr_accessible :source, :rating, :tag_string, :old_tag_string, :last_noted_at, :parent_id, :as => [:member, :builder, :gold, :platinum, :contributor, :janitor, :moderator, :admin, :default]
|
||||
attr_accessible :source, :rating, :tag_string, :old_tag_string, :old_parent_id, :old_source, :old_rating, :last_noted_at, :parent_id, :as => [:member, :builder, :gold, :platinum, :contributor, :janitor, :moderator, :admin, :default]
|
||||
attr_accessible :is_rating_locked, :is_note_locked, :as => [:builder, :contributor, :janitor, :moderator, :admin]
|
||||
attr_accessible :is_status_locked, :as => [:admin]
|
||||
|
||||
@@ -364,7 +364,7 @@ class Post < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
def merge_old_tags
|
||||
def merge_old_changes
|
||||
if old_tag_string
|
||||
# If someone else committed changes to this post before we did,
|
||||
# then try to merge the tag changes together.
|
||||
@@ -373,6 +373,23 @@ class Post < ActiveRecord::Base
|
||||
old_tags = Tag.scan_tags(old_tag_string)
|
||||
set_tag_string(((current_tags + new_tags) - old_tags + (current_tags & new_tags)).uniq.sort.join(" "))
|
||||
end
|
||||
|
||||
if old_parent_id == ""
|
||||
old_parent_id = nil
|
||||
else
|
||||
old_parent_id = old_parent_id.to_i
|
||||
end
|
||||
if old_parent_id == parent_id
|
||||
self.parent_id = parent_id_was
|
||||
end
|
||||
|
||||
if old_source == source.to_s
|
||||
self.source = source_was
|
||||
end
|
||||
|
||||
if old_rating == rating
|
||||
self.rating = rating_was
|
||||
end
|
||||
end
|
||||
|
||||
def reset_tag_array_cache
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
<%= hidden_field_tag :tags_query, params[:tags] %>
|
||||
<%= hidden_field_tag :pool_id, params[:pool_id] %>
|
||||
<%= f.hidden_field :old_tag_string, :value => post.tag_string %>
|
||||
<%= f.hidden_field :old_parent_id, :value => post.parent_id %>
|
||||
<%= f.hidden_field :old_source, :value => post.source %>
|
||||
<%= f.hidden_field :old_rating, :value => post.rating %>
|
||||
|
||||
<div class="input">
|
||||
<% if post.is_rating_locked? %>
|
||||
|
||||
Reference in New Issue
Block a user