fromthepage icon indicating copy to clipboard operation
fromthepage copied to clipboard

Collaborator Profile -> More gives 500

Open benwbrum opened this issue 3 years ago • 5 comments

IF I log in and go to https://fromthepage.com/deed/list?page=2&user_id=2 the following error happens:

I, [2022-01-24T19:51:23.676455 #24403]  INFO -- : Completed 500  in 361ms (ActiveRecord: 61.6ms | Allocations: 128439)
F, [2022-01-24T19:51:23.717142 #24403] FATAL -- :   
ActionView::Template::Error (undefined method `show_to?' for nil:NilClass):
    19:           =profile_picture(d.user)
    20:       td.w100.toleft
    21:         -if @collection.nil?
    22:           -if d.collection.show_to?(current_user) || (d.work && d.work.access_object(current_user))
    23:             =render(:partial => 'deed/deed.html', :locals => { :deed => d, :long_view => true })
    24:           -else
    25:             =raw(strip_tags(render(:partial => 'deed/deed.html', :locals => { :deed => d, :long_view => true })))
  
app/views/deed/list.html.slim:22
app/views/deed/list.html.slim:15
app/controllers/application_controller.rb:48:in `switch_locale'

benwbrum avatar Jan 24 '22 19:01 benwbrum

Note: to reproduce this, you may need to page through the deeds to find a problem deed. Note that this seems to happen when a deed has nil collection; we need to review deed types to see when that might be the case.

benwbrum avatar Apr 13 '22 21:04 benwbrum

Let us know if we need to mine the DB for problem deeds.

benwbrum avatar Apr 13 '22 21:04 benwbrum

Here's some deeds I found that caused a 500 error:

(their IDs) 465560, 465557, 465546, 465544, 465543, 465541, 465539, 46553, 465536, 465534, 465528, 465521, 465517, 465511, 465509, 465503

It looks like they have no deed.collection, which is what causes the error, but they do have a deed.work and deed.work.collection. They all had a deed_type of "work_add" (but that could just be this batch).

Here's more detail on one of them for reference, they all looked pretty similar:

<Deed:0x00007f571531de40> {
                      :id => 465560,
               :deed_type => "work_add",
                 :page_id => nil,
                 :work_id => 14656,
           :collection_id => nil,
              :article_id => nil,
                 :user_id => 2,
                 :note_id => nil,
              :created_at => Wed, 24 Apr 2019 00:28:56 UTC +00:00,
              :updated_at => Wed, 24 Apr 2019 00:28:56 UTC +00:00,
                :visit_id => 5160757,
               :prerender => "<a href=\"http://fromthepage.com/benwbrum\" only_path=\"true\">Ben Brumfield</a> added ",
        :prerender_mailer => "<a href=\"http://fromthepage.com/benwbrum\" only_path=\"false\">Ben Brumfield</a> added  in the work Diary of Jeremiah White Graves, Volume 2, Book 22",
               :is_public => true
    }

sylvieed avatar Apr 21 '22 00:04 sylvieed

Let's look at the works that were added here and test this:

  • Was this imported from the Internet Archive? deed.work.ia_work.nil?
  • Was this imported via IIIF? deed.work.sc_manifest.nil?

benwbrum avatar Jun 10 '22 19:06 benwbrum

All of the deed's works were imported from the Internet Archive

sylvieed avatar Jun 16 '22 23:06 sylvieed