diff --git a/app/models/question.rb b/app/models/question.rb index b92355d..dda6711 100644 --- a/app/models/question.rb +++ b/app/models/question.rb @@ -118,7 +118,7 @@ def first_example_answer self.annotations.where(type: Annotation.types[:example_answer]).order(:created_at).first end - + ## # get guidance belonging to the current user's org for this question(need org # to distinguish customizations) diff --git a/app/models/template.rb b/app/models/template.rb index 21e5b9c..7cbe010 100644 --- a/app/models/template.rb +++ b/app/models/template.rb @@ -268,11 +268,11 @@ self.published = false self.migrated = false self.dirty = false - self.visibility = 0 # Organisationally visible by default self.is_default = false if self.is_default.nil? self.version = 0 if self.version.nil? - self.visibility = Template.visibilities[:organisationally_visible] if self.visibility.nil? - + # Organisationally visible by default unless Org is only a funder + self.visibility = (self.org.present? && self.org.funder_only?) ? Template.visibilities[:publicly_visible] : Template.visibilities[:organisationally_visible] + # Generate a unique identifier for the dmptemplate_id if necessary if self.dmptemplate_id.nil? self.dmptemplate_id = loop do