Skip to content
Extraits de code Groupes Projets
Valider d4e046ec rédigé par Jonne Haß's avatar Jonne Haß
Parcourir les fichiers

Merge pull request #4787 from hincupetru/4726-infinite-photo-stream

Added limit by max_time to photos#index for prevent "infinite photo stream"
parents 8f67e1eb e0b23b2d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -22,6 +22,7 @@
* Fix plaintext mode of Mentionable [#4294](https://github.com/diaspora/diaspora/issues/4294)
* Fixed Atom Feed Error if reshared Post is deleted [#4638] (https://github.com/diaspora/diaspora/issues/4638)
* Show hovercards in the notification drop-down for users on the same pod [#4843](https://github.com/diaspora/diaspora/pull/4843)
* The photo stream no longer repeats after the last photo [#4726](https://github.com/diaspora/diaspora/issues/4726)
## Features
* You can report a single post by clicking the correct icon in the controler section [#4517](https://github.com/diaspora/diaspora/pull/4517)
......
......@@ -31,7 +31,7 @@ class PhotosController < ApplicationController
@contact = Contact.new
end
@posts = current_user.photos_from(@person)
@posts = current_user.photos_from(@person, max_time: max_time)
respond_to do |format|
format.all { render 'people/show' }
......
......@@ -133,8 +133,11 @@ module User::Querying
::EvilQuery::ShareablesFromPerson.new(self, Post, person).make_relation!
end
def photos_from(person)
def photos_from(person, opts={})
opts = prep_opts(Photo, opts)
::EvilQuery::ShareablesFromPerson.new(self, Photo, person).make_relation!
.by_max_time(opts[:max_time])
.limit(opts[:limit])
end
protected
......
......@@ -101,6 +101,14 @@ describe PhotosController do
response.headers['Content-Type'].should match 'application/json.*'
save_fixture(response.body, "photos_json")
end
it 'displays by date of creation' do
max_time = bob.photos.first.created_at - 1.day
get :index, person_id: bob.person.guid.to_s,
max_time: max_time.to_i
assigns[:posts].should be_empty
end
end
describe '#edit' do
......
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