fixes #643
This commit is contained in:
@@ -155,6 +155,10 @@ class Post < ActiveRecord::Base
|
|||||||
image_width > Danbooru.config.large_image_width
|
image_width > Danbooru.config.large_image_width
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def has_large
|
||||||
|
has_large?
|
||||||
|
end
|
||||||
|
|
||||||
def large_image_width
|
def large_image_width
|
||||||
[Danbooru.config.large_image_width, image_width].min
|
[Danbooru.config.large_image_width, image_width].min
|
||||||
end
|
end
|
||||||
@@ -297,7 +301,7 @@ class Post < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create_tags
|
def create_tags
|
||||||
set_tag_string(tag_array.map {|x| Tag.find_or_create_by_name(x).name}.uniq.join(" "))
|
set_tag_string(tag_array.map {|x| Tag.find_or_create_by_name(x).name}.uniq.sort.join(" "))
|
||||||
end
|
end
|
||||||
|
|
||||||
def increment_tag_post_counts
|
def increment_tag_post_counts
|
||||||
@@ -356,7 +360,7 @@ class Post < ActiveRecord::Base
|
|||||||
current_tags = tag_array_was()
|
current_tags = tag_array_was()
|
||||||
new_tags = tag_array()
|
new_tags = tag_array()
|
||||||
old_tags = Tag.scan_tags(old_tag_string)
|
old_tags = Tag.scan_tags(old_tag_string)
|
||||||
set_tag_string(((current_tags + new_tags) - old_tags + (current_tags & new_tags)).uniq.join(" "))
|
set_tag_string(((current_tags + new_tags) - old_tags + (current_tags & new_tags)).uniq.sort.join(" "))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -377,7 +381,7 @@ class Post < ActiveRecord::Base
|
|||||||
normalized_tags = filter_metatags(normalized_tags)
|
normalized_tags = filter_metatags(normalized_tags)
|
||||||
normalized_tags = %w(tagme) if normalized_tags.empty?
|
normalized_tags = %w(tagme) if normalized_tags.empty?
|
||||||
normalized_tags.sort!
|
normalized_tags.sort!
|
||||||
set_tag_string(normalized_tags.uniq.join(" "))
|
set_tag_string(normalized_tags.uniq.sort.join(" "))
|
||||||
end
|
end
|
||||||
|
|
||||||
def filter_metatags(tags)
|
def filter_metatags(tags)
|
||||||
@@ -828,12 +832,19 @@ class Post < ActiveRecord::Base
|
|||||||
def to_xml(options = {}, &block)
|
def to_xml(options = {}, &block)
|
||||||
# to_xml ignores the serializable_hash method
|
# to_xml ignores the serializable_hash method
|
||||||
options ||= {}
|
options ||= {}
|
||||||
options[:methods] = [:uploader_name]
|
options[:methods] = [:uploader_name, :has_large]
|
||||||
options[:except] ||= []
|
options[:except] ||= []
|
||||||
options[:except] += hidden_attributes
|
options[:except] += hidden_attributes
|
||||||
super(options, &block)
|
super(options, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def serializable_hash(options = {})
|
||||||
|
hash = super(options)
|
||||||
|
hash["uploader_name"] = uploader_name
|
||||||
|
hash["has_large"] = has_large
|
||||||
|
hash
|
||||||
|
end
|
||||||
|
|
||||||
def to_legacy_json
|
def to_legacy_json
|
||||||
return {
|
return {
|
||||||
"has_comments" => last_commented_at.present?,
|
"has_comments" => last_commented_at.present?,
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
<%= nav_link_to("Notes", notes_path(:group_by => "post")) %>
|
<%= nav_link_to("Notes", notes_path(:group_by => "post")) %>
|
||||||
<%= nav_link_to("Wiki", wiki_pages_path(:title => "help:home")) %>
|
<%= nav_link_to("Wiki", wiki_pages_path(:title => "help:home")) %>
|
||||||
<%= nav_link_to("Forum", forum_topics_path, :class => (CurrentUser.user.has_forum_been_updated? ? "forum-updated" : nil)) %>
|
<%= nav_link_to("Forum", forum_topics_path, :class => (CurrentUser.user.has_forum_been_updated? ? "forum-updated" : nil)) %>
|
||||||
<%= nav_link_to("Artists", artists_path(:order => "date")) %>
|
<%= nav_link_to("Artists", artists_path(:search => {:order => "date"})) %>
|
||||||
<%= nav_link_to("Tags", tags_path(:order => "date")) %>
|
<%= nav_link_to("Tags", tags_path(:search => {:order => "date"})) %>
|
||||||
<% if CurrentUser.is_moderator? %>
|
<% if CurrentUser.is_moderator? %>
|
||||||
<%= nav_link_to("Aliases", tag_aliases_path) %>
|
<%= nav_link_to("Aliases", tag_aliases_path) %>
|
||||||
<%= nav_link_to("Implications", tag_implications_path) %>
|
<%= nav_link_to("Implications", tag_implications_path) %>
|
||||||
|
|||||||
Reference in New Issue
Block a user