diff --git a/app/controllers/registers_controller.rb b/app/controllers/registers_controller.rb
index 7796fbe0..9cfdf412 100644
--- a/app/controllers/registers_controller.rb
+++ b/app/controllers/registers_controller.rb
@@ -154,6 +154,7 @@ def submit
change_status(
:submit, 'Register list successfully submitted for review', current_user
)
+ add_automatic_correspondence('Register list submitted')
end
# GET /registers/r:abcd/return
@@ -190,6 +191,7 @@ def notify
# the standard +change_status+ call used in all other status changes
if @register.notify(current_user, register_notify_params, params[:doi])
flash[:notice] = 'The list has been successfully submitted for validation'
+ add_automatic_correspondence('SeqCode Register notified')
redirect_to(@register)
else
@register.title = par[:title]
@@ -300,12 +302,20 @@ def nomenclature_review
@register.update_column(
:nomenclature_review, !@register.nomenclature_review
)
+ if @register.nomenclature_review
+ add_automatic_correspondence('Nomenclature review complete')
+ end
redirect_back(fallback_location: @register)
end
# POST /registers/r:abc/genomics_review
def genomics_review
- @register.update_column(:genomics_review, !@register.genomics_review)
+ @register.update_column(
+ :genomics_review, !@register.genomics_review
+ )
+ if @register.genomics_review
+ add_automatic_correspondence('Genomics review complete')
+ end
redirect_back(fallback_location: @register)
end
@@ -364,6 +374,13 @@ def ensure_valid!
@register&.validated?
end
+ def add_automatic_correspondence(message)
+ RegisterCorrespondence.new(
+ message: message, notify: '0', automatic: true,
+ user: current_user, register: @register
+ ).save
+ end
+
def change_status(fun, success_msg, *extra_opts)
if @register.send(fun, *extra_opts)
flash[:notice] = success_msg
diff --git a/app/models/register/status.rb b/app/models/register/status.rb
index 4e147c81..bdc7b7ae 100644
--- a/app/models/register/status.rb
+++ b/app/models/register/status.rb
@@ -71,7 +71,8 @@ def submit(user)
name.update!(par)
end
update_status_with_alert(
- submitted: true, submitted_at: Time.now
+ submitted: true, submitted_at: Time.now,
+ genomics_review: false, nomenclature_review: false
) or return false
end
notify_status_change(:submit, user)
diff --git a/app/views/genomes/_genome.html.erb b/app/views/genomes/_genome.html.erb
index eda1bbce..c26bc3d8 100644
--- a/app/views/genomes/_genome.html.erb
+++ b/app/views/genomes/_genome.html.erb
@@ -148,7 +148,7 @@ end
<% if @genome.source? %>
<% def show_genome_sources(n = nil) %>
- <% content_tag(:ul) do %>
+ <% content_tag(:ul, class: 'mb-1') do %>
<% @genome.source_links.each_with_index.map do |link, k| %>
<%= link_to(link[0], target: '_blank', title: link[2]) do %>
@@ -171,7 +171,7 @@ end
<% id = modal('Data sources') do %>
<%= show_genome_sources %>
<% end %>
- <%= modal_button(id) do %>
+ <%= modal_button(id, class: 'btn btn-secondary') do %>
See all sources
<% end %>
<% else %>
diff --git a/app/views/shared/_correspondence_message.html.erb b/app/views/shared/_correspondence_message.html.erb
index 0ab9ab90..99d8c252 100644
--- a/app/views/shared/_correspondence_message.html.erb
+++ b/app/views/shared/_correspondence_message.html.erb
@@ -1,5 +1,7 @@
+<% automatic =
+ correspondence.respond_to?(:automatic) && correspondence.automatic %>
- <%= fa_icon('comment') %>
+ <%= fa_icon(automatic ? 'robot' : 'comment') %>
<%= link_to(correspondence.user) do %>
<%= correspondence.user.username %>
<% if correspondence.user.curator? %>
@@ -8,8 +10,11 @@
<% end %>
<% end %>
+ <% if automatic %>
+ (automatic message)
+ <% end %>
- <%= time_ago_in_words(correspondence.created_at) %> ago:
+ <%= time_ago_in_words(correspondence.created_at) %> ago
<%= correspondence.message %>
diff --git a/db/migrate/20240104203034_add_automatic_to_register_correspondence.rb b/db/migrate/20240104203034_add_automatic_to_register_correspondence.rb
new file mode 100644
index 00000000..4904a791
--- /dev/null
+++ b/db/migrate/20240104203034_add_automatic_to_register_correspondence.rb
@@ -0,0 +1,5 @@
+class AddAutomaticToRegisterCorrespondence < ActiveRecord::Migration[6.1]
+ def change
+ add_column :register_correspondences, :automatic, :boolean, default: false
+ end
+end
diff --git a/db/migrate/20240104204413_add_automatic_to_name_correspondence.rb b/db/migrate/20240104204413_add_automatic_to_name_correspondence.rb
new file mode 100644
index 00000000..0c6acc49
--- /dev/null
+++ b/db/migrate/20240104204413_add_automatic_to_name_correspondence.rb
@@ -0,0 +1,5 @@
+class AddAutomaticToNameCorrespondence < ActiveRecord::Migration[6.1]
+ def change
+ add_column :name_correspondences, :automatic, :boolean, default: false
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index c5708520..0c454427 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2024_01_02_013502) do
+ActiveRecord::Schema.define(version: 2024_01_04_204413) do
create_table "action_text_rich_texts", force: :cascade do |t|
t.string "name", null: false
@@ -113,6 +113,7 @@
t.integer "user_id", null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
+ t.boolean "automatic", default: false
t.index ["name_id"], name: "index_name_correspondences_on_name_id"
t.index ["user_id"], name: "index_name_correspondences_on_user_id"
end
@@ -277,6 +278,7 @@
t.integer "user_id", null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
+ t.boolean "automatic", default: false
t.index ["register_id"], name: "index_register_correspondences_on_register_id"
t.index ["user_id"], name: "index_register_correspondences_on_user_id"
end