Skip to content
Extraits de code Groupes Projets
Valider 9a4a7255 rédigé par Benjamin Neff's avatar Benjamin Neff Validation de Jonne Haß
Parcourir les fichiers

remove unused older and newer methods for posts

last renamed in 8386179f

closes #5970
parent 289753e0
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -11,6 +11,7 @@
* 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)
* 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
* 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})
}
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)
if current_user.present?
current_user.posts_from(author)
......
......@@ -149,21 +149,6 @@ describe Post, :type => :model do
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
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter