Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14349 from ncounter/refactoring-tab-visibility
Refactoring tab visibility - use decorator instead of helper
- Loading branch information
Showing
10 changed files
with
71 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
class BsRequestActionTabVisibility | ||
CHANGES_TABS = [:submit, :maintenance_incident, :maintenance_release].freeze | ||
|
||
def initialize(bs_request_action) | ||
@action = bs_request_action | ||
end | ||
|
||
def build | ||
source_package && !patchinfo_package | ||
end | ||
|
||
def rpm_lint | ||
build | ||
end | ||
|
||
def changes | ||
(@action.type == :delete && @action.source_package) || @action.type.in?(CHANGES_TABS) | ||
end | ||
|
||
def issues | ||
@action.type.in?(CHANGES_TABS) | ||
end | ||
|
||
private | ||
|
||
def patchinfo_package | ||
@action.type.in?([:maintenance_incident, :maintenance_release]) && @action.source_package == 'patchinfo' | ||
end | ||
|
||
def source_package | ||
@action.source_project && @action.source_package | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters