-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue#dcc2983 - Fix for preventing adding a Contributor via Contributor #3071
Issue#dcc2983 - Fix for preventing adding a Contributor via Contributor #3071
Conversation
ce790e5
to
e747559
Compare
@briri & @raycarrick-ed This is attempt to address @briri comment #3062 (comment)
|
e747559
to
d6a81a8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @johnpinto1!
@briri I like you to double-check the logic as it took me trial and error to get it to what seemed like "work". Thanks. |
Hey @johnpinto1 upon further review and testing of different options I would suggest that we do the following:
|
Looks good overall. Rails.configuration.x.application.foobar.present? && Rails.configuration.x.application.foobar I think that is exactly the same as just Rails.configuration.x.application.foobar if it's not present it will return nil which is equivalent to false. That would cut out quite a few lines of code. |
And another thing ..... when this change comes through we will need to add in the 2 new config setting. Is there an easy way to track this? I could just add them in now on the assumption that they won't have any effect until this comes through or I could leave a note for myself to watch out for it but those both seem quite clumsy ways to do it. Either of you know a better way to handle something like this? |
@raycarrick-ed Adding the properties now seems a good idea. I have done something similar in another project to prevent forgetting about it in future. |
@raycarrick-ed & @briri I will look at it again. I had issues with Rails.configuration.x.application.foobar |
form for Plan based on whether email and/or name are required. Fix for DCC bug #2983 Changes: - Added two new properties to config/initializers/_dmproadmap.rb (both devault to false): config.x.application.require_contributor_name = false config.x.application.require_contributor_email = false -In Contributor model the private method name_or_email_presence() has been updated to take account of the above mentioned property settings.
d6a81a8
to
db783fc
Compare
@briri & @raycarrick-ed I have updated code based on your comments and my experimenting with nil (when a property is missing by usiing ! or !! (if I want current value or nil -> false)
|
pagination of user's plans broken. Fix for issue #3069 and DCC issue https://github.com/DigitalCurationCentre/DMPonline-Service/issues/675. Changes: - Replaced view files /paginable/plans/org_admin_other_user with /paginable/plans/_index.html.erb with extra checks for plan.owner.present? as missing plan.owner broke a DCC user's plans being render by org_admin. - Replaced partial with '/paginable/plans/org_admin_other_user' with '/paginable/plans/index', replaced action'org_admin_other_user' with 'index' in paginable_renderiser() method in views /org_admin/users/edit.html.erb. /org_admin/users/plans.html.erb and /super_admin/users/edit.html.erb. - In Paginable::PlansController replaced - # GET /paginable/plans/org_admin/:page with # GET /paginable/users/:id/plans associated with method org_admin_other_user() renamed index() - Routes replaced get "org_admin_other_user/:page", action: :org_admin_other_user, on: :collection, as: :org_admin_other_user # Paginable actions for users resources :users, only: [] do get "index/:page", action: :index, on: :collection, as: :index with resources :users, only: %i[index] do member do resources :plans, only: %(index) end end
… Org. Fixes issues: https://github.com/DigitalCurationCentre/DMPonline-Service/issues/592 https://github.com/DigitalCurationCentre/DMPonline-Service/issues/645 https://github.com/DigitalCurationCentre/DMPonline-Service/issues/641 The reason we are seeing deleted (de-activated) Plans is that there is no filter for plans with Roles active in the Org model's org_admin_plans() method. Change added .where(roles: { active: true }) to filter plans in org_admin_plans() method of Org model.
exception occuring for an answer with question options selected but text nil. Link to issue https://github.com/DigitalCurationCentre/DMPonline-Service/issues/674 Change to app/models/concerns/exportable_plan.rb, we replaced line answer_text += answer.text if answer.answered? with answer.text present check answer_text += answer.text if answer.answered? && answer.text.present?
Orgs. Fix for DCC issue https://github.com/DigitalCurationCentre/DMPonline-Service/issues/679 Changes: - in app/controllers/super_admin/orgs_controller.rb added missing params to orgs_params method :funder, :institution, :organisation - in app/models/org.rb removed (as it is never set on Org creation) validates :abbreviation, presence: { message: PRESENCE_MESSAGE } - in app/views/orgs/_profile_form.html.erb removed :abbreviation required "aria-required": true - in app/views/shared/org_selectors/_external_only.html.erb renamed wrongly named text field :org_name to :name <%= form.label :name, label %> <%= form.text_field :name, class: "form-control autocomplete",
…or_without_a_name
…lans_visible_to_org_admins
…d-new-organisations
Orgs. Fix for DCC issue https://github.com/DigitalCurationCentre/DMPonline-Service/issues/679 Changes: - in app/controllers/super_admin/orgs_controller.rb added missing params to orgs_params method :funder, :institution, :organisation - in app/models/org.rb removed (as it is never set on Org creation) validates :abbreviation, presence: { message: PRESENCE_MESSAGE } - in app/views/orgs/_profile_form.html.erb removed :abbreviation required "aria-required": true - in app/views/shared/org_selectors/_external_only.html.erb renamed wrongly named text field :org_name to :name <%= form.label :name, label %> <%= form.text_field :name, class: "form-control autocomplete",
…s' of github.com:DMPRoadmap/roadmap into bug-dcc-679-super-admins-unable-to-add-new-organisations
Schrodinger's cat, it seems
in org model spec
org spec failing with no abbrev for some reason.
Used to be that org had to have an abbrev. That stopped the Super Admin creating the org so was removed. Remove check from this test.
…ble-to-add-new-organisations DCC Issue 679 - Fix for issue that Super Admins unable to create new
… Org. Fixes issues: https://github.com/DigitalCurationCentre/DMPonline-Service/issues/592 https://github.com/DigitalCurationCentre/DMPonline-Service/issues/645 https://github.com/DigitalCurationCentre/DMPonline-Service/issues/641 The reason we are seeing deleted (de-activated) Plans is that there is no filter for plans with Roles active in the Org model's org_admin_plans() method. Change added .where(roles: { active: true }) to filter plans in org_admin_plans() method of Org model.
…g_admins' of github.com:DMPRoadmap/roadmap into bug_dcc_592_and_645_deleted-private_plans_visible_to_org_admins
…private_plans_visible_to_org_admins Bug DCC Issues 592, 645 - Fix for Org Admins seeing deleted Plans for…
…hub.com:DMPRoadmap/roadmap into bug_dcc_674_csv_download_plans_fails_for_admins
…ns_fails_for_admins Issue DCC-674: Fix for broken CSV Download noticed because a nil
pagination of user's plans broken. Fix for issue #3069 and DCC issue https://github.com/DigitalCurationCentre/DMPonline-Service/issues/675. Changes: - Replaced view files /paginable/plans/org_admin_other_user with /paginable/plans/_index.html.erb with extra checks for plan.owner.present? as missing plan.owner broke a DCC user's plans being render by org_admin. - Replaced partial with '/paginable/plans/org_admin_other_user' with '/paginable/plans/index', replaced action'org_admin_other_user' with 'index' in paginable_renderiser() method in views /org_admin/users/edit.html.erb. /org_admin/users/plans.html.erb and /super_admin/users/edit.html.erb. - In Paginable::PlansController replaced - # GET /paginable/plans/org_admin/:page with # GET /paginable/users/:id/plans associated with method org_admin_other_user() renamed index() - Routes replaced get "org_admin_other_user/:page", action: :org_admin_other_user, on: :collection, as: :org_admin_other_user # Paginable actions for users resources :users, only: [] do get "index/:page", action: :index, on: :collection, as: :index with resources :users, only: %i[index] do member do resources :plans, only: %(index) end end
…esults_on_plans_org_admin_other_user_breaks Issue#3069 - (DCC Issue 675) - Org Admin and Super Admin searches and
form for Plan based on whether email and/or name are required. Fix for DCC bug #2983 Changes: - Added two new properties to config/initializers/_dmproadmap.rb (both devault to false): config.x.application.require_contributor_name = false config.x.application.require_contributor_email = false -In Contributor model the private method name_or_email_presence() has been updated to take account of the above mentioned property settings.
… of github.com:DMPRoadmap/roadmap into bug_DCC2983-possible_to_add_contributor_without_a_name
form for Plan based on whether email and/or name are required.
Fix for DCC bug #2983
Changes:
(both devault to false):
config.x.application.require_contributor_name = false
config.x.application.require_contributor_email = false
-In Contributor model the private method name_or_email_presence()
has been updated to take account of the above mentioned property
settings.
Fixes # .
Changes proposed in this PR: