diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb
index 1c1160a..8be35de 100644
--- a/app/controllers/registrations_controller.rb
+++ b/app/controllers/registrations_controller.rb
@@ -9,6 +9,10 @@
@other_organisations = Org.where(parent_id: nil, is_other: true).pluck(:id)
@identifier_schemes = IdentifierScheme.where(active: true).order(:name)
@default_org = current_user.org
+
+ if !@prefs
+ flash[:alert] = 'No default preferences found (should be in branding.yml).'
+ end
end
# GET /resource
diff --git a/app/models/user.rb b/app/models/user.rb
index 79f5be7..8762b29 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -265,8 +265,10 @@
def get_preferences(key)
if self.pref.present? && self.pref.settings[key.to_s].present?
return self.pref.settings[key.to_s].deep_symbolize_keys
- else
+ elsif Pref.default_settings
return Pref.default_settings[key]
+ else
+ return nil
end
end
diff --git a/app/views/users/_notification_preferences.html.erb b/app/views/users/_notification_preferences.html.erb
index 2f59817..37adbde 100644
--- a/app/views/users/_notification_preferences.html.erb
+++ b/app/views/users/_notification_preferences.html.erb
@@ -1,67 +1,70 @@
-<%= form_tag( update_email_preferences_user_path(@user), method: :put, html: { id: "preferences_registration_form", class: "form-horizontal" }) do |f| %>
-
-
-
- <%= link_to _('Select all'), '#', id: 'select_all' %> |
- <%= link_to _('Deselect all'), '#', id: 'deselect_all' %>
-
-
- <%= hidden_field_tag :tab, 'notification-preferences-tab' %>
-
-
All Users
-
-
-
-
-
-
-
-
-
-
-
DMP owners and co-owners
-
-
-
-
-
-
DMP administrators
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <%= submit_tag _('Save'), class: 'btn btn-default' %>
-
+<% if @prefs %>
+ <%= form_tag( update_email_preferences_user_path(@user), method: :put, html: { id: "preferences_registration_form", class: "form-horizontal" }) do |f| %>
+
+
+
+ <%= link_to _('Select all'), '#', id: 'select_all' %> |
+ <%= link_to _('Deselect all'), '#', id: 'deselect_all' %>
+
+
+ <%= hidden_field_tag :tab, 'notification-preferences-tab' %>
+
+
All Users
+
+
+
+
+
+
+
+
+
+
+
DMP owners and co-owners
+
+
+
+
+
+
DMP administrators
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <%= submit_tag _('Save'), class: 'btn btn-default' %>
+
+
+ <% end %>
<% end %>