summaryrefslogtreecommitdiff
path: root/app/services/issues
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2017-07-19 16:03:50 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2017-07-28 13:31:51 +0200
commit6ef87a20832d1a2581cb85e60eda46f999c55a81 (patch)
tree580dfa4039580675f423290ae70acec52b21b9b3 /app/services/issues
parent8626cdc3b3fcb18447c65588327a7d7c16121305 (diff)
downloadgitlab-ce-6ef87a20832d1a2581cb85e60eda46f999c55a81.tar.gz
Merge issuable "reopened" state into "opened"merge-issuable-reopened-into-opened-state
Having two states that essentially mean the same thing is very much like having a boolean "true" and boolean "mostly-true": it's rather silly. This commit merges the "reopened" state into the "opened" state while taking care of system notes still showing messages along the lines of "Alice reopened this issue". A big benefit from having only two states (opened and closed) is that indexing and querying becomes simpler and more performant. For example, to get all the opened queries we no longer have to query both states: SELECT * FROM issues WHERE project_id = 2 AND state IN ('opened', 'reopened'); Instead we can query a single state directly, which can be much faster: SELECT * FROM issues WHERE project_id = 2 AND state = 'opened'; Further, only having two states makes indexing easier as we will only ever filter (and thus scan an index) using a single value. Partial indexes could help but aren't supported on MySQL, complicating the development process and not being helpful for MySQL.
Diffstat (limited to 'app/services/issues')
-rw-r--r--app/services/issues/reopen_service.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/services/issues/reopen_service.rb b/app/services/issues/reopen_service.rb
index 73b2e85cba3..35de4337b15 100644
--- a/app/services/issues/reopen_service.rb
+++ b/app/services/issues/reopen_service.rb
@@ -5,7 +5,7 @@ module Issues
if issue.reopen
event_service.reopen_issue(issue, current_user)
- create_note(issue)
+ create_note(issue, 'reopened')
notification_service.reopen_issue(issue, current_user)
execute_hooks(issue, 'reopen')
invalidate_cache_counts(issue, users: issue.assignees)
@@ -16,8 +16,8 @@ module Issues
private
- def create_note(issue)
- SystemNoteService.change_status(issue, issue.project, current_user, issue.state, nil)
+ def create_note(issue, state = issue.state)
+ SystemNoteService.change_status(issue, issue.project, current_user, state, nil)
end
end
end