From 20779d52d07696177057fe1846a83f0d31b496e2 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Mon, 26 Sep 2016 12:02:35 -0700 Subject: [PATCH] final fix for #2688: Artists are uneditable --- app/models/artist.rb | 4 ++++ app/views/artists/edit.html.erb | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/models/artist.rb b/app/models/artist.rb index 2b5932d25..24e980308 100644 --- a/app/models/artist.rb +++ b/app/models/artist.rb @@ -495,6 +495,10 @@ class Artist < ActiveRecord::Base user.is_builder? end + def editable_by?(user) + user.is_builder? || (!is_banned? && is_active?) + end + def visible? !is_banned? || CurrentUser.is_gold? end diff --git a/app/views/artists/edit.html.erb b/app/views/artists/edit.html.erb index 18409448f..64c451061 100644 --- a/app/views/artists/edit.html.erb +++ b/app/views/artists/edit.html.erb @@ -2,14 +2,15 @@

Edit Artist

- <% if !@artist.is_active? %> + <% if @artist.editable_by?(CurrentUser.user) %> + <%= render "form" %> + + <% elsif !@artist.is_active? %>

This artist entry is inactive and cannot be edited.

<% elsif @artist.is_banned? %>

The artist requested removal of this page.

- <% else %> - <%= render "form" %> <% end %>