Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiyad Preukschas <riyad@informatik.uni-bremen.de>2012-09-14 19:01:34 +0400
committerRiyad Preukschas <riyad@informatik.uni-bremen.de>2012-09-14 23:41:57 +0400
commit07eec9c66a910b5a808852f498e1dc9c88b701d2 (patch)
treec2861d2d33484599ba022271e85e8c936bc9d95f /app/contexts
parent7563abbe49fc16280877be89342d552e0609d57c (diff)
Update Notes JS for reversed notes
Diffstat (limited to 'app/contexts')
-rw-r--r--app/contexts/notes/load_context.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/contexts/notes/load_context.rb b/app/contexts/notes/load_context.rb
index c2d7644b6ba..6d26e16a56c 100644
--- a/app/contexts/notes/load_context.rb
+++ b/app/contexts/notes/load_context.rb
@@ -4,6 +4,7 @@ module Notes
target_type = params[:target_type]
target_id = params[:target_id]
after_id = params[:after_id]
+ before_id = params[:before_id]
@notes = case target_type
@@ -17,14 +18,16 @@ module Notes
project.snippets.find(target_id).notes.fresh
when "wall"
# this is the only case, where the order is DESC
- project.common_notes.order("created_at DESC").limit(50)
+ project.common_notes.order("created_at DESC, id DESC").limit(50)
when "wiki"
project.wikis.reverse.map {|w| w.notes.fresh }.flatten[0..20]
end
@notes = if after_id
@notes.where("id > ?", after_id)
- else
+ elsif before_id
+ @notes.where("id < ?", before_id)
+ else
@notes
end
end