gitlab-org--gitlab-foss/app/helpers
Timothy Andrew 60245bbe22 Refactor `Gitlab::GitAccess`
1. Don't use case statements for dispatch anymore. This leads to a lot
   of duplication, and makes the logic harder to follow.

2. Remove duplicated logic.

    - For example, the `can_push_to_branch?` exists, but we also have a
      different way of checking the same condition within `change_access_check`.

    - This kind of duplication is removed, and the `can_push_to_branch?`
      method is used in both places.

3. Move checks returning true/false to `UserAccess`.

    - All public methods in `GitAccess` now return an instance of
      `GitAccessStatus`. Previously, some methods would return
      true/false as well, which was confusing.

    - It makes sense for these kinds of checks to be at the level of a
      user, so the `UserAccess` class was repurposed for this. The prior
      `UserAccess.allowed?` classmethod is converted into an instance
      method.

    - All external uses of these checks have been migrated to use the
      `UserAccess` class

4. Move the "change_access_check" into a separate class.

    - Create the `GitAccess::ChangeAccessCheck` class to run these
      checks, which are quite substantial.

    - `ChangeAccessCheck` returns an instance of `GitAccessStatus` as
      well.

5. Break out the boolean logic in `ChangeAccessCheck` into `if/else`
   chains - this seems more readable.

6. I can understand that this might look like overkill for !4892, but I
   think this is a good opportunity to clean it up.

    - http://martinfowler.com/bliki/OpportunisticRefactoring.html
2016-07-13 13:24:56 +05:30
..
appearances_helper.rb Add new stopwatch and commit icons; rename custom icon helper; fix commit pipeline layout 2016-07-12 14:52:59 -05:00
application_helper.rb Style diff and blob file headers the same way 2016-07-06 18:50:59 -04:00
application_settings_helper.rb Use keyword arguments for boolean values and use `span` instead of `a` for clone "button" 2016-07-05 16:54:22 -05:00
auth_helper.rb Add a `U2fRegistrations` table/model. 2016-06-06 12:50:31 +05:30
blob_helper.rb add custom highlighting via .gitattributes 2016-06-27 14:17:49 -07:00
branches_helper.rb Refactor `Gitlab::GitAccess` 2016-07-13 13:24:56 +05:30
broadcast_messages_helper.rb
button_helper.rb Display tooltip for "Copy to Clipboard" button (!5164) 2016-07-11 14:20:48 +02:00
ci_status_helper.rb Change running status color to blue; update icon to spinner 2016-07-12 16:34:00 -05:00
commits_helper.rb Merge branch 'commits-ui' into 'master' 2016-06-15 20:24:13 +00:00
compare_helper.rb
dashboard_helper.rb
diff_helper.rb Merge branch 'master' into faster-diffs 2016-07-11 17:19:17 -04:00
dropdowns_helper.rb Revert "Revert "Merge branch 'issue_3946' into 'master' "" 2016-07-07 23:48:02 -04:00
emails_helper.rb Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
events_helper.rb
explore_helper.rb
external_wiki_helper.rb
form_helper.rb
git_helper.rb
gitlab_markdown_helper.rb Move pre_process into render_result 2016-06-21 17:39:01 +02:00
gitlab_routing_helper.rb Merge branch 'environments-and-deployments' into 'master' 2016-06-15 13:48:09 +00:00
graph_helper.rb
groups_helper.rb Add request access for groups 2016-06-14 13:07:26 +02:00
icons_helper.rb
import_helper.rb
issuables_helper.rb Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
issues_helper.rb Moved merge request button visibility out of issue_helper 2016-07-11 08:51:18 +01:00
javascript_helper.rb Revert Subresource Integrity pending a fix for Firefox's incorrect hashing implementation. 2016-06-27 07:47:33 -06:00
kerberos_spnego_helper.rb Groundwork for Kerberos SPNEGO (EE feature) 2016-07-01 11:46:56 +02:00
labels_helper.rb Fixed URL on label button when filtering 2016-06-24 11:31:36 +01:00
members_helper.rb New :request_access ability to replace a ugly helper 2016-07-05 14:35:26 +02:00
merge_requests_helper.rb Merge branch 'mr-close-btn' into 'master' 2016-07-11 18:00:55 +00:00
milestones_helper.rb Fixes for MR comments. 2016-06-09 00:04:46 +03:00
namespaces_helper.rb
nav_helper.rb Clicking body closes nav 2016-06-15 18:33:18 +01:00
notes_helper.rb Do not set `@use_legacy_diff_notes` 2016-07-07 23:44:04 +00:00
notifications_helper.rb merge master into issue_3359_3 2016-06-29 11:04:18 -03:00
page_layout_helper.rb Enable Style/SpaceAfterComma Rubocop cop 2016-06-29 15:23:44 +02:00
preferences_helper.rb
projects_helper.rb Show last push widget in upstream after push to fork 2016-07-06 12:58:57 -05:00
runners_helper.rb
search_helper.rb Update the help_page_path route to accept paths directly instead of using parameters. 2016-07-11 12:55:25 -06:00
selects_helper.rb
snippets_helper.rb
sorting_helper.rb Sort by label priority 2016-06-06 11:59:49 -05:00
submodule_helper.rb
tab_helper.rb Use start_with? instead of regex 2016-05-24 00:23:23 +02:00
tags_helper.rb
time_helper.rb Change 3600 to 1.hour 2016-07-07 16:48:10 -05:00
todos_helper.rb Merge branch 'approval-required-todo' into 'master' 2016-07-12 19:50:33 +00:00
tree_helper.rb
triggers_helper.rb
version_check_helper.rb
visibility_level_helper.rb
workhorse_helper.rb Merge branch 'send-entry-via-Gitlab-Workhorse-Send-Data' into 'master' 2016-07-11 16:18:37 +00:00