diff --git a/config/database.yml.sqlite b/config/database.yml.sqlite deleted file mode 100644 index 077a17ba661d311c695941e907e8f5983daca07e..0000000000000000000000000000000000000000 --- a/config/database.yml.sqlite +++ /dev/null @@ -1,37 +0,0 @@ -# -# PRODUCTION -# -# SQLite version 3.x -# gem install sqlite3 -# -# Ensure the SQLite 3 gem is defined in your Gemfile -# gem 'sqlite3' -production: - adapter: sqlite3 - database: db/production.sqlite3 - pool: 5 - timeout: 5000 - - -# -# Development specific -# -# -# -development: - adapter: sqlite3 - database: db/development.sqlite3 - pool: 5 - timeout: 5000 - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. -test: &test - adapter: sqlite3 - database: db/test.sqlite3 - pool: 5 - timeout: 5000 - -cucumber: - <<: *test diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example deleted file mode 100644 index 28323484a3744e576fea23f0d1a31bad2c00d1cc..0000000000000000000000000000000000000000 --- a/config/gitlab.yml.example +++ /dev/null @@ -1,87 +0,0 @@ -# # # # # # # # # # # # # # # # # # -# Gitlab application config file # -# # # # # # # # # # # # # # # # # # - -# -# 1. Common settings -# ========================== - -# Web application specific settings -web: - host: localhost - port: 80 - https: false - -# Email used for notification -# about new issues, comments -email: - from: notify@localhost - -# Application specific settings -# Like default project limit for user etc -app: - default_projects_limit: 10 - # backup_path: "/vol/backups" # default: Rails.root + backups/ - # backup_keep_time: 604800 # default: 0 (forever) (in seconds) - # disable_gravatar: true # default: false - Disable user avatars from Gravatar.com - - -# -# 2. Auth settings -# ========================== -ldap: - enabled: false - host: '_your_ldap_server' - base: '_the_base_where_you_search_for_users' - port: 636 - uid: 'sAMAccountName' - method: 'ssl' # plain - bind_dn: '_the_full_dn_of_the_user_you_will_bind_with' - password: '_the_password_of_the_bind_user' - -omniauth: - # Enable ability for users - # to login via twitter, google .. - enabled: false - - # IMPORTANT! - # It allows user to login without having user account - allow_single_sign_on: false - block_auto_created_users: true - - # Auth providers - providers: - # - { name: 'google_oauth2', app_id: 'YOUR APP ID', - # app_secret: 'YOUR APP SECRET', - # args: { access_type: 'offline', approval_prompt: '' } } - # - { name: 'twitter', app_id: 'YOUR APP ID', - # app_secret: 'YOUR APP SECRET'} - # - { name: 'github', app_id: 'YOUR APP ID', - # app_secret: 'YOUR APP SECRET' } - - -# -# 3. Advanced settings: -# ========================== - -# Git Hosting configuration -git_host: - admin_uri: git@localhost:gitolite-admin - base_path: /home/git/repositories/ - hooks_path: /home/git/.gitolite/hooks/ - gitolite_admin_key: gitlab - git_user: git - upload_pack: true - receive_pack: true - # host: localhost - # port: 22 - -# Git settings -# Use default values unless you understand it -git: - path: /usr/bin/git - # Max size of git object like commit, in bytes - # This value can be increased if you have a very large commits - git_max_size: 5242880 # 5.megabytes - # Git timeout to read commit, in seconds - git_timeout: 10 diff --git a/db/schema.rb b/db/schema.rb index 00bb55234af668359c6f26365cbdb68a212644fe..bb41fcd5b1651944b9964f47b409f9cf8e0fa34b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -61,8 +61,8 @@ ActiveRecord::Schema.define(:version => 20120905043334) do t.boolean "closed", :default => false, :null => false t.datetime "created_at", :null => false t.datetime "updated_at", :null => false - t.text "st_commits", :limit => 2147483647 - t.text "st_diffs", :limit => 2147483647 + t.text "st_commits", :limit => 4294967295 + t.text "st_diffs", :limit => 4294967295 t.boolean "merged", :default => false, :null => false t.integer "state", :default => 1, :null => false end @@ -80,12 +80,12 @@ ActiveRecord::Schema.define(:version => 20120905043334) do end create_table "notes", :force => true do |t| - t.text "note" + t.text "note", :limit => 255 t.string "noteable_id" t.string "noteable_type" t.integer "author_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.integer "project_id" t.string "attachment" t.string "line_code" @@ -146,30 +146,30 @@ ActiveRecord::Schema.define(:version => 20120905043334) do end create_table "users", :force => true do |t| - t.string "email", :default => "", :null => false - t.string "encrypted_password", :limit => 128, :default => "", :null => false + t.string "email", :default => "", :null => false + t.string "encrypted_password", :default => "", :null => false t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", :default => 0 + t.integer "sign_in_count", :default => 0 t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" t.string "current_sign_in_ip" t.string "last_sign_in_ip" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.string "name" - t.boolean "admin", :default => false, :null => false - t.integer "projects_limit", :default => 10 - t.string "skype", :default => "", :null => false - t.string "linkedin", :default => "", :null => false - t.string "twitter", :default => "", :null => false + t.boolean "admin", :default => false, :null => false + t.integer "projects_limit", :default => 10 + t.string "skype", :default => "", :null => false + t.string "linkedin", :default => "", :null => false + t.string "twitter", :default => "", :null => false t.string "authentication_token" - t.boolean "dark_scheme", :default => false, :null => false - t.integer "theme_id", :default => 1, :null => false + t.boolean "dark_scheme", :default => false, :null => false + t.integer "theme_id", :default => 1, :null => false t.string "bio" - t.boolean "blocked", :default => false, :null => false - t.integer "failed_attempts", :default => 0 + t.boolean "blocked", :default => false, :null => false + t.integer "failed_attempts", :default => 0 t.datetime "locked_at" t.string "extern_uid" t.string "provider" diff --git a/lib/api/issues.rb b/lib/api/issues.rb index 4ee2d11f15febf8382493141c8c02167bc935d92..f5984de9a2c6237e2bca2ab560d378aed5927e4f 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -5,11 +5,18 @@ module Gitlab resource :issues do # Get currently authenticated user's issues - # + # Parameters: + # state [closed|open] - The state of the issue # Example Request: # GET /issues get do - present paginate(current_user.issues), with: Entities::Issue + if params[:state] + state = params[:state] == 'closed' ? true :false + issues = paginate(current_user.issues.where(:closed => state)) + else + issues = current_user.issues + end + present issues, with: Entities::Issue end end @@ -18,10 +25,17 @@ module Gitlab # # Parameters: # id (required) - The ID or code name of a project + # state [closed|open] - The state of the issue # Example Request: # GET /projects/:id/issues get ":id/issues" do - present paginate(user_project.issues), with: Entities::Issue + if params[:state] + state = params[:state] == 'closed' ? true :false + issues = paginate(user_project.issues.where(:closed => state)) + else + issues = user_project.issues + end + present paginate(issues), with: Entities::Issue end # Get a single project issue diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb index 442e9c730dc8d9d4c4fbdb4fda158dc23b6210e6..c98b822cbeb65aac7afd7fd19bf8fc0f9c71d653 100644 --- a/spec/requests/api/issues_spec.rb +++ b/spec/requests/api/issues_spec.rb @@ -6,6 +6,7 @@ describe Gitlab::API do let(:user) { Factory :user } let!(:project) { Factory :project, owner: user } let!(:issue) { Factory :issue, author: user, assignee: user, project: project } + let!(:issue2) { Factory :closed_issue, author: user, assignee: user, project: project } before { project.add_access(user, :read) } describe "GET /issues" do @@ -23,6 +24,21 @@ describe Gitlab::API do json_response.should be_an Array json_response.first['title'].should == issue.title end + + it "should only return an array of open issues" do + get api("/issues?state=open", user) + response.status.should == 200 + json_response.should be_an Array + json_response.map {|r| r['closed'].should == false } + end + + it "should only return an array of closed issues" do + get api("/issues?state=closed", user) + response.status.should == 200 + json_response.should be_an Array + json_response.map {|r| r['closed'].should == true } + end + end end @@ -33,6 +49,20 @@ describe Gitlab::API do json_response.should be_an Array json_response.first['title'].should == issue.title end + + it "should only return open issues" do + get api("/projects/#{project.code}/issues?state=open", user) + response.status.should == 200 + json_response.should be_an Array + json_response.map {|r| r['closed'].should == false } + end + + it "should only return closed issues" do + get api("/projects/#{project.code}/issues?state=closed", user) + response.status.should == 200 + json_response.should be_an Array + json_response.map {|r| r['closed'].should == true} + end end describe "GET /projects/:id/issues/:issue_id" do