finished dmails and favorites functional tests
This commit is contained in:
@@ -13,6 +13,10 @@ class Favorite
|
||||
# ignore
|
||||
end
|
||||
|
||||
def self.count(user_id)
|
||||
select_value_sql("SELECT COUNT(*) FROM #{table_name_for(user_id)}").to_i
|
||||
end
|
||||
|
||||
def self.destroy(conditions)
|
||||
if conditions[:user_id] && conditions[:post_id]
|
||||
destroy_for_post_and_user(conditions[:post_id], conditions[:user_id])
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module PostSets
|
||||
class Base
|
||||
attr_accessor :page, :before_id, :count
|
||||
attr_accessor :page, :before_id, :count, :posts
|
||||
|
||||
def initialize(options = {})
|
||||
@page = options[:page].to_i
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
module PostSets
|
||||
class FavoriteSet < Base
|
||||
class Favorite < Base
|
||||
attr_accessor :user
|
||||
|
||||
def initialize(options = {})
|
||||
super(options)
|
||||
def initialize(user)
|
||||
@user = user
|
||||
super()
|
||||
end
|
||||
|
||||
def tags
|
||||
@@ -12,7 +12,11 @@ module PostSets
|
||||
end
|
||||
|
||||
def load_posts
|
||||
user.favorite_posts(:before_id => before_id)
|
||||
@posts = user.favorite_posts(:before_id => before_id)
|
||||
end
|
||||
|
||||
def limit
|
||||
Danbooru.config.posts_per_page
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user