Skip to content

Commit 194c5a6

Browse files
authored
Merge pull request #3223 from benjaminfaure/fix/plan_visibility
Fix/plan visibility
2 parents 72181c7 + 7cf0dc5 commit 194c5a6

File tree

10 files changed

+615
-659
lines changed

10 files changed

+615
-659
lines changed

Gemfile.lock

Lines changed: 117 additions & 115 deletions
Large diffs are not rendered by default.

app/controllers/notes_controller.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# Controller for the Comments section of the Write Plan page
44
class NotesController < ApplicationController
55
include ConditionalUserMailer
6-
require 'pp'
76
after_action :verify_authorized
87
respond_to :html
98

app/controllers/org_admin/departments_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def destroy
6060
@department = Department.find(params[:id])
6161
@org_id = org_id
6262
authorize @department
63-
url = "#{admin_edit_org_path(@org_id)}\#departments"
63+
url = "#{admin_edit_org_path(@org_id)}#departments"
6464

6565
if @department.destroy
6666
flash[:notice] = success_message(@department, _('deleted'))

app/controllers/orgs_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ def admin_update
8888
end
8989
@org.save
9090
end
91-
redirect_to "#{admin_edit_org_path(@org)}\##{tab}",
91+
redirect_to "#{admin_edit_org_path(@org)}##{tab}",
9292
notice: success_message(@org, _('saved'))
9393
else
9494
failure = failure_message(@org, _('save')) if failure.blank?
95-
redirect_to "#{admin_edit_org_path(@org)}\##{tab}", alert: failure
95+
redirect_to "#{admin_edit_org_path(@org)}##{tab}", alert: failure
9696
end
9797
end
9898
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength

app/controllers/registrations_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def do_update(require_password = true, confirm = false)
249249
set_flash_message :notice, success_message(current_user, _('saved'))
250250
# Sign in the user bypassing validation in case his password changed
251251
sign_in current_user, bypass: true
252-
redirect_to "#{edit_user_registration_path}\#personal-details",
252+
redirect_to "#{edit_user_registration_path}#personal-details",
253253
notice: success_message(current_user, _('saved'))
254254

255255
else
@@ -280,12 +280,12 @@ def do_update_password(current_user, args)
280280
set_flash_message :notice, success_message(current_user, _('saved'))
281281
# TODO: this method is deprecated
282282
sign_in current_user, bypass: true
283-
redirect_to "#{edit_user_registration_path}\#password-details",
283+
redirect_to "#{edit_user_registration_path}#password-details",
284284
notice: success_message(current_user, _('saved'))
285285

286286
else
287287
flash[:alert] = message.blank? ? failure_message(current_user, _('save')) : message
288-
redirect_to "#{edit_user_registration_path}\#password-details"
288+
redirect_to "#{edit_user_registration_path}#password-details"
289289
end
290290
end
291291
# rubocop:enable Metrics/AbcSize, Metrics/PerceivedComplexity

app/controllers/users_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def update_email_preferences
127127
pref.save
128128

129129
# Include active tab in redirect path
130-
redirect_to "#{edit_user_registration_path}\#notification-preferences",
130+
redirect_to "#{edit_user_registration_path}#notification-preferences",
131131
notice: success_message(pref, _('saved'))
132132
end
133133
# rubocop:enable Metrics/AbcSize

app/models/plan.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ class Plan < ApplicationRecord
7575

7676
alias_attribute :name, :title
7777

78-
attribute :visibility, :integer, default: 3
79-
8078
# ================
8179
# = Associations =
8280
# ================

app/models/template.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,7 @@ class Template < ApplicationRecord
6161
attribute :version, :integer, default: 0
6262
attribute :customization_of, :integer, default: nil
6363
attribute :family_id, :integer, default: -> { Template.new_family_id }
64-
65-
# TODO: re-add visibility setting? (this is handled in org_admin/create and
66-
# relies on the org_id in the current callback-form)
67-
attribute :visibility, :integer, default: 0
64+
attribute :visibility, default: Template.visibilities[:organisationally_visible]
6865

6966
# ================
7067
# = Associations =

spec/factories/plans.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
FactoryBot.define do
4343
factory :plan do
4444
title { Faker::Company.bs }
45+
visibility { Plan.visibilities[:privately_visible] }
4546
template
4647
org
4748
identifier { SecureRandom.hex }

yarn.lock

Lines changed: 489 additions & 530 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)