Repository: internetarchive/openlibrary

Issue:
Remove obsolete template borrow_admin.html and its references
<!-- What problem are we solving? What does the experience look like today? What are the symptoms? -->
Per a discussion on Slack, `openlibrary/templates/borrow_admin.html` is obsolete and should be removed, along with references to it.

### Proposal & Constraints
<!-- What is the proposed solution / implementation? Is there a precedent of this approach succeeding elsewhere? -->
Delete the template, clean up the references, then test everything to make sure nothing has broken.

### Related files
<!-- Files related to this issue; this is super useful for new contributors who might want to help! If you're not sure, leave this blank; a maintainer will add them. -->
Some references that will need to be tested + updated after deletion.
```
openlibrary/templates/admin/waitinglists.html
50:                    <div><a href="$book.url(suffix='/borrow_admin')">debug_info</a></div>

openlibrary/templates/admin/loans_table.html
98:                    $ borrow_admin = book.url('/borrow_admin')
99:                    <a href="$borrow_admin">debug_info</a><br/><br/>
100:                    <a href="$borrow_admin?updatestatus=t" class="smaller plain">refresh</a>

openlibrary/plugins/upstream/borrow.py
260:class borrow_admin(delegate.page):
261:    path = "(/books/.*)/borrow_admin"
287:            "borrow_admin", edition, edition_loans, ebook, user_loans, web.ctx.ip
300:            raise web.seeother(edition.url("/borrow_admin"))
309:        raise web.seeother(web.ctx.path + '/borrow_admin')
312:class borrow_admin_no_update(delegate.page):
313:    path = "(/books/.*)/borrow_admin_no_update"
333:            "borrow_admin_no_update", edition, edition_loans, user_loans, web.ctx.ip
349:        )  # $$$ why doesn't this redirect to borrow_admin_no_update?
```

Plus all the references in i18n files.

### Stakeholders
<!-- @ tag stakeholders of this bug -->
@mekarpeles, @cdrini 

I will work on this and aim to have a PR before the weekend is spent.


Discussion:

Resolving patch:
diff --git a/openlibrary/plugins/upstream/borrow.py b/openlibrary/plugins/upstream/borrow.py
--- a/openlibrary/plugins/upstream/borrow.py
+++ b/openlibrary/plugins/upstream/borrow.py
@@ -257,98 +257,6 @@ def GET(self, key):
         return delegate.RawText(output_text, content_type=content_type)
 
 
-class borrow_admin(delegate.page):
-    path = "(/books/.*)/borrow_admin"
-
-    def GET(self, key):
-        if not is_admin():
-            return render_template(
-                'permission_denied', web.ctx.path, "Permission denied."
-            )
-
-        edition = web.ctx.site.get(key)
-        if not edition:
-            raise web.notfound()
-
-        if edition.ocaid:
-            lending.sync_loan(edition.ocaid)
-            ebook_key = "ebooks/" + edition.ocaid
-            ebook = web.ctx.site.store.get(ebook_key) or {}
-        else:
-            ebook = None
-
-        edition_loans = get_edition_loans(edition)
-
-        user_loans = []
-        if user := accounts.get_current_user():
-            user_loans = get_loans(user)
-
-        return render_template(
-            "borrow_admin", edition, edition_loans, ebook, user_loans, web.ctx.ip
-        )
-
-    def POST(self, key):
-        if not is_admin():
-            return render_template(
-                'permission_denied', web.ctx.path, "Permission denied."
-            )
-
-        edition = web.ctx.site.get(key)
-        if not edition:
-            raise web.notfound()
-        if not edition.ocaid:
-            raise web.seeother(edition.url("/borrow_admin"))
-
-        lending.sync_loan(edition.ocaid)
-        i = web.input(action=None, loan_key=None)
-
-        if i.action == 'delete' and i.loan_key:
-            loan = lending.get_loan(edition.ocaid)
-            if loan and loan['_key'] == i.loan_key:
-                loan.delete()
-        raise web.seeother(web.ctx.path + '/borrow_admin')
-
-
-class borrow_admin_no_update(delegate.page):
-    path = "(/books/.*)/borrow_admin_no_update"
-
-    def GET(self, key):
-        if not is_admin():
-            return render_template(
-                'permission_denied', web.ctx.path, "Permission denied."
-            )
-
-        edition = web.ctx.site.get(key)
-
-        if not edition:
-            raise web.notfound()
-
-        edition_loans = get_edition_loans(edition)
-
-        user_loans = []
-        if user := accounts.get_current_user():
-            user_loans = get_loans(user)
-
-        return render_template(
-            "borrow_admin_no_update", edition, edition_loans, user_loans, web.ctx.ip
-        )
-
-    def POST(self, key):
-        if not is_admin():
-            return render_template(
-                'permission_denied', web.ctx.path, "Permission denied."
-            )
-
-        i = web.input(action=None, loan_key=None)
-
-        if i.action == 'delete' and i.loan_key:
-            delete_loan(i.loan_key)
-
-        raise web.seeother(
-            web.ctx.path
-        )  # $$$ why doesn't this redirect to borrow_admin_no_update?
-
-
 class ia_loan_status(delegate.page):
     path = r"/ia_loan_status/(.*)"
 


Test patch: