From 397d411252e810c9110a5e13cbb8a4df6880e632 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 26 Sep 2012 00:50:40 +0400 Subject: [PATCH 1/6] #90: added #index action, updated routes --- .../projects/pull_requests_controller.rb | 22 ++++++++++++++++++ app/views/projects/issues/index.html.haml | 2 +- .../pull_requests/_index_sidebar.html.haml | 16 +++++++++++++ .../projects/pull_requests/index.html.haml | 23 +++++++++++++++++++ config/routes.rb | 2 +- 5 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 app/views/projects/pull_requests/_index_sidebar.html.haml create mode 100644 app/views/projects/pull_requests/index.html.haml diff --git a/app/controllers/projects/pull_requests_controller.rb b/app/controllers/projects/pull_requests_controller.rb index c61cd190b..67f13b809 100644 --- a/app/controllers/projects/pull_requests_controller.rb +++ b/app/controllers/projects/pull_requests_controller.rb @@ -88,6 +88,28 @@ class Projects::PullRequestsController < Projects::BaseController load_diff_commits_data end + def index(status = 200) + @pull_requests = @project.issues.joins(:pull_request).includes(:pull_request).includes(:assignee, :user) + @pull_requests = @pull_requests.where(:assignee_id => current_user.id) if @is_assigned_to_me = params[:filter] == 'to_me' + # Using mb_chars for correct transform to lowercase ('Русский Текст'.downcase => "Русский Текст") + @pull_requests = @pull_requests.where('issues.title ILIKE ?', "%#{params[:search_issue].mb_chars.downcase}%") if params[:search_issue] + + @opened_issues, @closed_issues = @pull_requests.not_closed_or_merged.count, @pull_requests.closed_or_merged.count + if params[:status] == 'closed' + @pull_requests, @status = @pull_requests.closed_or_merged, params[:status] + else + @pull_requests, @status = @pull_requests.not_closed_or_merged, 'open' + end + + @pull_requests = @pull_requests.includes(:assignee, :user).order('issues.serial_id desc').uniq + .paginate :per_page => 10, :page => params[:page] + if status == 200 + render 'index', :layout => request.xhr? ? 'issues' : 'application' + else + render :status => status, :nothing => true + end + end + def autocomplete_base_project #Maybe slow? ILIKE? items = Project.accessible_by(current_ability, :membered).search(params[:term]) diff --git a/app/views/projects/issues/index.html.haml b/app/views/projects/issues/index.html.haml index 02c05d53f..303538f5d 100644 --- a/app/views/projects/issues/index.html.haml +++ b/app/views/projects/issues/index.html.haml @@ -19,4 +19,4 @@ %th{:colspan => "2"}=t('layout.issues.description') %tbody = render :partial => 'issue', :collection => @issues - = will_paginate @issues \ No newline at end of file + = will_paginate @issues diff --git a/app/views/projects/pull_requests/_index_sidebar.html.haml b/app/views/projects/pull_requests/_index_sidebar.html.haml new file mode 100644 index 000000000..6f25ec81c --- /dev/null +++ b/app/views/projects/pull_requests/_index_sidebar.html.haml @@ -0,0 +1,16 @@ +-content_for :sidebar do + - if current_user + =form_tag project_pull_requests_path(@project), :id => 'filter_issues', :method => :get do + .bordered.nopadding + %h3=t("layout.issues.accessory") + %table + %tr + %td.width18=radio_button_tag :myradio, 'all', !@is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'} + %td.width135=t("layout.issues.all") + %td.width30.right=@project.pull_requests.count + %tr + %td=radio_button_tag :myradio, 'to_me', @is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'} + %td=t("layout.issues.to_me") + %td.width30.right=@project.issues.joins(:pull_request).where(:assignee_id => current_user.id).count + .bordered.bpadding20 + =tracker_search_field(:search_issue, t('layout.issues.search')) diff --git a/app/views/projects/pull_requests/index.html.haml b/app/views/projects/pull_requests/index.html.haml new file mode 100644 index 000000000..50bac1df6 --- /dev/null +++ b/app/views/projects/pull_requests/index.html.haml @@ -0,0 +1,23 @@ +-ar = 'activerecord.attributes.pull_requests' +-set_meta_tags :title => [title_object(@project), t('.title')] +-render 'submenu' +-render 'index_sidebar' + +#closed-switcher.blue-switcher + =hidden_field_tag :issues_status, @status, :id => 'issues_status' + .open + ="#{t('layout.issues.statuses.open')} (#{@opened_issues})" + #closed-tasks.closed + ="#{t('layout.issues.statuses.closed')} (#{@closed_issues})" + #blue-switch-select.selected{:style => "margin-left: #{@status == 'open' ? '0' : '130'}px;"} + .both +.both +#table1 + %table#myTable.tablesorter.tracker{:cellpadding => "0", :cellspacing => "0"} + %thead + %tr + %th.th1{:colspan => "2"}=t('layout.issues.number') + %th{:colspan => "2"}=t('layout.issues.description') + %tbody + = render :partial => 'projects/issues/issue', :collection => @pull_requests + = will_paginate @pull_requests diff --git a/config/routes.rb b/config/routes.rb index 49cb74f1f..161bc86c7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -186,7 +186,7 @@ Rosa::Application.routes.draw do resources :collaborators do get :find, :on => :collection end - resources :pull_requests, :except => [:destroy, :index] do + resources :pull_requests, :except => :destroy do get :autocomplete_base_project, :on => :collection put :merge, :on => :member end From 07b27b934fa196cdcdb2eeb0d91c148dc3c82e28 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 26 Sep 2012 15:46:23 +0400 Subject: [PATCH 2/6] #90: updated #index page for pull-requests --- app/assets/javascripts/extra/tracker.js | 2 +- app/controllers/projects/issues_controller.rb | 8 ++++---- .../projects/pull_requests_controller.rb | 19 +++++++++---------- app/models/issue.rb | 6 ++++++ ...ssues.html.haml => with_sidebar.html.haml} | 2 +- app/views/projects/base/_submenu.html.haml | 3 +-- .../projects/issues/_index_sidebar.html.haml | 6 +++--- .../pull_requests/_index_sidebar.html.haml | 15 ++------------- .../projects/pull_requests/index.html.haml | 4 ++-- config/locales/models/pull_request.en.yml | 6 +++++- config/locales/models/pull_request.ru.yml | 6 +++++- 11 files changed, 39 insertions(+), 38 deletions(-) rename app/views/layouts/{issues.html.haml => with_sidebar.html.haml} (92%) diff --git a/app/assets/javascripts/extra/tracker.js b/app/assets/javascripts/extra/tracker.js index 24aaf3f2f..dc084057e 100644 --- a/app/assets/javascripts/extra/tracker.js +++ b/app/assets/javascripts/extra/tracker.js @@ -50,7 +50,7 @@ $(document).ready(function() { return send_index_tracker_request('GET'); }); - $('#search_issue').live('submit', function() { + $('.ajax_search_form').live('submit', function() { return send_index_tracker_request('GET', $(this).attr("action"), $(this).serialize()); }); diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index dbf9e5841..594aed8cb 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -11,11 +11,11 @@ class Projects::IssuesController < Projects::BaseController def index(status = 200) @labels = params[:labels] || [] - @issues = @project.issues.includes(:pull_request).includes(:assignee, :user) + @issues = @project.issues.without_pull_requests @issues = @issues.where(:assignee_id => current_user.id) if @is_assigned_to_me = params[:filter] == 'to_me' @issues = @issues.joins(:labels).where(:labels => {:name => @labels}) unless @labels == [] # Using mb_chars for correct transform to lowercase ('Русский Текст'.downcase => "Русский Текст") - @issues = @issues.where('issues.title ILIKE ?', "%#{params[:search_issue].mb_chars.downcase}%") if params[:search_issue] + @issues = @issues.search(params[:search_issue]) @opened_issues, @closed_issues = @issues.not_closed_or_merged.count, @issues.closed_or_merged.count if params[:status] == 'closed' @@ -24,10 +24,10 @@ class Projects::IssuesController < Projects::BaseController @issues, @status = @issues.not_closed_or_merged, 'open' end - @issues = @issues.includes(:assignee, :user).order('issues.serial_id desc').uniq + @issues = @issues.includes(:assignee, :user, :pull_request).def_order.uniq .paginate :per_page => 10, :page => params[:page] if status == 200 - render 'index', :layout => request.xhr? ? 'issues' : 'application' + render 'index', :layout => request.xhr? ? 'with_sidebar' : 'application' else render :status => status, :nothing => true end diff --git a/app/controllers/projects/pull_requests_controller.rb b/app/controllers/projects/pull_requests_controller.rb index 67f13b809..e2015518d 100644 --- a/app/controllers/projects/pull_requests_controller.rb +++ b/app/controllers/projects/pull_requests_controller.rb @@ -89,22 +89,21 @@ class Projects::PullRequestsController < Projects::BaseController end def index(status = 200) - @pull_requests = @project.issues.joins(:pull_request).includes(:pull_request).includes(:assignee, :user) - @pull_requests = @pull_requests.where(:assignee_id => current_user.id) if @is_assigned_to_me = params[:filter] == 'to_me' - # Using mb_chars for correct transform to lowercase ('Русский Текст'.downcase => "Русский Текст") - @pull_requests = @pull_requests.where('issues.title ILIKE ?', "%#{params[:search_issue].mb_chars.downcase}%") if params[:search_issue] + @issues_with_pull_request = @project.issues.joins(:pull_request) + @issues_with_pull_request = @issues_with_pull_request.search(params[:search_pull_request]) - @opened_issues, @closed_issues = @pull_requests.not_closed_or_merged.count, @pull_requests.closed_or_merged.count + @opened_issues, @closed_issues = @issues_with_pull_request.not_closed_or_merged.count, @issues_with_pull_request.closed_or_merged.count if params[:status] == 'closed' - @pull_requests, @status = @pull_requests.closed_or_merged, params[:status] + @issues_with_pull_request, @status = @issues_with_pull_request.closed_or_merged, params[:status] else - @pull_requests, @status = @pull_requests.not_closed_or_merged, 'open' + @issues_with_pull_request, @status = @issues_with_pull_request.not_closed_or_merged, 'open' end - @pull_requests = @pull_requests.includes(:assignee, :user).order('issues.serial_id desc').uniq - .paginate :per_page => 10, :page => params[:page] + @issues_with_pull_request = @issues_with_pull_request. + includes(:assignee, :user, :pull_request).def_order.uniq. + paginate :per_page => 10, :page => params[:page] if status == 200 - render 'index', :layout => request.xhr? ? 'issues' : 'application' + render 'index', :layout => request.xhr? ? 'with_sidebar' : 'application' else render :status => status, :nothing => true end diff --git a/app/models/issue.rb b/app/models/issue.rb index 6a8eb33a3..3f40cc118 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -28,6 +28,12 @@ class Issue < ActiveRecord::Base scope :needed_checking, where(:issues => {:status => ['open', 'blocked', 'ready', 'already']}) scope :not_closed_or_merged, needed_checking scope :closed_or_merged, where(:issues => {:status => ['closed', 'merged']}) + # Using mb_chars for correct transform to lowercase ('Русский Текст'.downcase => "Русский Текст") + scope :search, lambda {|q| where('issues.title ILIKE ?', "%#{q.mb_chars.downcase}%") if q.present?} + scope :def_order, order('issues.serial_id desc') + scope :without_pull_requests, + joins("LEFT OUTER JOIN pull_requests ON issues.id = pull_requests.issue_id"). + where(:pull_requests => { :issue_id => nil } ) def assign_uname assignee.uname if assignee diff --git a/app/views/layouts/issues.html.haml b/app/views/layouts/with_sidebar.html.haml similarity index 92% rename from app/views/layouts/issues.html.haml rename to app/views/layouts/with_sidebar.html.haml index 75987198b..87bd1860c 100644 --- a/app/views/layouts/issues.html.haml +++ b/app/views/layouts/with_sidebar.html.haml @@ -1,4 +1,4 @@ - if content_for?(:sidebar) %aside= yield :sidebar .right= yield -.both \ No newline at end of file +.both diff --git a/app/views/projects/base/_submenu.html.haml b/app/views/projects/base/_submenu.html.haml index 6d465fb3d..c504995ff 100644 --- a/app/views/projects/base/_submenu.html.haml +++ b/app/views/projects/base/_submenu.html.haml @@ -15,6 +15,5 @@ %li= link_to t("project_menu.wiki"), project_wiki_index_path(@project), :class => (contr == :wiki ? 'active' : nil) %li=# link_to t("project_menu.readme"), "#" #pending - if can? :update, @project - %li= link_to t("project_menu.settings"), edit_project_path(@project), :class => (act == :edit && contr == :projects ? 'active' : nil) - / %li=link_to t("project_menu.pull_requests"), project_pull_requests_path(@project), :class => (contr == :pull_requests ? 'active' : nil) + %li= link_to t("project_menu.settings"), edit_project_path(@project), :class => (act == :edit && contr == :projects ? 'active' : nil) diff --git a/app/views/projects/issues/_index_sidebar.html.haml b/app/views/projects/issues/_index_sidebar.html.haml index d1ccfc387..03f8fb427 100644 --- a/app/views/projects/issues/_index_sidebar.html.haml +++ b/app/views/projects/issues/_index_sidebar.html.haml @@ -7,12 +7,12 @@ %tr %td.width18=radio_button_tag :myradio, 'all', !@is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'} %td.width135=t("layout.issues.all") - %td.width30.right=@project.issues.count + %td.width30.right=@project.issues.without_pull_requests.count %tr %td=radio_button_tag :myradio, 'to_me', @is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'} %td=t("layout.issues.to_me") - %td.width30.right=@project.issues.where(:assignee_id => current_user.id).count - =form_tag project_issues_path(@project), :id => 'search_issue', :method => :get do + %td.width30.right=@project.issues.without_pull_requests.where(:assignee_id => current_user.id).count + =form_tag project_issues_path(@project), :id => 'search_issue', :class => 'ajax_search_form', :method => :get do .bordered.bpadding20 =tracker_search_field(:search_issue, t('layout.issues.search')) - if can? :new, @project.issues.new diff --git a/app/views/projects/pull_requests/_index_sidebar.html.haml b/app/views/projects/pull_requests/_index_sidebar.html.haml index 6f25ec81c..449f47c85 100644 --- a/app/views/projects/pull_requests/_index_sidebar.html.haml +++ b/app/views/projects/pull_requests/_index_sidebar.html.haml @@ -1,16 +1,5 @@ -content_for :sidebar do - if current_user - =form_tag project_pull_requests_path(@project), :id => 'filter_issues', :method => :get do - .bordered.nopadding - %h3=t("layout.issues.accessory") - %table - %tr - %td.width18=radio_button_tag :myradio, 'all', !@is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'} - %td.width135=t("layout.issues.all") - %td.width30.right=@project.pull_requests.count - %tr - %td=radio_button_tag :myradio, 'to_me', @is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'} - %td=t("layout.issues.to_me") - %td.width30.right=@project.issues.joins(:pull_request).where(:assignee_id => current_user.id).count + =form_tag project_pull_requests_path(@project), :id => 'filter_pull_requests', :method => :get, :class => 'ajax_search_form' do .bordered.bpadding20 - =tracker_search_field(:search_issue, t('layout.issues.search')) + =tracker_search_field(:search_pull_request, t('layout.pull_requests.search')) diff --git a/app/views/projects/pull_requests/index.html.haml b/app/views/projects/pull_requests/index.html.haml index 50bac1df6..f0b76f5f3 100644 --- a/app/views/projects/pull_requests/index.html.haml +++ b/app/views/projects/pull_requests/index.html.haml @@ -19,5 +19,5 @@ %th.th1{:colspan => "2"}=t('layout.issues.number') %th{:colspan => "2"}=t('layout.issues.description') %tbody - = render :partial => 'projects/issues/issue', :collection => @pull_requests - = will_paginate @pull_requests + = render :partial => 'projects/issues/issue', :collection => @issues_with_pull_request + = will_paginate @issues_with_pull_request diff --git a/config/locales/models/pull_request.en.yml b/config/locales/models/pull_request.en.yml index 0b1141ad7..f72fe2790 100644 --- a/config/locales/models/pull_request.en.yml +++ b/config/locales/models/pull_request.en.yml @@ -47,4 +47,8 @@ en: head_ref: Head refs: 'branch · tag' base_project: Base project - head_project: Head project \ No newline at end of file + head_project: Head project + + layout: + pull_requests: + search: Find pull request... diff --git a/config/locales/models/pull_request.ru.yml b/config/locales/models/pull_request.ru.yml index e29e20d33..5fd188622 100644 --- a/config/locales/models/pull_request.ru.yml +++ b/config/locales/models/pull_request.ru.yml @@ -49,4 +49,8 @@ ru: head_ref: Источник refs: 'ветка · тег' base_project: Базовый проект - head_project: Проект-источник \ No newline at end of file + head_project: Проект-источник + + layout: + pull_requests: + search: Найти пул реквест... From efe8b1ffdbb34a50befa60429074c0d844a7b5d9 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 26 Sep 2012 18:20:46 +0400 Subject: [PATCH 3/6] #90: small refactoring --- app/models/issue.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index 3f40cc118..793aab703 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -32,8 +32,7 @@ class Issue < ActiveRecord::Base scope :search, lambda {|q| where('issues.title ILIKE ?', "%#{q.mb_chars.downcase}%") if q.present?} scope :def_order, order('issues.serial_id desc') scope :without_pull_requests, - joins("LEFT OUTER JOIN pull_requests ON issues.id = pull_requests.issue_id"). - where(:pull_requests => { :issue_id => nil } ) + where('NOT EXISTS (select null from pull_requests as pr where pr.issue_id = issues.id)') def assign_uname assignee.uname if assignee From 0ebc545b010939b99fc8265ee21ab6497ced36b5 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 26 Sep 2012 19:16:34 +0400 Subject: [PATCH 4/6] #90: small refactoring of views --- .../projects/issues/_issues_table.html.haml | 18 ++++++++++++++++++ app/views/projects/issues/index.html.haml | 19 +------------------ .../projects/pull_requests/index.html.haml | 19 +------------------ 3 files changed, 20 insertions(+), 36 deletions(-) create mode 100644 app/views/projects/issues/_issues_table.html.haml diff --git a/app/views/projects/issues/_issues_table.html.haml b/app/views/projects/issues/_issues_table.html.haml new file mode 100644 index 000000000..4b62218c7 --- /dev/null +++ b/app/views/projects/issues/_issues_table.html.haml @@ -0,0 +1,18 @@ +#closed-switcher.blue-switcher + =hidden_field_tag :issues_status, @status, :id => 'issues_status' + .open + ="#{t('layout.issues.statuses.open')} (#{@opened_issues})" + #closed-tasks.closed + ="#{t('layout.issues.statuses.closed')} (#{@closed_issues})" + #blue-switch-select.selected{:style => "margin-left: #{@status == 'open' ? '0' : '130'}px;"} + .both +.both +#table1 + %table#myTable.tablesorter.tracker{:cellpadding => "0", :cellspacing => "0"} + %thead + %tr + %th.th1{:colspan => "2"}=t('layout.issues.number') + %th{:colspan => "2"}=t('layout.issues.description') + %tbody + = render :partial => 'projects/issues/issue', :collection => issues + = will_paginate issues diff --git a/app/views/projects/issues/index.html.haml b/app/views/projects/issues/index.html.haml index 303538f5d..7b116f361 100644 --- a/app/views/projects/issues/index.html.haml +++ b/app/views/projects/issues/index.html.haml @@ -2,21 +2,4 @@ -render 'submenu' -render 'index_sidebar' -#closed-switcher.blue-switcher - =hidden_field_tag :issues_status, @status, :id => 'issues_status' - .open - ="#{t('layout.issues.statuses.open')} (#{@opened_issues})" - #closed-tasks.closed - ="#{t('layout.issues.statuses.closed')} (#{@closed_issues})" - #blue-switch-select.selected{:style => "margin-left: #{@status == 'open' ? '0' : '130'}px;"} - .both -.both -#table1 - %table#myTable.tablesorter.tracker{:cellpadding => "0", :cellspacing => "0"} - %thead - %tr - %th.th1{:colspan => "2"}=t('layout.issues.number') - %th{:colspan => "2"}=t('layout.issues.description') - %tbody - = render :partial => 'issue', :collection => @issues - = will_paginate @issues += render 'issues_table', :issues => @issues diff --git a/app/views/projects/pull_requests/index.html.haml b/app/views/projects/pull_requests/index.html.haml index f0b76f5f3..5aa20c682 100644 --- a/app/views/projects/pull_requests/index.html.haml +++ b/app/views/projects/pull_requests/index.html.haml @@ -3,21 +3,4 @@ -render 'submenu' -render 'index_sidebar' -#closed-switcher.blue-switcher - =hidden_field_tag :issues_status, @status, :id => 'issues_status' - .open - ="#{t('layout.issues.statuses.open')} (#{@opened_issues})" - #closed-tasks.closed - ="#{t('layout.issues.statuses.closed')} (#{@closed_issues})" - #blue-switch-select.selected{:style => "margin-left: #{@status == 'open' ? '0' : '130'}px;"} - .both -.both -#table1 - %table#myTable.tablesorter.tracker{:cellpadding => "0", :cellspacing => "0"} - %thead - %tr - %th.th1{:colspan => "2"}=t('layout.issues.number') - %th{:colspan => "2"}=t('layout.issues.description') - %tbody - = render :partial => 'projects/issues/issue', :collection => @issues_with_pull_request - = will_paginate @issues_with_pull_request += render 'projects/issues/issues_table', :issues => @issues_with_pull_request From 6f889b15a920a23845875c37b064fd756e887dc6 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 26 Sep 2012 19:39:47 +0400 Subject: [PATCH 5/6] #90: added access to show pull requests --- app/controllers/projects/pull_requests_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/projects/pull_requests_controller.rb b/app/controllers/projects/pull_requests_controller.rb index 4c0e87a82..00e6d0036 100644 --- a/app/controllers/projects/pull_requests_controller.rb +++ b/app/controllers/projects/pull_requests_controller.rb @@ -4,8 +4,8 @@ class Projects::PullRequestsController < Projects::BaseController skip_before_filter :authenticate_user!, :only => [:index, :show] if APP_CONFIG['anonymous_access'] load_resource :project - load_and_authorize_resource :issue, :through => :project, :find_by => :serial_id, :parent => false, :except => :autocomplete_base_project - load_resource :instance_name => :pull, :through => :issue, :singleton => true + load_and_authorize_resource :issue, :through => :project, :find_by => :serial_id, :parent => false, :except => [:autocomplete_base_project, :index] + load_resource :instance_name => :pull, :through => :issue, :singleton => true, :except => [:index] def new base_project = (Project.find(params[:base_project_id]) if params[:base_project_id]) || @project.root From 5f0e6837118a13a4cf8794b9347a628f554d7439 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 26 Sep 2012 19:41:00 +0400 Subject: [PATCH 6/6] #90: moved code --- app/models/issue.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index 793aab703..3e9e929be 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -31,8 +31,7 @@ class Issue < ActiveRecord::Base # Using mb_chars for correct transform to lowercase ('Русский Текст'.downcase => "Русский Текст") scope :search, lambda {|q| where('issues.title ILIKE ?', "%#{q.mb_chars.downcase}%") if q.present?} scope :def_order, order('issues.serial_id desc') - scope :without_pull_requests, - where('NOT EXISTS (select null from pull_requests as pr where pr.issue_id = issues.id)') + scope :without_pull_requests, where('NOT EXISTS (select null from pull_requests as pr where pr.issue_id = issues.id)') def assign_uname assignee.uname if assignee