Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Milan
diaspora
Commits
e0b23b2d
Commit
e0b23b2d
authored
Feb 17, 2014
by
Hincu Petru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed #4726 infinite photo stream
parent
a51c4f0d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
2 deletions
+13
-2
app/controllers/photos_controller.rb
app/controllers/photos_controller.rb
+1
-1
app/models/user/querying.rb
app/models/user/querying.rb
+4
-1
spec/controllers/photos_controller_spec.rb
spec/controllers/photos_controller_spec.rb
+8
-0
No files found.
app/controllers/photos_controller.rb
View file @
e0b23b2d
...
...
@@ -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'
}
...
...
app/models/user/querying.rb
View file @
e0b23b2d
...
...
@@ -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
...
...
spec/controllers/photos_controller_spec.rb
View file @
e0b23b2d
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment