diff options
Diffstat (limited to 'app/models/todo.rb')
-rw-r--r-- | app/models/todo.rb | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/app/models/todo.rb b/app/models/todo.rb index f2fa0df852a..32ec4accb4b 100644 --- a/app/models/todo.rb +++ b/app/models/todo.rb @@ -19,6 +19,7 @@ class Todo < ApplicationRecord DIRECTLY_ADDRESSED = 7 MERGE_TRAIN_REMOVED = 8 # This is an EE-only feature REVIEW_REQUESTED = 9 + MEMBER_ACCESS_REQUESTED = 10 ACTION_NAMES = { ASSIGNED => :assigned, @@ -29,10 +30,11 @@ class Todo < ApplicationRecord APPROVAL_REQUIRED => :approval_required, UNMERGEABLE => :unmergeable, DIRECTLY_ADDRESSED => :directly_addressed, - MERGE_TRAIN_REMOVED => :merge_train_removed + MERGE_TRAIN_REMOVED => :merge_train_removed, + MEMBER_ACCESS_REQUESTED => :member_access_requested }.freeze - ACTIONS_MULTIPLE_ALLOWED = [Todo::MENTIONED, Todo::DIRECTLY_ADDRESSED].freeze + ACTIONS_MULTIPLE_ALLOWED = [Todo::MENTIONED, Todo::DIRECTLY_ADDRESSED, Todo::MEMBER_ACCESS_REQUESTED].freeze belongs_to :author, class_name: "User" belongs_to :note @@ -198,6 +200,16 @@ class Todo < ApplicationRecord action == MERGE_TRAIN_REMOVED end + def member_access_requested? + action == MEMBER_ACCESS_REQUESTED + end + + def access_request_url + return "" unless self.target_type == 'Namespace' + + Gitlab::Routing.url_helpers.group_group_members_url(self.target, tab: 'access_requests') + end + def done? state == 'done' end @@ -209,6 +221,8 @@ class Todo < ApplicationRecord def body if note.present? note.note + elsif member_access_requested? + target.full_path else target.title end @@ -246,6 +260,8 @@ class Todo < ApplicationRecord def target_reference if for_commit? target.reference_link_text + elsif member_access_requested? + target.full_path else target.to_reference end |