summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/contexts/issues_list_context.rb5
-rw-r--r--app/helpers/issues_helper.rb3
-rw-r--r--app/models/issue.rb4
-rw-r--r--app/models/project.rb2
-rw-r--r--app/views/issues/_filter.html.haml5
5 files changed, 14 insertions, 5 deletions
diff --git a/app/contexts/issues_list_context.rb b/app/contexts/issues_list_context.rb
index 0cc73f99535..0765b30c354 100644
--- a/app/contexts/issues_list_context.rb
+++ b/app/contexts/issues_list_context.rb
@@ -7,12 +7,13 @@ class IssuesListContext < BaseContext
@issues = case params[:status]
when issues_filter[:all] then @project.issues
when issues_filter[:closed] then @project.issues.closed
- when issues_filter[:to_me] then @project.issues.opened.assigned(current_user)
+ when issues_filter[:to_me] then @project.issues.assigned(current_user)
+ when issues_filter[:by_me] then @project.issues.authored(current_user)
else @project.issues.opened
end
@issues = @issues.tagged_with(params[:label_name]) if params[:label_name].present?
- @issues = @issues.includes(:author, :project).order("updated_at")
+ @issues = @issues.includes(:author, :project)
# Filter by specific assignee_id (or lack thereof)?
if params[:assignee_id].present?
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index 83215180492..54385117c26 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -27,6 +27,7 @@ module IssuesHelper
all: "all",
closed: "closed",
to_me: "assigned-to-me",
+ by_me: "created-by-me",
open: "open"
}
end
@@ -45,7 +46,7 @@ module IssuesHelper
return "" if @project.nil?
if @project.used_default_issues_tracker?
- project_issues_filter_path(@project)
+ project_issues_filter_path(@project)
else
url = Settings[:issues_tracker][@project.issues_tracker]["project_url"]
url.gsub(':project_id', @project.id.to_s)
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 112f43c4692..f01cad0a458 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -30,6 +30,10 @@ class Issue < ActiveRecord::Base
where('assignee_id = :user', user: user.id)
end
+ def authored(user)
+ where('author_id = :user', user: user.id)
+ end
+
def open_for(user)
opened.assigned(user)
end
diff --git a/app/models/project.rb b/app/models/project.rb
index 12f7e45496b..02f1df13f9c 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -45,7 +45,7 @@ class Project < ActiveRecord::Base
has_many :events, dependent: :destroy
has_many :merge_requests, dependent: :destroy
- has_many :issues, dependent: :destroy, order: "state, created_at DESC"
+ has_many :issues, dependent: :destroy, order: "state DESC, created_at DESC"
has_many :milestones, dependent: :destroy
has_many :users_projects, dependent: :destroy
has_many :notes, dependent: :destroy
diff --git a/app/views/issues/_filter.html.haml b/app/views/issues/_filter.html.haml
index 21efaa5357c..b621f11bc5b 100644
--- a/app/views/issues/_filter.html.haml
+++ b/app/views/issues/_filter.html.haml
@@ -6,7 +6,10 @@
Open
%li{class: ("active" if params[:status] == 'assigned-to-me')}
= link_to project_issues_path(@project, status: 'assigned-to-me') do
- Assigned To Me
+ Assigned to me
+ %li{class: ("active" if params[:status] == 'created-by-me')}
+ = link_to project_issues_path(@project, status: 'created-by-me') do
+ Created by me
%li{class: ("active" if params[:status] == 'closed')}
= link_to project_issues_path(@project, status: 'closed') do
Closed