From df2c76226b1fca636de899080ffc011c139edb1c Mon Sep 17 00:00:00 2001 From: Kira Date: Sun, 13 Oct 2019 16:47:48 -0700 Subject: [PATCH] Add link to artist note changes to history --- app/models/artist.rb | 6 ++++-- app/views/artist_versions/_standard_listing.html.erb | 8 ++++++++ .../20191013233447_add_notes_changed_to_artist_version.rb | 5 +++++ db/structure.sql | 8 ++++++-- 4 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20191013233447_add_notes_changed_to_artist_version.rb diff --git a/app/models/artist.rb b/app/models/artist.rb index 379c39c59..a2cab6e57 100644 --- a/app/models/artist.rb +++ b/app/models/artist.rb @@ -279,7 +279,8 @@ class Artist < ApplicationRecord :is_active => is_active, :is_banned => is_banned, :other_names => other_names, - :group_name => group_name + :group_name => group_name, + :notes_changed => saved_change_to_notes? ) end @@ -291,7 +292,8 @@ class Artist < ApplicationRecord :is_active => is_active, :is_banned => is_banned, :other_names => other_names, - :group_name => group_name + :group_name => group_name, + :notes_changed => saved_change_to_notes? ) end diff --git a/app/views/artist_versions/_standard_listing.html.erb b/app/views/artist_versions/_standard_listing.html.erb index 3773d0715..65f56dbfe 100644 --- a/app/views/artist_versions/_standard_listing.html.erb +++ b/app/views/artist_versions/_standard_listing.html.erb @@ -5,6 +5,7 @@ Name Other Names URLs + Notes Updated <% if artist_versions_listing_type == :revert %> @@ -35,6 +36,13 @@ <%= artist_version_urls_diff(artist_version) if artist_version.visible? %> + + <% if artist_version.notes_changed %> + <%= link_to "Note Changes", wiki_page_versions_path(search: {wiki_page_id: artist_version.artist.wiki_page})%> + <% else %> + (No Changes) + <% end %> + <%= link_to_user artist_version.updater %> <%= link_to "ยป", artist_versions_path(search: { updater_name: artist_version.updater_name }) %> diff --git a/db/migrate/20191013233447_add_notes_changed_to_artist_version.rb b/db/migrate/20191013233447_add_notes_changed_to_artist_version.rb new file mode 100644 index 000000000..0efe8a0f5 --- /dev/null +++ b/db/migrate/20191013233447_add_notes_changed_to_artist_version.rb @@ -0,0 +1,5 @@ +class AddNotesChangedToArtistVersion < ActiveRecord::Migration[6.0] + def change + add_column :artist_versions, :notes_changed, :boolean, default: false + end +end diff --git a/db/structure.sql b/db/structure.sql index 7a885cad0..5de87987d 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -436,7 +436,8 @@ CREATE TABLE public.artist_versions ( created_at timestamp without time zone, updated_at timestamp without time zone, other_names text[] DEFAULT '{}'::text[] NOT NULL, - urls text[] DEFAULT '{}'::text[] NOT NULL + urls text[] DEFAULT '{}'::text[] NOT NULL, + notes_changed boolean DEFAULT false ); @@ -3695,6 +3696,8 @@ ALTER TABLE ONLY public.post_sets ALTER TABLE ONLY public.post_versions ADD CONSTRAINT post_versions_pkey PRIMARY KEY (id); +ALTER TABLE public.post_versions CLUSTER ON post_versions_pkey; + -- -- Name: post_votes post_votes_pkey; Type: CONSTRAINT; Schema: public; Owner: - @@ -5330,6 +5333,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20190924233432'), ('20191003070653'), ('20191006073950'), -('20191006143246'); +('20191006143246'), +('20191013233447');