hyrax 2.1.0.beta1 → 2.1.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (348) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +9 -49
  3. data/.rubocop_fixme.yml +1 -0
  4. data/.travis.yml +1 -1
  5. data/Gemfile +3 -3
  6. data/README.md +4 -2
  7. data/app/actors/hyrax/actors/file_set_actor.rb +0 -1
  8. data/app/actors/hyrax/actors/interpret_visibility_actor.rb +1 -3
  9. data/app/actors/hyrax/actors/model_actor.rb +4 -0
  10. data/app/assets/javascripts/hyrax.js +1 -1
  11. data/app/assets/javascripts/hyrax/app.js.erb +1 -1
  12. data/app/assets/javascripts/hyrax/authority_select.es6 +15 -7
  13. data/app/assets/javascripts/hyrax/collections.js +188 -9
  14. data/app/assets/javascripts/hyrax/content_blocks.js +13 -1
  15. data/app/assets/javascripts/hyrax/editor.es6 +2 -1
  16. data/app/assets/javascripts/hyrax/proxy_rights.js +2 -2
  17. data/app/assets/javascripts/hyrax/turbolinks_events.js +5 -0
  18. data/app/assets/stylesheets/hyrax/_accessibility.scss +21 -0
  19. data/app/assets/stylesheets/hyrax/_catalog.scss +21 -16
  20. data/app/assets/stylesheets/hyrax/_collections.scss +48 -7
  21. data/app/assets/stylesheets/hyrax/_modal.scss +4 -0
  22. data/app/assets/stylesheets/hyrax/_settings.scss +1 -1
  23. data/app/assets/stylesheets/hyrax/dashboard.scss +0 -1
  24. data/app/controllers/concerns/hyrax/breadcrumbs.rb +3 -1
  25. data/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb +17 -1
  26. data/app/controllers/concerns/hyrax/leases_controller_behavior.rb +10 -0
  27. data/app/controllers/concerns/hyrax/local_file_downloads_controller_behavior.rb +86 -0
  28. data/app/controllers/concerns/hyrax/works_controller_behavior.rb +14 -11
  29. data/app/controllers/hyrax/admin/collection_types_controller.rb +11 -1
  30. data/app/controllers/hyrax/api/items_controller.rb +2 -6
  31. data/app/controllers/hyrax/batch_edits_controller.rb +6 -0
  32. data/app/controllers/hyrax/batch_uploads_controller.rb +1 -1
  33. data/app/controllers/hyrax/dashboard/collections_controller.rb +4 -7
  34. data/app/controllers/hyrax/dashboard/profiles_controller.rb +2 -0
  35. data/app/controllers/hyrax/dashboard_controller.rb +2 -2
  36. data/app/controllers/hyrax/depositors_controller.rb +19 -0
  37. data/app/controllers/hyrax/downloads_controller.rb +3 -4
  38. data/app/controllers/hyrax/embargoes_controller.rb +2 -0
  39. data/app/controllers/hyrax/file_sets_controller.rb +12 -0
  40. data/app/controllers/hyrax/leases_controller.rb +2 -0
  41. data/app/controllers/hyrax/my/works_controller.rb +9 -0
  42. data/app/controllers/hyrax/my_controller.rb +0 -1
  43. data/app/controllers/hyrax/transfers_controller.rb +1 -3
  44. data/app/controllers/hyrax/users_controller.rb +1 -3
  45. data/app/forms/hyrax/forms/admin/collection_type_form.rb +1 -1
  46. data/app/forms/hyrax/forms/permission_template_form.rb +1 -4
  47. data/app/forms/hyrax/forms/work_form.rb +1 -3
  48. data/app/helpers/hyrax/citations_behaviors/common_behavior.rb +1 -3
  49. data/app/helpers/hyrax/citations_behaviors/formatters/chicago_formatter.rb +1 -5
  50. data/app/helpers/hyrax/collections_helper.rb +7 -4
  51. data/app/helpers/hyrax/file_set_helper.rb +0 -1
  52. data/app/helpers/hyrax/hyrax_helper_behavior.rb +0 -1
  53. data/app/helpers/hyrax/trophy_helper.rb +0 -1
  54. data/app/indexers/hyrax/admin_set_indexer.rb +2 -0
  55. data/app/inputs/multi_value_select_input.rb +1 -3
  56. data/app/jobs/attach_files_to_work_job.rb +5 -1
  57. data/app/jobs/import_url_job.rb +9 -8
  58. data/app/models/admin_set.rb +1 -5
  59. data/app/models/concerns/hyrax/ability.rb +3 -4
  60. data/app/models/concerns/hyrax/collection_behavior.rb +0 -4
  61. data/app/models/concerns/hyrax/collection_nesting.rb +12 -0
  62. data/app/models/concerns/hyrax/suppressible.rb +1 -5
  63. data/app/models/featured_work_list.rb +1 -3
  64. data/app/models/hyrax/collection_type.rb +3 -2
  65. data/app/models/hyrax/permission_template_access.rb +6 -4
  66. data/app/models/proxy_deposit_request.rb +1 -1
  67. data/app/presenters/hyrax/collection_presenter.rb +0 -24
  68. data/app/presenters/hyrax/displays_image.rb +1 -1
  69. data/app/presenters/hyrax/file_set_presenter.rb +1 -1
  70. data/app/presenters/hyrax/menu_presenter.rb +1 -1
  71. data/app/presenters/hyrax/work_show_presenter.rb +15 -10
  72. data/app/search_builders/hyrax/abstract_type_relation.rb +2 -1
  73. data/app/search_builders/hyrax/collection_member_search_builder.rb +1 -1
  74. data/app/search_builders/hyrax/dashboard/collections_search_builder.rb +3 -1
  75. data/app/search_builders/hyrax/parent_collection_search_builder.rb +2 -2
  76. data/app/services/hyrax/admin_set_create_service.rb +1 -3
  77. data/app/services/hyrax/analytics.rb +1 -3
  78. data/app/services/hyrax/collection_member_service.rb +6 -5
  79. data/app/services/hyrax/collection_types/create_service.rb +37 -10
  80. data/app/services/hyrax/collections/permissions_create_service.rb +1 -3
  81. data/app/services/hyrax/collections/permissions_service.rb +6 -4
  82. data/app/views/catalog/_index_header_list_collection.html.erb +1 -1
  83. data/app/views/catalog/_index_header_list_default.html.erb +1 -1
  84. data/app/views/catalog/_index_list_default.html.erb +6 -10
  85. data/app/views/catalog/_search_form.html.erb +10 -11
  86. data/app/views/catalog/_thumbnail_list_collection.html.erb +1 -1
  87. data/app/views/catalog/_thumbnail_list_default.html.erb +1 -1
  88. data/app/views/hyrax/admin/admin_sets/_form.html.erb +1 -1
  89. data/app/views/hyrax/admin/admin_sets/_form_participant_table.html.erb +1 -1
  90. data/app/views/hyrax/admin/admin_sets/_form_participants.html.erb +1 -1
  91. data/app/views/hyrax/admin/admin_sets/_form_visibility.html.erb +3 -3
  92. data/app/views/hyrax/admin/admin_sets/_show_document_list_row.html.erb +2 -2
  93. data/app/views/hyrax/admin/admin_sets/index.html.erb +1 -1
  94. data/app/views/hyrax/admin/appearances/show.html.erb +4 -4
  95. data/app/views/hyrax/admin/collection_types/_form_settings.html.erb +3 -2
  96. data/app/views/hyrax/admin/collection_types/index.html.erb +2 -2
  97. data/app/views/hyrax/admin/features/index.html.erb +2 -4
  98. data/app/views/hyrax/admin/stats/_date_form.html.erb +3 -3
  99. data/app/views/hyrax/admin/stats/_top_data.html.erb +1 -1
  100. data/app/views/hyrax/admin/stats/show.html.erb +1 -1
  101. data/app/views/hyrax/admin/workflows/index.html.erb +0 -1
  102. data/app/views/hyrax/base/_file_manager_actions.html.erb +2 -2
  103. data/app/views/hyrax/base/_file_manager_member.html.erb +1 -1
  104. data/app/views/hyrax/base/_form_child_work_relationships.html.erb +1 -2
  105. data/app/views/hyrax/base/_form_files.html.erb +3 -3
  106. data/app/views/hyrax/base/_form_member_of_collections.html.erb +1 -2
  107. data/app/views/hyrax/base/_form_progress.html.erb +3 -3
  108. data/app/views/hyrax/base/_form_relationships.html.erb +2 -3
  109. data/app/views/hyrax/base/_form_representative.html.erb +0 -1
  110. data/app/views/hyrax/base/_form_share.html.erb +1 -3
  111. data/app/views/hyrax/base/_form_thumbnail.html.erb +0 -1
  112. data/app/views/hyrax/base/_form_visibility_component.html.erb +6 -6
  113. data/app/views/hyrax/base/_relationships_parent_rows.html.erb +3 -1
  114. data/app/views/hyrax/base/_representative_media.html.erb +1 -1
  115. data/app/views/hyrax/base/_share_with.html.erb +3 -3
  116. data/app/views/hyrax/base/_show_actions.html.erb +14 -1
  117. data/app/views/hyrax/base/_social_media.html.erb +5 -5
  118. data/app/views/hyrax/base/_work_title.erb +3 -1
  119. data/app/views/hyrax/base/_workflow_actions.html.erb +1 -1
  120. data/app/views/hyrax/base/inspect_work.html.erb +1 -1
  121. data/app/views/hyrax/base/show.html.erb +2 -2
  122. data/app/views/hyrax/batch_edits/_check_all.html.erb +2 -2
  123. data/app/views/hyrax/batch_edits/edit.html.erb +47 -44
  124. data/app/views/hyrax/batch_select/_add_button.html.erb +2 -2
  125. data/app/views/hyrax/citations/work.html.erb +3 -3
  126. data/app/views/hyrax/collections/_collection.html.erb +1 -1
  127. data/app/views/hyrax/collections/_default_group.html.erb +1 -1
  128. data/app/views/hyrax/collections/_list_collections.html.erb +2 -2
  129. data/app/views/hyrax/collections/_list_works.html.erb +1 -1
  130. data/app/views/hyrax/collections/_show_descriptions.html.erb +6 -6
  131. data/app/views/hyrax/collections/_show_document_list_row.html.erb +2 -2
  132. data/app/views/hyrax/collections/_show_parent_collections.html.erb +11 -38
  133. data/app/views/hyrax/collections/_sort_and_per_page.html.erb +13 -13
  134. data/app/views/hyrax/collections/_subcollection_list.html.erb +1 -1
  135. data/app/views/hyrax/collections/_view_type_group.html.erb +1 -1
  136. data/app/views/hyrax/collections/show.html.erb +122 -122
  137. data/app/views/hyrax/content_blocks/_form.html.erb +13 -12
  138. data/app/views/hyrax/content_blocks/_modal_content_block.html.erb +15 -0
  139. data/app/views/hyrax/dashboard/_index_partials/_proxy_rights.html.erb +25 -19
  140. data/app/views/hyrax/dashboard/_sidebar.html.erb +1 -1
  141. data/app/views/hyrax/dashboard/collections/_button_for_remove_selected_from_collection.html.erb +1 -1
  142. data/app/views/hyrax/dashboard/collections/_collection_title.html.erb +16 -16
  143. data/app/views/hyrax/dashboard/collections/_form.html.erb +3 -1
  144. data/app/views/hyrax/dashboard/collections/_form_branding.html.erb +11 -11
  145. data/app/views/hyrax/dashboard/collections/_form_default_group_delt.html.erb +1 -1
  146. data/app/views/hyrax/dashboard/collections/_form_discovery.html.erb +2 -2
  147. data/app/views/hyrax/dashboard/collections/_form_for_select_collection.html.erb +4 -4
  148. data/app/views/hyrax/dashboard/collections/_form_share.html.erb +51 -44
  149. data/app/views/hyrax/dashboard/collections/_form_share_table.html.erb +2 -2
  150. data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +4 -4
  151. data/app/views/hyrax/dashboard/collections/_list_works.html.erb +1 -1
  152. data/app/views/hyrax/dashboard/collections/_modal_remove_from_collection.html.erb +10 -5
  153. data/app/views/hyrax/dashboard/collections/_modal_remove_sub_collection.html.erb +10 -5
  154. data/app/views/hyrax/dashboard/collections/_show_actions.html.erb +1 -1
  155. data/app/views/hyrax/dashboard/collections/_show_add_items_actions.html.erb +2 -2
  156. data/app/views/hyrax/dashboard/collections/_show_document_list_row.html.erb +2 -2
  157. data/app/views/hyrax/dashboard/collections/_show_parent_collection_row.html.erb +10 -5
  158. data/app/views/hyrax/dashboard/collections/_show_parent_collections.html.erb +11 -34
  159. data/app/views/hyrax/dashboard/collections/_sort_and_per_page.html.erb +1 -1
  160. data/app/views/hyrax/dashboard/collections/_subcollection_list.html.erb +23 -17
  161. data/app/views/hyrax/dashboard/collections/show.html.erb +6 -6
  162. data/app/views/hyrax/dashboard/profiles/_edit_primary.html.erb +0 -4
  163. data/app/views/hyrax/dashboard/profiles/_trophy_edit.html.erb +16 -14
  164. data/app/views/hyrax/dashboard/profiles/show.html.erb +6 -0
  165. data/app/views/hyrax/dashboard/show_admin.html.erb +19 -3
  166. data/app/views/hyrax/dashboard/sidebar/_activity.html.erb +6 -0
  167. data/app/views/hyrax/dashboard/works/_list_works.html.erb +1 -1
  168. data/app/views/hyrax/depositors/index.html.erb +13 -0
  169. data/app/views/hyrax/embargoes/_list_expired_active_embargoes.html.erb +1 -1
  170. data/app/views/hyrax/embargoes/edit.html.erb +47 -35
  171. data/app/views/hyrax/embargoes/index.html.erb +6 -7
  172. data/app/views/hyrax/file_sets/_actions.html.erb +6 -2
  173. data/app/views/hyrax/file_sets/_extra_fields_modal.html.erb +3 -3
  174. data/app/views/hyrax/file_sets/_groups_description.html.erb +0 -1
  175. data/app/views/hyrax/file_sets/_permission_form.html.erb +3 -3
  176. data/app/views/hyrax/file_sets/edit.html.erb +24 -20
  177. data/app/views/hyrax/file_sets/media_display/_audio.html.erb +23 -6
  178. data/app/views/hyrax/file_sets/media_display/_default.html.erb +1 -1
  179. data/app/views/hyrax/file_sets/media_display/_video.html.erb +23 -6
  180. data/app/views/hyrax/leases/_list_expired_active_leases.html.erb +1 -1
  181. data/app/views/hyrax/leases/edit.html.erb +47 -35
  182. data/app/views/hyrax/leases/index.html.erb +6 -6
  183. data/app/views/hyrax/my/_collection_action_menu.html.erb +1 -1
  184. data/app/views/hyrax/my/_facet_limit.html.erb +1 -2
  185. data/app/views/hyrax/my/_facet_pagination.html.erb +6 -6
  186. data/app/views/hyrax/my/_facet_pivot.html.erb +1 -1
  187. data/app/views/hyrax/my/_results_pagination.html.erb +1 -1
  188. data/app/views/hyrax/my/collections/_facets.html.erb +1 -1
  189. data/app/views/hyrax/my/collections/_list_collections.html.erb +5 -5
  190. data/app/views/hyrax/my/collections/_modal_add_subcollection.html.erb +3 -2
  191. data/app/views/hyrax/my/collections/_modal_add_to_collection.html.erb +3 -1
  192. data/app/views/hyrax/my/collections/_modal_add_to_collection_permission_deny.html.erb +1 -1
  193. data/app/views/hyrax/my/collections/_modal_collection_types_to_create.html.erb +2 -2
  194. data/app/views/hyrax/my/collections/_modal_delete_collection.html.erb +1 -2
  195. data/app/views/hyrax/my/collections/_modal_delete_deny.html.erb +1 -1
  196. data/app/views/hyrax/my/collections/_modal_delete_selected_collections.html.erb +2 -2
  197. data/app/views/hyrax/my/collections/_tabs.html.erb +2 -2
  198. data/app/views/hyrax/my/collections/index.html.erb +7 -3
  199. data/app/views/hyrax/my/facet.html.erb +1 -1
  200. data/app/views/hyrax/my/index.html.erb +6 -2
  201. data/app/views/hyrax/my/works/_facets.html.erb +1 -1
  202. data/app/views/hyrax/my/works/_list_works.html.erb +1 -1
  203. data/app/views/hyrax/my/works/_tabs.html.erb +2 -2
  204. data/app/views/hyrax/my/works/index.html.erb +6 -2
  205. data/app/views/hyrax/notifications/_notifications.html.erb +1 -1
  206. data/app/views/hyrax/pages/_form.html.erb +12 -12
  207. data/app/views/hyrax/pages/show.html.erb +1 -1
  208. data/app/views/hyrax/single_use_links_viewer/show.html.erb +1 -1
  209. data/app/views/hyrax/stats/file.html.erb +6 -2
  210. data/app/views/hyrax/stats/work.html.erb +6 -2
  211. data/app/views/hyrax/transfers/_received.html.erb +6 -6
  212. data/app/views/hyrax/transfers/_sent.html.erb +2 -2
  213. data/app/views/hyrax/transfers/new.html.erb +0 -1
  214. data/app/views/hyrax/users/_activity_log.html.erb +2 -2
  215. data/app/views/hyrax/users/_profile_tabs.html.erb +1 -1
  216. data/app/views/hyrax/users/_search_form.html.erb +1 -1
  217. data/app/views/hyrax/users/_user.html.erb +0 -1
  218. data/app/views/hyrax/users/index.html.erb +1 -1
  219. data/app/views/kaminari/blacklight_compact/_paginator.html.erb +1 -2
  220. data/app/views/layouts/_head_tag_content.html.erb +2 -2
  221. data/app/views/layouts/error.html.erb +1 -1
  222. data/app/views/layouts/hyrax.html.erb +6 -3
  223. data/app/views/layouts/hyrax/dashboard.html.erb +6 -3
  224. data/app/views/records/show_fields/_based_near.html.erb +0 -1
  225. data/app/views/records/show_fields/_contributor.html.erb +0 -1
  226. data/app/views/records/show_fields/_date_created.html.erb +0 -1
  227. data/app/views/records/show_fields/_description.html.erb +1 -1
  228. data/app/views/records/show_fields/_identifier.html.erb +0 -1
  229. data/app/views/records/show_fields/_language.html.erb +0 -1
  230. data/app/views/records/show_fields/_publisher.html.erb +0 -1
  231. data/app/views/records/show_fields/_related_url.html.erb +0 -1
  232. data/app/views/records/show_fields/_resource_type.html.erb +0 -1
  233. data/app/views/records/show_fields/_subject.html.erb +0 -1
  234. data/app/views/shared/_citations.html.erb +17 -17
  235. data/app/views/shared/_select_work_type_modal.html.erb +2 -2
  236. data/config/locales/hyrax.de.yml +198 -189
  237. data/config/locales/hyrax.en.yml +21 -14
  238. data/config/locales/hyrax.es.yml +9 -0
  239. data/config/locales/hyrax.fr.yml +9 -0
  240. data/config/locales/hyrax.it.yml +9 -0
  241. data/config/locales/hyrax.pt-BR.yml +9 -0
  242. data/config/locales/hyrax.zh.yml +9 -0
  243. data/config/routes.rb +1 -0
  244. data/hyrax.gemspec +7 -18
  245. data/lib/generators/hyrax/models_generator.rb +0 -1
  246. data/lib/generators/hyrax/templates/db/migrate/20180302200051_add_branding_to_collection_type.rb.erb +5 -0
  247. data/lib/generators/hyrax/work/templates/feature_spec.rb.erb +1 -1
  248. data/lib/hyrax/configuration.rb +2 -4
  249. data/lib/hyrax/engine.rb +22 -4
  250. data/lib/hyrax/version.rb +1 -1
  251. data/spec/actors/hyrax/actors/lease_actor_spec.rb +16 -0
  252. data/spec/controllers/hyrax/admin/appearances_controller_spec.rb +1 -1
  253. data/spec/controllers/hyrax/admin/collection_types_controller_spec.rb +2 -0
  254. data/spec/controllers/hyrax/admin/features_controller_spec.rb +1 -1
  255. data/spec/controllers/hyrax/admin/workflow_roles_controller_spec.rb +1 -1
  256. data/spec/controllers/hyrax/admin/workflows_controller_spec.rb +1 -1
  257. data/spec/controllers/hyrax/batch_edits_controller_spec.rb +14 -1
  258. data/spec/controllers/hyrax/batch_uploads_controller_spec.rb +2 -2
  259. data/spec/controllers/hyrax/citations_controller_spec.rb +4 -2
  260. data/spec/controllers/hyrax/collections_controller_spec.rb +32 -4
  261. data/spec/controllers/hyrax/content_blocks_controller_spec.rb +1 -1
  262. data/spec/controllers/hyrax/dashboard/collections_controller_spec.rb +11 -6
  263. data/spec/controllers/hyrax/depositors_controller_spec.rb +11 -0
  264. data/spec/controllers/hyrax/downloads_controller_spec.rb +42 -0
  265. data/spec/controllers/hyrax/embargoes_controller_spec.rb +40 -1
  266. data/spec/controllers/hyrax/file_sets_controller_spec.rb +10 -2
  267. data/spec/controllers/hyrax/generic_works_controller_spec.rb +38 -6
  268. data/spec/controllers/hyrax/leases_controller_spec.rb +11 -0
  269. data/spec/controllers/hyrax/my/collections_controller_spec.rb +1 -1
  270. data/spec/controllers/hyrax/my/works_controller_spec.rb +1 -1
  271. data/spec/controllers/hyrax/pages_controller_spec.rb +1 -1
  272. data/spec/controllers/hyrax/stats_controller_spec.rb +2 -0
  273. data/spec/controllers/hyrax/transfers_controller_spec.rb +1 -1
  274. data/spec/factories/collection_types.rb +10 -1
  275. data/spec/factories/collections.rb +5 -3
  276. data/spec/factories/collections_factory.rb +3 -3
  277. data/spec/factories/file_sets.rb +2 -6
  278. data/spec/factories/generic_works.rb +68 -4
  279. data/spec/factory_tests/collections_factory_spec.rb +2 -1
  280. data/spec/features/batch_create_spec.rb +60 -0
  281. data/spec/features/batch_edit_spec.rb +1 -0
  282. data/spec/features/browse_dashboard_works_spec.rb +1 -0
  283. data/spec/features/collection_multi_membership_spec.rb +9 -6
  284. data/spec/features/collection_spec.rb +1 -1
  285. data/spec/features/collection_type_spec.rb +49 -1
  286. data/spec/features/create_work_admin_spec.rb +2 -2
  287. data/spec/features/create_work_spec.rb +1 -0
  288. data/spec/features/dashboard/all_works.rb +10 -2
  289. data/spec/features/dashboard/collection_spec.rb +38 -17
  290. data/spec/features/dashboard/display_admin_dashboard_spec.rb +29 -0
  291. data/spec/features/dashboard/display_dashboard_spec.rb +1 -1
  292. data/spec/features/edit_content_block_admin_spec.rb +45 -0
  293. data/spec/features/edit_work_spec.rb +40 -2
  294. data/spec/features/ownership_transfer_spec.rb +1 -0
  295. data/spec/features/proxy_spec.rb +2 -2
  296. data/spec/features/search_spec.rb +2 -5
  297. data/spec/features/work_show_spec.rb +14 -4
  298. data/spec/forms/hyrax/forms/admin/collection_type_form_spec.rb +1 -0
  299. data/spec/forms/hyrax/forms/collection_form_spec.rb +1 -1
  300. data/spec/helpers/hyrax/ability_helper_spec.rb +2 -2
  301. data/spec/helpers/hyrax/collections_helper_spec.rb +12 -4
  302. data/spec/javascripts/authority_select_spec.js +1 -1
  303. data/spec/javascripts/settings_spec.js +1 -0
  304. data/spec/jobs/attach_files_to_work_job_spec.rb +13 -0
  305. data/spec/jobs/import_url_job_spec.rb +14 -0
  306. data/spec/models/collection_spec.rb +1 -0
  307. data/spec/models/concerns/hyrax/collection_nesting_spec.rb +16 -0
  308. data/spec/models/hyrax/collection_type_spec.rb +1 -0
  309. data/spec/presenters/hyrax/collection_presenter_spec.rb +1 -100
  310. data/spec/presenters/hyrax/file_set_presenter_spec.rb +17 -2
  311. data/spec/presenters/hyrax/menu_presenter_spec.rb +6 -0
  312. data/spec/presenters/hyrax/work_show_presenter_spec.rb +15 -3
  313. data/spec/search_builders/hyrax/abstract_type_relation_spec.rb +18 -0
  314. data/spec/search_builders/hyrax/dashboard/collections_search_builder_spec.rb +30 -19
  315. data/spec/search_builders/hyrax/parent_collection_search_builder_spec.rb +15 -0
  316. data/spec/services/hyrax/collection_member_service_spec.rb +10 -19
  317. data/spec/services/hyrax/collection_types/create_service_spec.rb +35 -2
  318. data/spec/services/hyrax/collections/collection_member_service_spec.rb +1 -1
  319. data/spec/services/hyrax/qa_select_service_spec.rb +0 -1
  320. data/spec/support/selectors.rb +15 -0
  321. data/spec/views/hyrax/admin/admin_sets/_show_document_list_row.html.erb_spec.rb +2 -0
  322. data/spec/views/hyrax/admin/collection_types/_form_settings.html.erb_spec.rb +1 -0
  323. data/spec/views/hyrax/admin/stats/show.html.erb_spec.rb +9 -0
  324. data/spec/views/hyrax/base/_attributes.html.erb_spec.rb +1 -1
  325. data/spec/views/hyrax/base/_relationships.html.erb_spec.rb +13 -1
  326. data/spec/views/hyrax/base/_show_actions.html.erb_spec.rb +10 -0
  327. data/spec/views/hyrax/base/show.html.erb_spec.rb +8 -0
  328. data/spec/views/hyrax/collections/_show_parent_collections.html.erb_spec.rb +3 -53
  329. data/spec/views/hyrax/dashboard/_sidebar.html.erb_spec.rb +22 -0
  330. data/spec/views/hyrax/dashboard/collections/_form_share.erb_spec.rb +2 -1
  331. data/spec/views/hyrax/dashboard/collections/_show_actions.html.erb_spec.rb +13 -0
  332. data/spec/views/hyrax/dashboard/collections/_show_parent_collection_row.html.erb_spec.rb +26 -8
  333. data/spec/views/hyrax/dashboard/collections/_show_parent_collections.html.erb_spec.rb +7 -43
  334. data/spec/views/hyrax/dashboard/collections/_subcollection_list.html.erb_spec.rb +13 -1
  335. data/spec/views/hyrax/dashboard/collections/show.html.erb_spec.rb +1 -0
  336. data/spec/views/hyrax/dashboard/profiles/_trophy_edit.html.erb_spec.rb +36 -0
  337. data/spec/views/hyrax/dashboard/profiles/edit.html.erb_spec.rb +0 -38
  338. data/spec/views/hyrax/dashboard/profiles/show.html.erb_spec.rb +37 -0
  339. data/spec/views/hyrax/depositors/index.html.erb_spec.rb +13 -0
  340. data/spec/views/hyrax/file_sets/_actions.html.erb_spec.rb +15 -0
  341. data/spec/views/hyrax/file_sets/media_display/_audio.html.erb_spec.rb +29 -0
  342. data/spec/views/hyrax/file_sets/media_display/_default.html.erb_spec.rb +1 -1
  343. data/spec/views/hyrax/file_sets/media_display/_video.html.erb_spec.rb +29 -0
  344. data/spec/views/hyrax/my/collections/_list_collections.html.erb_spec.rb +6 -2
  345. data/tasks/hyrax_dev.rake +1 -3
  346. data/template.rb +1 -1
  347. metadata +49 -41
  348. data/app/assets/javascripts/hyrax/collections_forms.js +0 -108
@@ -1,6 +1,5 @@
1
1
  module Hyrax
2
2
  module TrophyHelper
3
- # rubocop:disable Metrics/MethodLength
4
3
  def display_trophy_link(user, id, args = {}, &_block)
5
4
  return unless user
6
5
  trophy = user.trophies.where(work_id: id).exists?
@@ -2,6 +2,8 @@ module Hyrax
2
2
  class AdminSetIndexer < ActiveFedora::IndexingService
3
3
  include Hyrax::IndexesThumbnails
4
4
 
5
+ self.thumbnail_path_service = Hyrax::CollectionThumbnailPathService
6
+
5
7
  def generate_solr_document
6
8
  super.tap do |solr_doc|
7
9
  # Makes Admin Sets show under the "Admin Sets" tab
@@ -39,9 +39,7 @@ class MultiValueSelectInput < MultiValueInput
39
39
  def build_field(value, index)
40
40
  render_options = select_options
41
41
  html_options = build_field_options(value)
42
- if options[:item_helper]
43
- (render_options, html_options) = options[:item_helper].call(value, index, render_options, html_options)
44
- end
42
+ (render_options, html_options) = options[:item_helper].call(value, index, render_options, html_options) if options[:item_helper]
45
43
  template.select_tag(attribute_name, template.options_for_select(render_options, value), html_options)
46
44
  end
47
45
  end
@@ -6,7 +6,11 @@ class AttachFilesToWorkJob < Hyrax::ApplicationJob
6
6
  # @param [Array<Hyrax::UploadedFile>] uploaded_files - an array of files to attach
7
7
  def perform(work, uploaded_files, **work_attributes)
8
8
  validate_files!(uploaded_files)
9
- user = User.find_by_user_key(work.depositor) # BUG? file depositor ignored
9
+ # When running as a background job (as opposed to running inline), a work with files attached
10
+ # by a proxy user will set the depositor as the intended user that the proxy user was depositing on
11
+ # behalf of. See ticket #2764.
12
+ depositor = work.on_behalf_of || work.depositor
13
+ user = User.find_by_user_key(depositor)
10
14
  work_permissions = work.permissions.map(&:to_hash)
11
15
  metadata = visibility_attributes(work_attributes)
12
16
  uploaded_files.each do |uploaded_file|
@@ -49,15 +49,16 @@ class ImportUrlJob < Hyrax::ApplicationJob
49
49
  # @yield [IO] the stream to write to
50
50
  def copy_remote_file(uri)
51
51
  filename = File.basename(uri.path)
52
- Dir.mktmpdir do |dir|
53
- File.open(File.join(dir, filename), 'wb') do |f|
54
- retriever = BrowseEverything::Retriever.new
55
- retriever.retrieve('url' => uri) do |chunk|
56
- f.write(chunk)
57
- end
58
- f.rewind
59
- yield f
52
+ dir = Dir.mktmpdir
53
+ Rails.logger.debug("ImportUrlJob: Copying <#{uri}> to #{dir}")
54
+ File.open(File.join(dir, filename), 'wb') do |f|
55
+ retriever = BrowseEverything::Retriever.new
56
+ retriever.retrieve('url' => uri) do |chunk|
57
+ f.write(chunk)
60
58
  end
59
+ f.rewind
60
+ yield f
61
61
  end
62
+ Rails.logger.debug("ImportUrlJob: Closing #{File.join(dir, filename)}")
62
63
  end
63
64
  end
@@ -38,8 +38,6 @@ class AdminSet < ActiveFedora::Base
38
38
  property :creator, predicate: ::RDF::Vocab::DC11.creator do |index|
39
39
  index.as :symbol
40
40
  end
41
-
42
- # rubocop:disable Rails/HasManyOrHasOneDependent
43
41
  has_many :members,
44
42
  predicate: Hyrax.config.admin_set_predicate,
45
43
  class_name: 'ActiveFedora::Base'
@@ -58,9 +56,7 @@ class AdminSet < ActiveFedora::Base
58
56
 
59
57
  # Creates the default AdminSet and an associated PermissionTemplate with workflow
60
58
  def self.find_or_create_default_admin_set_id
61
- unless exists?(DEFAULT_ID)
62
- Hyrax::AdminSetCreateService.create_default_admin_set(admin_set_id: DEFAULT_ID, title: DEFAULT_TITLE)
63
- end
59
+ Hyrax::AdminSetCreateService.create_default_admin_set(admin_set_id: DEFAULT_ID, title: DEFAULT_TITLE) unless exists?(DEFAULT_ID)
64
60
  DEFAULT_ID
65
61
  end
66
62
 
@@ -9,9 +9,10 @@ module Hyrax
9
9
  include Hyrax::Ability::PermissionTemplateAbility
10
10
  include Hyrax::Ability::SolrDocumentAbility
11
11
 
12
- class_attribute :admin_group_name, :registered_group_name
12
+ class_attribute :admin_group_name, :registered_group_name, :public_group_name
13
13
  self.admin_group_name = 'admin'
14
14
  self.registered_group_name = 'registered'
15
+ self.public_group_name = 'public' # TODO: find hard coded values and replace with this
15
16
  self.ability_logic += [:admin_permissions,
16
17
  :curation_concerns_permissions,
17
18
  :operation_abilities,
@@ -112,9 +113,7 @@ module Hyrax
112
113
  end
113
114
  end
114
115
 
115
- if Flipflop.proxy_deposit? && registered_user?
116
- can :create, ProxyDepositRequest
117
- end
116
+ can :create, ProxyDepositRequest if Flipflop.proxy_deposit? && registered_user?
118
117
 
119
118
  can :accept, ProxyDepositRequest, receiving_user_id: current_user.id, status: 'pending'
120
119
  can :reject, ProxyDepositRequest, receiving_user_id: current_user.id, status: 'pending'
@@ -136,10 +136,6 @@ module Hyrax
136
136
  edit_groups: edit_groups,
137
137
  read_users: read_users,
138
138
  read_groups: read_groups)
139
- # added because the collection indexing happens before Hydra::AccessControls::Permission is
140
- # saved, and the after_update_index callback in the nested_relationship_reindexer removes the
141
- # permissions from the Solr document.
142
- update_index
143
139
  end
144
140
 
145
141
  private
@@ -13,8 +13,20 @@ module Hyrax
13
13
  define_model_callbacks :update_index, only: :after
14
14
  after_update_index :update_nested_collection_relationship_indices
15
15
  after_destroy :update_child_nested_collection_relationship_indices
16
+ before_save :before_update_nested_collection_relationship_indices
17
+ after_save :after_update_nested_collection_relationship_indices
18
+
19
+ def before_update_nested_collection_relationship_indices
20
+ @during_save = true
21
+ end
22
+
23
+ def after_update_nested_collection_relationship_indices
24
+ @during_save = false
25
+ Hyrax.config.nested_relationship_reindexer.call(id: id)
26
+ end
16
27
 
17
28
  def update_nested_collection_relationship_indices
29
+ return if @during_save
18
30
  Hyrax.config.nested_relationship_reindexer.call(id: id)
19
31
  end
20
32
 
@@ -15,11 +15,7 @@ module Hyrax
15
15
  # Override this method if you have some criteria by which records should not display in the search results.
16
16
  def suppressed?
17
17
  return false if state.nil?
18
- # This is a clumsy check only needed under RDF < 2.0 where there
19
- # is a bug with `AT::Resource#==`
20
- if RDF::VERSION.to_s < '2.0'
21
- return state.rdf_subject == Vocab::FedoraResourceStatus.inactive
22
- end
18
+
23
19
  state == Vocab::FedoraResourceStatus.inactive
24
20
  end
25
21
 
@@ -3,9 +3,7 @@ class FeaturedWorkList
3
3
 
4
4
  # @param [ActionController::Parameters] a collection of nested perameters
5
5
  def featured_works_attributes=(attributes_collection)
6
- if attributes_collection.respond_to?(:permitted?)
7
- attributes_collection = attributes_collection.to_h
8
- end
6
+ attributes_collection = attributes_collection.to_h if attributes_collection.respond_to?(:permitted?)
9
7
  attributes_collection = attributes_collection.sort_by { |i, _| i.to_i }.map { |_, attributes| attributes } if attributes_collection.is_a? Hash
10
8
  attributes_collection.each do |attributes|
11
9
  raise "Missing id" if attributes['id'].blank?
@@ -21,7 +21,7 @@ module Hyrax
21
21
  end
22
22
 
23
23
  class_attribute :collection_type_settings_methods, instance_writer: false
24
- self.collection_type_settings_methods = [:nestable?, :discoverable?, :sharable?, :share_applies_to_new_works?,
24
+ self.collection_type_settings_methods = [:nestable?, :discoverable?, :brandable?, :sharable?, :share_applies_to_new_works?,
25
25
  :allow_multiple_membership?, :require_membership?, :assigns_workflow?,
26
26
  :assigns_visibility?]
27
27
 
@@ -31,6 +31,7 @@ module Hyrax
31
31
  alias_attribute :multiple_membership, :allow_multiple_membership
32
32
  alias_attribute :workflow, :assigns_workflow
33
33
  alias_attribute :visibility, :assigns_visibility
34
+ alias_attribute :branding, :brandable
34
35
 
35
36
  # Find the collection type associated with the Global Identifier (gid)
36
37
  # @param [String] gid - Global Identifier for this collection_type (e.g. gid://internal/hyrax-collectiontype/3)
@@ -144,7 +145,7 @@ module Hyrax
144
145
  end
145
146
 
146
147
  def collection_type_settings_changed?
147
- (changes.keys & ['nestable', 'discoverable', 'sharable', 'share_applies_to_new_works', 'allow_multiple_membership',
148
+ (changes.keys & ['nestable', 'brandable', 'discoverable', 'sharable', 'share_applies_to_new_works', 'allow_multiple_membership',
148
149
  'require_membership', 'assigns_workflow', 'assigns_visibility']).any?
149
150
  end
150
151
 
@@ -29,13 +29,14 @@ module Hyrax
29
29
  #
30
30
  # @param access [Array<String>] one or more types of access (e.g. Hyrax::PermissionTemplateAccess::MANAGE, Hyrax::PermissionTemplateAccess::DEPOSIT, Hyrax::PermissionTemplateAccess::VIEW)
31
31
  # @param ability [Ability] the ability coming from cancan ability check
32
+ # @param exclude_groups [Array<String>] name of groups to exclude from the results
32
33
  # @return [ActiveRecord::Relation] relation of templates for which the user has specified roles
33
- def self.for_user(ability:, access:)
34
+ def self.for_user(ability:, access:, exclude_groups: [])
34
35
  PermissionTemplateAccess.where(
35
36
  user_where(access: access, ability: ability)
36
37
  ).or(
37
38
  PermissionTemplateAccess
38
- .where(group_where(access: access, ability: ability))
39
+ .where(group_where(access: access, ability: ability, exclude_groups: exclude_groups))
39
40
  )
40
41
  end
41
42
 
@@ -79,13 +80,14 @@ module Hyrax
79
80
  #
80
81
  # @param access [Array<String>] one or more types of access (e.g. Hyrax::PermissionTemplateAccess::MANAGE, Hyrax::PermissionTemplateAccess::DEPOSIT, Hyrax::PermissionTemplateAccess::VIEW)
81
82
  # @param ability [Ability] the cancan ability
83
+ # @param exclude_groups [Array<String>] name of groups to exclude from the results
82
84
  # @return [Hash] the where clause hash to pass to joins for groups
83
85
  # @note Several checks get the user's groups from the user's ability. The same values can be retrieved directly from a passed in ability.
84
86
  # If calling from Abilities, pass the ability. If you try to get the ability from the user, you end up in an infinit loop.
85
- def self.group_where(access:, ability:)
87
+ def self.group_where(access:, ability:, exclude_groups: [])
86
88
  where_clause = {}
87
89
  where_clause[:agent_type] = 'group'
88
- where_clause[:agent_id] = ability.user_groups
90
+ where_clause[:agent_id] = ability.user_groups - exclude_groups
89
91
  where_clause[:access] = access
90
92
  where_clause
91
93
  end
@@ -87,7 +87,7 @@ class ProxyDepositRequest < ActiveRecord::Base
87
87
  private
88
88
 
89
89
  def send_request_transfer_message_as_part_of_create
90
- user_link = link_to(sending_user.name, Hyrax::Engine.routes.url_helpers.user_path(sending_user.user_key))
90
+ user_link = link_to(sending_user.name, Hyrax::Engine.routes.url_helpers.user_path(sending_user))
91
91
  transfer_link = link_to('transfer requests', Hyrax::Engine.routes.url_helpers.transfers_path)
92
92
  message = "#{user_link} wants to transfer a work to you. Review all #{transfer_link}"
93
93
  Hyrax::MessengerService.deliver(::User.batch_user, receiving_user, message, "Ownership Change Request")
@@ -8,8 +8,6 @@ module Hyrax
8
8
  attr_accessor :parent_collections # This is expected to be a Blacklight::Solr::Response with all of the parent collections
9
9
  attr_writer :collection_type
10
10
 
11
- NUM_PARENTS_TO_SHOW = 3
12
-
13
11
  class_attribute :create_work_presenter_class
14
12
  self.create_work_presenter_class = Hyrax::SelectTypeListPresenter
15
13
 
@@ -96,28 +94,6 @@ module Hyrax
96
94
  parent_collections.nil? ? 0 : parent_collections.documents.size
97
95
  end
98
96
 
99
- # Of the number of parent collections shown on the current page, are there more to show?
100
- def more_parent_collections?
101
- parent_collection_count > NUM_PARENTS_TO_SHOW
102
- end
103
-
104
- # Are there few enough parent collections to use the more/less behavior?
105
- def use_parent_more_less?
106
- parent_collections.total_pages <= 1
107
- end
108
-
109
- # Returns a subset of parent collections that should be shown by default
110
- def visible_parent_collections
111
- return parent_collections.documents[0..NUM_PARENTS_TO_SHOW - 1] if more_parent_collections?
112
- parent_collections && parent_collections.documents || []
113
- end
114
-
115
- # Returns the remaining subset of parent collections that should not be shown by default
116
- def more_parent_collections
117
- return parent_collections.documents[NUM_PARENTS_TO_SHOW..parent_collection_count - 1] if more_parent_collections?
118
- []
119
- end
120
-
121
97
  def user_can_nest_collection?
122
98
  current_ability.can?(:deposit, solr_document)
123
99
  end
@@ -10,7 +10,7 @@ module Hyrax
10
10
  #
11
11
  # @return [IIIFManifest::DisplayImage] the display image required by the manifest builder.
12
12
  def display_image
13
- return nil unless ::FileSet.exists?(id) && solr_document.image?
13
+ return nil unless ::FileSet.exists?(id) && solr_document.image? && current_ability.can?(:read, id)
14
14
  # @todo this is slow, find a better way (perhaps index iiif url):
15
15
  original_file = ::FileSet.find(id).original_file
16
16
 
@@ -65,7 +65,7 @@ module Hyrax
65
65
  end
66
66
 
67
67
  def stats_path
68
- Hyrax::Engine.routes.url_helpers.stats_file_path(self)
68
+ Hyrax::Engine.routes.url_helpers.stats_file_path(self, locale: I18n.locale)
69
69
  end
70
70
 
71
71
  def events(size = 100)
@@ -35,7 +35,7 @@ module Hyrax
35
35
  # we're using a case here because we need to differentiate UsersControllers
36
36
  # in different namespaces (Hyrax & Admin)
37
37
  case controller
38
- when Hyrax::UsersController, Hyrax::NotificationsController, Hyrax::TransfersController
38
+ when Hyrax::UsersController, Hyrax::NotificationsController, Hyrax::TransfersController, Hyrax::DepositorsController
39
39
  true
40
40
  else
41
41
  false
@@ -28,7 +28,7 @@ module Hyrax
28
28
  end
29
29
 
30
30
  def page_title
31
- title.first
31
+ "#{human_readable_type} | #{title.first} | ID: #{id} | #{I18n.t('hyrax.product_name')}"
32
32
  end
33
33
 
34
34
  # CurationConcern methods
@@ -57,10 +57,8 @@ module Hyrax
57
57
 
58
58
  # @return [Boolean] render the UniversalViewer
59
59
  def universal_viewer?
60
- representative_id.present? &&
61
- representative_presenter.present? &&
62
- representative_presenter.image? &&
63
- Hyrax.config.iiif_image_server?
60
+ Hyrax.config.iiif_image_server? &&
61
+ members_include_viewable_image?
64
62
  end
65
63
 
66
64
  # @return FileSetPresenter presenter for the representative FileSets
@@ -81,7 +79,7 @@ module Hyrax
81
79
  # Get presenters for the collections this work is a member of via the member_of_collections association.
82
80
  # @return [Array<CollectionPresenter>] presenters
83
81
  def member_of_collection_presenters
84
- PresenterFactory.build_for(ids: member_of_collection_ids,
82
+ PresenterFactory.build_for(ids: member_of_authorized_parent_collections,
85
83
  presenter_class: collection_presenter_class,
86
84
  presenter_args: presenter_factory_arguments)
87
85
  end
@@ -145,7 +143,7 @@ module Hyrax
145
143
  end
146
144
 
147
145
  def stats_path
148
- Hyrax::Engine.routes.url_helpers.stats_work_path(self)
146
+ Hyrax::Engine.routes.url_helpers.stats_work_path(self, locale: I18n.locale)
149
147
  end
150
148
 
151
149
  def model
@@ -194,9 +192,7 @@ module Hyrax
194
192
  end
195
193
 
196
194
  def featured?
197
- if @featured.nil?
198
- @featured = FeaturedWork.where(work_id: solr_document.id).exists?
199
- end
195
+ @featured = FeaturedWork.where(work_id: solr_document.id).exists? if @featured.nil?
200
196
  @featured
201
197
  end
202
198
 
@@ -215,5 +211,14 @@ module Hyrax
215
211
  def graph
216
212
  GraphExporter.new(solr_document, request).fetch
217
213
  end
214
+
215
+ def member_of_authorized_parent_collections
216
+ # member_of_collection_ids with current_ability access
217
+ @member_of ||= Hyrax::CollectionMemberService.run(solr_document, current_ability).map(&:id)
218
+ end
219
+
220
+ def members_include_viewable_image?
221
+ file_set_presenters.any? { |presenter| presenter.image? && current_ability.can?(:read, presenter.id) }
222
+ end
218
223
  end
219
224
  end
@@ -16,7 +16,8 @@ module Hyrax
16
16
  clauses = allowable_types.map do |k|
17
17
  ActiveFedora::SolrQueryBuilder.construct_query_for_rel(has_model: k.to_s)
18
18
  end
19
- clauses.size == 1 ? clauses.first : "(#{clauses.join(' OR ')})"
19
+ # empty array returns nil, AF finder method handles it properly, see hyrax issue #2844
20
+ clauses.size <= 1 ? clauses.first : "(#{clauses.join(' OR ')})"
20
21
  end
21
22
 
22
23
  class DummyModel
@@ -5,7 +5,7 @@ module Hyrax
5
5
  attr_reader :collection, :search_includes_models
6
6
 
7
7
  class_attribute :collection_membership_field
8
- self.collection_membership_field = 'nesting_collection__parent_ids_ssim'
8
+ self.collection_membership_field = 'member_of_collection_ids_ssim'
9
9
 
10
10
  # Defines which search_params_logic should be used when searching for Collection members
11
11
  self.default_processor_chain += [:member_of_collection]
@@ -35,7 +35,9 @@ module Hyrax
35
35
  private
36
36
 
37
37
  def collection_ids_for_deposit
38
- Hyrax::Collections::PermissionsService.source_ids_for_deposit(ability: current_ability)
38
+ Hyrax::Collections::PermissionsService.source_ids_for_deposit(ability: current_ability,
39
+ exclude_groups: [::Ability.registered_group_name,
40
+ ::Ability.public_group_name])
39
41
  end
40
42
  end
41
43
  end
@@ -3,10 +3,10 @@ module Hyrax
3
3
  class ParentCollectionSearchBuilder < Hyrax::CollectionSearchBuilder
4
4
  delegate :item, to: :scope
5
5
 
6
- # include filters into the query to only include the collection memebers
6
+ # include filters into the query to only include the collections containing this item
7
7
  def include_item_ids(solr_parameters)
8
8
  solr_parameters[:fq] ||= []
9
- solr_parameters[:fq] << "child_object_ids_ssim:#{item.id}"
9
+ solr_parameters[:fq] << ActiveFedora::SolrQueryBuilder.construct_query_for_ids(item.member_of_collection_ids)
10
10
  end
11
11
  end
12
12
  end
@@ -72,9 +72,7 @@ module Hyrax
72
72
  { agent_type: 'group', agent_id: admin_group_name, access: Hyrax::PermissionTemplateAccess::MANAGE }
73
73
  ].tap do |attribute_list|
74
74
  # Grant manage access to the creating_user if it exists. Should exist for all but default Admin Set
75
- if creating_user
76
- attribute_list << { agent_type: 'user', agent_id: creating_user.user_key, access: Hyrax::PermissionTemplateAccess::MANAGE }
77
- end
75
+ attribute_list << { agent_type: 'user', agent_id: creating_user.user_key, access: Hyrax::PermissionTemplateAccess::MANAGE } if creating_user
78
76
  end
79
77
  end
80
78
 
@@ -57,9 +57,7 @@ module Hyrax
57
57
  end
58
58
 
59
59
  def self.auth_client(scope)
60
- unless File.exist?(config.privkey_path)
61
- raise "Private key file for Google analytics was expected at '#{config.privkey_path}', but no file was found."
62
- end
60
+ raise "Private key file for Google analytics was expected at '#{config.privkey_path}', but no file was found." unless File.exist?(config.privkey_path)
63
61
  private_key = File.read(config.privkey_path)
64
62
  Signet::OAuth2::Client.new token_credential_uri: 'https://accounts.google.com/o/oauth2/token',
65
63
  audience: 'https://accounts.google.com/o/oauth2/token',