remove unused older and newer methods for posts
last renamed in 8386179f16
closes #5970
This commit is contained in:
parent
289753e068
commit
9a4a7255e7
3 changed files with 1 additions and 23 deletions
|
|
@ -11,6 +11,7 @@
|
||||||
* Remove unused `hasPhotos` and `hasText` functions [#5969](https://github.com/diaspora/diaspora/pull/5969)
|
* Remove unused `hasPhotos` and `hasText` functions [#5969](https://github.com/diaspora/diaspora/pull/5969)
|
||||||
* Replace foreman with eye [#5966](https://github.com/diaspora/diaspora/pull/5966)
|
* Replace foreman with eye [#5966](https://github.com/diaspora/diaspora/pull/5966)
|
||||||
* Improved handling of reshares with deleted roots [#5968](https://github.com/diaspora/diaspora/pull/5968)
|
* Improved handling of reshares with deleted roots [#5968](https://github.com/diaspora/diaspora/pull/5968)
|
||||||
|
* Remove two unused methods [#5970](https://github.com/diaspora/diaspora/pull/5970)
|
||||||
|
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
* Disable auto follow back on aspect deletion [#5846](https://github.com/diaspora/diaspora/pull/5846)
|
* Disable auto follow back on aspect deletion [#5846](https://github.com/diaspora/diaspora/pull/5846)
|
||||||
|
|
|
||||||
|
|
@ -52,14 +52,6 @@ class Post < ActiveRecord::Base
|
||||||
joins(:likes).where(:likes => {:author_id => person.id})
|
joins(:likes).where(:likes => {:author_id => person.id})
|
||||||
}
|
}
|
||||||
|
|
||||||
def self.newer(post)
|
|
||||||
where("posts.created_at > ?", post.created_at).reorder('posts.created_at ASC').first
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.older(post)
|
|
||||||
where("posts.created_at < ?", post.created_at).reorder('posts.created_at DESC').first
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.visible_from_author(author, current_user=nil)
|
def self.visible_from_author(author, current_user=nil)
|
||||||
if current_user.present?
|
if current_user.present?
|
||||||
current_user.posts_from(author)
|
current_user.posts_from(author)
|
||||||
|
|
|
||||||
|
|
@ -149,21 +149,6 @@ describe Post, :type => :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# @posts[0] is the newest, @posts[5] is the oldest
|
|
||||||
describe ".newer" do
|
|
||||||
it 'returns the next post in the array' do
|
|
||||||
expect(@posts[3].created_at).to be < @posts[2].created_at #post 2 is newer
|
|
||||||
expect(Post.newer(@posts[3]).created_at.to_s).to eq(@posts[2].created_at.to_s) #its the newer post, not the newest
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe ".older" do
|
|
||||||
it 'returns the previous post in the array' do
|
|
||||||
expect(Post.older(@posts[3]).created_at.to_s).to eq(@posts[4].created_at.to_s) #its the older post, not the oldest
|
|
||||||
expect(@posts[3].created_at).to be > @posts[4].created_at #post 4 is older
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue