Skip to content

Commit

Permalink
Merge pull request #217 from ncbo/develop
Browse files Browse the repository at this point in the history
Develop -> Master merge, Release v5.33.0
  • Loading branch information
alexskr authored Oct 7, 2024
2 parents a9da098 + 812dd78 commit 6b1df08
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 24 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/ncbo/goo.git
revision: 70007faf43d0d96292809f89f15a27a757ccaa25
revision: 74a012eebb9433d031eb00df5abbe488cb8b4512
branch: develop
specs:
goo (0.0.2)
Expand Down Expand Up @@ -149,7 +149,7 @@ GEM
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.3.7)
rexml (3.3.8)
rsolr (2.6.0)
builder (>= 2.1.2)
faraday (>= 0.9, < 3, != 2.0.0)
Expand Down
2 changes: 1 addition & 1 deletion lib/ontologies_linked_data/models/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def self.goo_attrs_to_load(attributes = [], level = 0)
if attributes.first == :all
(self.attributes + self.hypermedia_settings[:serialize_default]).uniq
else
attributes
attributes - self.hypermedia_settings[:serialize_never]
end
elsif self.hypermedia_settings[:serialize_default].empty?
self.attributes
Expand Down
2 changes: 1 addition & 1 deletion lib/ontologies_linked_data/models/users/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class User < LinkedData::Models::Base
embed :subscription
embed_values :role => [:role]
serialize_default :username, :email, :role, :apikey
serialize_never :passwordHash, :show_apikey, :resetToken, :restTokenExpireTime
serialize_never :passwordHash, :show_apikey, :resetToken, :resetTokenExpireTime
serialize_filter lambda {|inst| show_apikey?(inst)}

# Cache
Expand Down
28 changes: 8 additions & 20 deletions lib/ontologies_linked_data/utils/notifications.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,28 +106,16 @@ def self.reset_password(user, token)

def self.obofoundry_sync(missing_onts, obsolete_onts)
ui_name = LinkedData.settings.ui_name
subject = "[#{ui_name}] OBO Foundry synchronization report"
body = ''

if missing_onts.size > 0
body << "<strong>The following OBO Library ontologies are missing from #{ui_name}:</strong><br/><br/>"
missing_onts.each do |ont|
body << "<a href='#{ont['homepage']}'>#{ont['id']}</a> (#{ont['title']})<br/><br/>"
end
end

if obsolete_onts.size > 0
body << '<strong>The following OBO Library ontologies have been deprecated:</strong><br/><br/>'
obsolete_onts.each do |ont|
body << "<a href='#{ont['homepage']}'>#{ont['id']}</a> (#{ont['title']})<br/><br/>"
end
end
gem_path = Gem.loaded_specs['ontologies_linked_data'].full_gem_path
template = File.read(File.join(gem_path, 'views/emails/obofoundry_sync.erb'))

if body.empty?
body << "#{ui_name} and the OBO Foundry are in sync.<br/><br/>"
end
b = binding
b.local_variable_set(:ui_name, ui_name)
b.local_variable_set(:missing_onts, missing_onts)
b.local_variable_set(:obsolete_onts, obsolete_onts)
body = ERB.new(template).result(b)

Notifier.notify_mails_separately subject, body, [LinkedData.settings.email_sender]
Notifier.notify_ontoportal_admins("[#{ui_name}] OBO Foundry synchronization report", body)
end

NEW_NOTE = <<EOS
Expand Down
17 changes: 17 additions & 0 deletions views/emails/obofoundry_sync.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<% if missing_onts.present? %>
<strong>The following OBO Foundry ontologies are missing from <%= ui_name %>:</strong><br /><br />
<% missing_onts.each do |ont| %>
<a href="<%= ont['homepage'] %>"><%= ont['id'] %></a> (<%= ont['title'] %>)<br /><br />
<% end %>
<% end %>

<% if obsolete_onts.present? %>
<strong>The following OBO Foundry ontologies have been deprecated:</strong><br /><br />
<% obsolete_onts.each do |ont| %>
<a href="<%= ont['homepage'] %>"><%= ont['id'] %></a> (<%= ont['title'] %>)<br /><br />
<% end %>
<% end %>

<% if missing_onts.blank? && obsolete_onts.blank? %>
<%= ui_name %> and the OBO Foundry are in sync.
<% end %>

0 comments on commit 6b1df08

Please sign in to comment.