diff options
author | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2015-02-06 18:08:44 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2015-02-06 18:08:44 +0000 |
commit | dd8dd92e501b7e980e913e7fa3a3efa5824d21fe (patch) | |
tree | 9494c3abe46aff03ad657f7f32ca147845d25232 /lib/api/helpers.rb | |
parent | 6b61c9049815cdcc2b22a572441adba0e3dc230d (diff) | |
parent | ce0811ae5cf2c69ccf24e101b1ec1554a42e9856 (diff) | |
download | gitlab-ce-dd8dd92e501b7e980e913e7fa3a3efa5824d21fe.tar.gz |
Merge branch 'api-default-order' into 'master'
Sorting refactoring
* refactor sorting logic for web UI
* refactor and document ordering for API: project, issues, merge requests
* explicitly define ordering in models using default_scope
See merge request !1476
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r-- | lib/api/helpers.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index be9e4280d65..8fa30460ba6 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -154,6 +154,22 @@ module API Gitlab::Access.options_with_owner.values.include? level.to_i end + def issuable_order_by + if params["order_by"] == 'updated_at' + 'updated_at' + else + 'created_at' + end + end + + def issuable_sort + if params["sort"] == 'asc' + :asc + else + :desc + end + end + # error helpers def forbidden!(reason = nil) |