django / code.djangoproject.com

Configuration for Django's Trac instance (code.djangoproject.com)
BSD 3-Clause "New" or "Revised" License
48 stars 40 forks source link

Filing a new bug when you're not logged in is *extremely* difficult #100

Open mlissner opened 4 years ago

mlissner commented 4 years ago

I just spent ten minutes trying to figure out where the "New Ticket" button is. Alas, it only shows up if you're logged in and I didn't realize I wasn't logged in. If you're logged out you'll look around forever and ever just hoping to figure it out.

There's a lot of documentation about how to file new bugs, but at a skim it just talks about things to do first, how to handle security bugs, etc. Where's the link‽ :)

If there's a way to add a "New Ticket" link that redirects you to the login page, that'd be very helpful.

jacobtylerwalls commented 3 years ago

Hi @mlissner I remember this being non-obvious to me also. Skimmers gonna skim. We do have this link in the README, which has a blaring warning to sign in.

In the wiki article at code.djangoproject.com we have:

To log a ticket, or add content to this wiki, log in with a GitHub account. (You may also ​create a DjangoProject account and log in with that account.)

Is your suggestion just to add a New Ticket link right after that paragraph? Could be solved with a wiki edit if so.

jacobtylerwalls commented 3 years ago

Ah, there was a change to point folks away from /newticket and just to the homepage in https://github.com/django/django/pull/6700, so maybe increasing redundancy is the answer. Put a more obvious "new ticket" link in the wiki article so that when we send you to the wiki, if you're a skimmer you (ideally) struggle less.

The link could read New ticket (login required).

mlissner commented 3 years ago

I guess my solution would be to make the New Ticket link always appear. If you click it when you're logged out, you go to the login page with a redirect to the new ticket page. No idea if that's practical.

jacobtylerwalls commented 3 years ago

The nav buttons come from Trac, so based on this (very old) comment I was able to get close. Haven't ported CSS, etc. I think the missing extra buttons could be because I haven't granted my anonymous user permissions for viewing the wiki. All to say -- before going further would be nice to get a reaction from somebody who's worked more with Trac.

diff --git a/DjangoPlugin/tracdjangoplugin/__init__.py b/DjangoPlugin/tracdjangoplugin/__init__.py
index d4845e1..41d2010 100644
--- a/DjangoPlugin/tracdjangoplugin/__init__.py
+++ b/DjangoPlugin/tracdjangoplugin/__init__.py
@@ -52,6 +52,12 @@ class CustomNavigationBar(Component):
         return ''

     def get_navigation_items(self, req):
+        # Trac disables the New Ticket button in the main nav for logged out users, so create our own.
+        if 'TICKET_CREATE' not in req.perm:
+            return [
+                ('mainnav', 'new_ticket', tag.a('New Ticket', href=req.href.newticket())),
+                ('mainnav', 'custom_reports', Markup('<a href="%s">Reports</a>' % req.href.wiki('Reports'))),
+            ]
         return [
             ('mainnav', 'custom_reports', Markup('<a href="%s">Reports</a>' % req.href.wiki('Reports'))),
         ]

Screen Shot 2021-06-06 at 10 46 19 AM


And at least that would take you to the current /newticket with a blaring warning to sign in. There are two login forms so I don't know about choosing one and adding a redirect.