diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-07-19 17:03:50 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2017-07-28 14:31:51 +0300 |
commit | 6ef87a20832d1a2581cb85e60eda46f999c55a81 (patch) | |
tree | 580dfa4039580675f423290ae70acec52b21b9b3 /spec/lib/banzai/filter | |
parent | 8626cdc3b3fcb18447c65588327a7d7c16121305 (diff) |
Merge issuable "reopened" state into "opened"
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 'spec/lib/banzai/filter')
-rw-r--r-- | spec/lib/banzai/filter/issuable_state_filter_spec.rb | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/spec/lib/banzai/filter/issuable_state_filter_spec.rb b/spec/lib/banzai/filter/issuable_state_filter_spec.rb index 7cf2f4282f8..bc7cae1df8d 100644 --- a/spec/lib/banzai/filter/issuable_state_filter_spec.rb +++ b/spec/lib/banzai/filter/issuable_state_filter_spec.rb @@ -107,14 +107,6 @@ describe Banzai::Filter::IssuableStateFilter do expect(doc.css('a').last.text).to eq(issue.to_reference) end - it 'ignores reopened issue references' do - issue = create_issue(:reopened) - link = create_link(issue.to_reference, issue: issue.id, reference_type: 'issue') - doc = filter(link, context) - - expect(doc.css('a').last.text).to eq(issue.to_reference) - end - it 'appends state to closed issue references' do link = create_link(closed_issue.to_reference, issue: closed_issue.id, reference_type: 'issue') doc = filter(link, context) @@ -139,7 +131,7 @@ describe Banzai::Filter::IssuableStateFilter do end it 'ignores reopened merge request references' do - merge_request = create_merge_request(:reopened) + merge_request = create_merge_request(:opened) link = create_link( merge_request.to_reference, |