Actions
Patch #39380
closedReplace hardcoded issues count check with `limit` variable in IssuesController#retrieve_previous_and_next_issue_ids
Description
In IssuesController#retrieve_previous_and_next_issue_ids, the value `500` appears twice. One is an assignment to the variable limit
and the other is in a conditional expression.
def retrieve_previous_and_next_issue_ids
if params[:prev_issue_id].present? || params[:next_issue_id].present?
@prev_issue_id = params[:prev_issue_id].presence.try(:to_i)
@next_issue_id = params[:next_issue_id].presence.try(:to_i)
@issue_position = params[:issue_position].presence.try(:to_i)
@issue_count = params[:issue_count].presence.try(:to_i)
else
retrieve_query_from_session
if @query
@per_page = per_page_option
limit = 500
issue_ids = @query.issue_ids(:limit => (limit + 1))
if (idx = issue_ids.index(@issue.id)) && idx < limit
if issue_ids.size < 500
The conditional expression should use the variable limit
instead of the hardcoded value as in the following patch.
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 07de47c0d..0f997d2e6 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -522,7 +522,7 @@ class IssuesController < ApplicationController
limit = 500
issue_ids = @query.issue_ids(:limit => (limit + 1))
if (idx = issue_ids.index(@issue.id)) && idx < limit
- if issue_ids.size < 500
+ if issue_ids.size < limit
@issue_position = idx + 1
@issue_count = issue_ids.size
end
Updated by Go MAEDA about 1 year ago
- Target version set to 6.0.0
Setting the target version to 6.0.0.
Updated by Go MAEDA about 1 year ago
- Status changed from New to Closed
- Assignee set to Go MAEDA
Committed the patch in r22415.
Actions