Merge branch 'master' into close-accounts

This commit is contained in:
r888888888
2013-05-16 14:16:47 -07:00
129 changed files with 55250 additions and 462 deletions

View File

@@ -6,7 +6,7 @@ module Admin
end
def create
@importer = AliasAndImplicationImporter.new(params[:batch][:text], params[:batch][:forum_id])
@importer = AliasAndImplicationImporter.new(params[:batch][:text], params[:batch][:forum_id], params[:batch][:rename_aliased_pages])
@importer.process!
flash[:notice] = "Import queued"
redirect_to new_admin_alias_and_implication_import_path

View File

@@ -5,6 +5,7 @@ class ApplicationController < ActionController::Base
before_filter :set_current_user
after_filter :reset_current_user
before_filter :set_title
before_filter :normalize_search
before_filter :set_started_at_session
before_filter :api_check
layout "default"
@@ -100,4 +101,8 @@ protected
def set_title
@page_title = Danbooru.config.app_name + "/#{params[:controller]}"
end
def normalize_search
params[:search] ||= {}
end
end

View File

@@ -14,6 +14,7 @@ class DmailsController < ApplicationController
end
def index
cookies[:dmail_folder] = params[:folder]
@search = Dmail.visible.search(params[:search])
@dmails = @search.order("dmails.created_at desc").paginate(params[:page])
respond_with(@dmails) do |format|

View File

@@ -1,15 +1,18 @@
class FavoritesController < ApplicationController
before_filter :member_only
respond_to :html, :xml, :json
def index
if params[:tags]
redirect_to(posts_path(:tags => params[:tags]))
elsif request.format == Mime::JS
list_favorited_users
elsif params[:user_id]
@favorite_set = PostSets::Favorite.new(User.find(params[:user_id]), params[:page], params)
else
@favorite_set = PostSets::Favorite.new(CurrentUser.user, params[:page], params)
user_id = params[:user_id] || CurrentUser.user.id
@favorite_set = PostSets::Favorite.new(user_id, params[:page], params)
respond_with(@favorite_set.posts) do |format|
format.xml do
render :xml => @favorite_set.posts.to_xml(:root => "posts")
end
end
end
end
@@ -26,9 +29,4 @@ class FavoritesController < ApplicationController
@post = Post.find(params[:id])
@post.remove_favorite!(CurrentUser.user)
end
def list_favorited_users
@post = Post.find(params[:post_id])
render :action => "list_favorited_users"
end
end

View File

@@ -56,7 +56,7 @@ class ForumPostsController < ApplicationController
def destroy
@forum_post = ForumPost.find(params[:id])
raise User::PrivilegeError unless @forum_post.editable_by?(CurrentUser.user)
@forum_post.update_attribute(:is_deleted, true)
@forum_post.update_column(:is_deleted, true)
respond_with(@forum_post)
end

View File

@@ -0,0 +1,12 @@
class NotePreviewsController < ApplicationController
respond_to :json
def show
@body = DText.sanitize(params[:body].to_s)
respond_with(@body) do |format|
format.json do
render :json => {:body => @body}.to_json
end
end
end
end

View File

@@ -68,6 +68,8 @@ class PoolsController < ApplicationController
@pool = Pool.find(params[:id])
@version = PoolVersion.find(params[:version_id])
@pool.revert_to!(@version)
respond_with(@pool, :notice => "Pool reverted")
respond_with(@pool) do |format|
format.js
end
end
end

View File

@@ -13,7 +13,9 @@ class PostsController < ApplicationController
respond_with(@posts) do |format|
format.atom
format.xml do
render :xml => @posts.to_xml(:root => "posts")
render :xml => @posts.to_xml(:root => "posts") {|builder|
builder.tag!(:total_count, @posts.total_count)
}
end
end
end
@@ -22,13 +24,8 @@ class PostsController < ApplicationController
@post = Post.find(params[:id])
@post_flag = PostFlag.new(:post_id => @post.id)
@post_appeal = PostAppeal.new(:post_id => @post.id)
@children_post_set = PostSets::Post.new("parent:#{@post.id} -id:#{@post.id}", 1, 200)
@children_post_set.posts.reverse!
@parent_post_set = PostSets::Post.new("id:#{@post.parent_id} status:any")
@siblings_post_set = PostSets::Post.new("parent:#{@post.parent_id} -id:#{@post.parent_id}", 1, 200)
@siblings_post_set.posts.reverse!
@parent_post_set = PostSets::PostRelationship.new(@post.parent_id, :include_deleted => @post.is_deleted?)
@children_post_set = PostSets::PostRelationship.new(@post.id, :include_deleted => @post.is_deleted?)
respond_with(@post)
end

View File

@@ -25,7 +25,12 @@ class TagImplicationsController < ApplicationController
def destroy
@tag_implication = TagImplication.find(params[:id])
@tag_implication.destroy
respond_with(@tag_implication)
respond_with(@tag_implication) do |format|
format.html do
flash[:notice] = "Tag implication was deleted"
redirect_to(tag_implications_path)
end
end
end
def approve

View File

@@ -15,10 +15,15 @@ class UsersController < ApplicationController
end
def index
@users = User.search(params[:search]).order("users.id desc").paginate(params[:page], :search_count => params[:search])
respond_with(@users) do |format|
format.xml do
render :xml => @users.to_xml(:root => "users")
if params[:name].present?
@user = User.find_by_name(params[:name])
redirect_to user_path(@user)
else
@users = User.search(params[:search]).order("users.id desc").paginate(params[:page], :search_count => params[:search])
respond_with(@users) do |format|
format.xml do
render :xml => @users.to_xml(:root => "users")
end
end
end
end

View File

@@ -70,7 +70,8 @@ class WikiPagesController < ApplicationController
if @wiki_page
redirect_to wiki_page_path(@wiki_page)
else
redirect_to new_wiki_page_path(:wiki_page => {:title => params[:title]})
@wiki_page = WikiPage.new(:title => params[:title])
respond_with(@wiki_page)
end
end