We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Possibly incorrect hook names?
Going through the docs, I see two rather unusual hook names: `construct_wagtail_edit_bird` and `construct_whitelister_element_rules`. 

The first seems like a placeholder name that accidentally made it out of the alpha stage. Based on the docs, it seems like it should be called `construct_wagtail_userbar`.

The second seems like a straight up typo. I've never heard the word "whitelister" before. I'm pretty sure this hook should be called `construct_whitelisted_element_rules`.

Changing the names of hooks is obviously a major undertaking, since some code bases will have already implemented them. But adding the new names and deprecating the old ones for a few releases should be entirely possible. I'd be happy to do this in a pull request, since it's only a dozen or lines of code to change, but I don't really know how wagtail handles deprecating old APIs.

Possibly incorrect hook names?
Going through the docs, I see two rather unusual hook names: `construct_wagtail_edit_bird` and `construct_whitelister_element_rules`. 

The first seems like a placeholder name that accidentally made it out of the alpha stage. Based on the docs, it seems like it should be called `construct_wagtail_userbar`.

The second seems like a straight up typo. I've never heard the word "whitelister" before. I'm pretty sure this hook should be called `construct_whitelisted_element_rules`.

Changing the names of hooks is obviously a major undertaking, since some code bases will have already implemented them. But adding the new names and deprecating the old ones for a few releases should be entirely possible. I'd be happy to do this in a pull request, since it's only a dozen or lines of code to change, but I don't really know how wagtail handles deprecating old APIs.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `wagtail/wagtailadmin/views/userbar.py`
Content:
```
1 from django.shortcuts import render
2 from django.contrib.auth.decorators import permission_required
3 
4 from wagtail.wagtailadmin.userbar import EditPageItem, AddPageItem, ApproveModerationEditPageItem, RejectModerationEditPageItem
5 from wagtail.wagtailcore import hooks
6 from wagtail.wagtailcore.models import Page, PageRevision
7 
8 
9 @permission_required('wagtailadmin.access_admin', raise_exception=True)
10 def for_frontend(request, page_id):
11     items = [
12         EditPageItem(Page.objects.get(id=page_id)),
13         AddPageItem(Page.objects.get(id=page_id)),
14     ]
15 
16     for fn in hooks.get_hooks('construct_wagtail_edit_bird'):
17         fn(request, items)
18 
19     # Render the items
20     rendered_items = [item.render(request) for item in items]
21 
22     # Remove any unrendered items
23     rendered_items = [item for item in rendered_items if item]
24 
25     # Render the edit bird
26     return render(request, 'wagtailadmin/userbar/base.html', {
27         'items': rendered_items,
28     })
29 
30 
31 @permission_required('wagtailadmin.access_admin', raise_exception=True)
32 def for_moderation(request, revision_id):
33     items = [
34         EditPageItem(PageRevision.objects.get(id=revision_id).page),
35         AddPageItem(PageRevision.objects.get(id=revision_id).page),
36         ApproveModerationEditPageItem(PageRevision.objects.get(id=revision_id)),
37         RejectModerationEditPageItem(PageRevision.objects.get(id=revision_id)),
38     ]
39 
40     for fn in hooks.get_hooks('construct_wagtail_edit_bird'):
41         fn(request, items)
42 
43     # Render the items
44     rendered_items = [item.render(request) for item in items]
45 
46     # Remove any unrendered items
47     rendered_items = [item for item in rendered_items if item]
48 
49     # Render the edit bird
50     return render(request, 'wagtailadmin/userbar/base.html', {
51         'items': rendered_items,
52     })
53
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/wagtail/wagtailadmin/views/userbar.py b/wagtail/wagtailadmin/views/userbar.py
--- a/wagtail/wagtailadmin/views/userbar.py
+++ b/wagtail/wagtailadmin/views/userbar.py
@@ -1,3 +1,5 @@
+import warnings
+
 from django.shortcuts import render
 from django.contrib.auth.decorators import permission_required
 
@@ -5,6 +7,8 @@
 from wagtail.wagtailcore import hooks
 from wagtail.wagtailcore.models import Page, PageRevision
 
+from wagtail.utils.deprecation import RemovedInWagtail11Warning
+
 
 @permission_required('wagtailadmin.access_admin', raise_exception=True)
 def for_frontend(request, page_id):
@@ -13,7 +17,10 @@
         AddPageItem(Page.objects.get(id=page_id)),
     ]
 
-    for fn in hooks.get_hooks('construct_wagtail_edit_bird'):
+    # TODO: Remove in 1.1 release
+    run_deprecated_edit_bird_hook(request, items)
+
+    for fn in hooks.get_hooks('construct_wagtail_userbar'):
         fn(request, items)
 
     # Render the items
@@ -37,7 +44,10 @@
         RejectModerationEditPageItem(PageRevision.objects.get(id=revision_id)),
     ]
 
-    for fn in hooks.get_hooks('construct_wagtail_edit_bird'):
+    # TODO: Remove in 1.1 release
+    run_deprecated_edit_bird_hook(request, items)
+
+    for fn in hooks.get_hooks('construct_wagtail_userbar'):
         fn(request, items)
 
     # Render the items
@@ -50,3 +60,13 @@
     return render(request, 'wagtailadmin/userbar/base.html', {
         'items': rendered_items,
     })
+
+
+def run_deprecated_edit_bird_hook(request, items):
+    for fn in hooks.get_hooks('construct_wagtail_edit_bird'):
+        fn(request, items)
+
+        warnings.warn(
+            "The 'construct_wagtail_edit_bird' hook has been renamed to 'construct_wagtail_userbar'."
+            "Please update function '%s' in '%s'." % (fn.__name__, fn.__module__), RemovedInWagtail11Warning
+        )

{"golden_diff": "diff --git a/wagtail/wagtailadmin/views/userbar.py b/wagtail/wagtailadmin/views/userbar.py\n--- a/wagtail/wagtailadmin/views/userbar.py\n+++ b/wagtail/wagtailadmin/views/userbar.py\n@@ -1,3 +1,5 @@\n+import warnings\n+\n from django.shortcuts import render\n from django.contrib.auth.decorators import permission_required\n \n@@ -5,6 +7,8 @@\n from wagtail.wagtailcore import hooks\n from wagtail.wagtailcore.models import Page, PageRevision\n \n+from wagtail.utils.deprecation import RemovedInWagtail11Warning\n+\n \n @permission_required('wagtailadmin.access_admin', raise_exception=True)\n def for_frontend(request, page_id):\n@@ -13,7 +17,10 @@\n         AddPageItem(Page.objects.get(id=page_id)),\n     ]\n \n-    for fn in hooks.get_hooks('construct_wagtail_edit_bird'):\n+    # TODO: Remove in 1.1 release\n+    run_deprecated_edit_bird_hook(request, items)\n+\n+    for fn in hooks.get_hooks('construct_wagtail_userbar'):\n         fn(request, items)\n \n     # Render the items\n@@ -37,7 +44,10 @@\n         RejectModerationEditPageItem(PageRevision.objects.get(id=revision_id)),\n     ]\n \n-    for fn in hooks.get_hooks('construct_wagtail_edit_bird'):\n+    # TODO: Remove in 1.1 release\n+    run_deprecated_edit_bird_hook(request, items)\n+\n+    for fn in hooks.get_hooks('construct_wagtail_userbar'):\n         fn(request, items)\n \n     # Render the items\n@@ -50,3 +60,13 @@\n     return render(request, 'wagtailadmin/userbar/base.html', {\n         'items': rendered_items,\n     })\n+\n+\n+def run_deprecated_edit_bird_hook(request, items):\n+    for fn in hooks.get_hooks('construct_wagtail_edit_bird'):\n+        fn(request, items)\n+\n+        warnings.warn(\n+            \"The 'construct_wagtail_edit_bird' hook has been renamed to 'construct_wagtail_userbar'.\"\n+            \"Please update function '%s' in '%s'.\" % (fn.__name__, fn.__module__), RemovedInWagtail11Warning\n+        )\n", "issue": "Possibly incorrect hook names?\nGoing through the docs, I see two rather unusual hook names: `construct_wagtail_edit_bird` and `construct_whitelister_element_rules`. \n\nThe first seems like a placeholder name that accidentally made it out of the alpha stage. Based on the docs, it seems like it should be called `construct_wagtail_userbar`.\n\nThe second seems like a straight up typo. I've never heard the word \"whitelister\" before. I'm pretty sure this hook should be called `construct_whitelisted_element_rules`.\n\nChanging the names of hooks is obviously a major undertaking, since some code bases will have already implemented them. But adding the new names and deprecating the old ones for a few releases should be entirely possible. I'd be happy to do this in a pull request, since it's only a dozen or lines of code to change, but I don't really know how wagtail handles deprecating old APIs.\n\nPossibly incorrect hook names?\nGoing through the docs, I see two rather unusual hook names: `construct_wagtail_edit_bird` and `construct_whitelister_element_rules`. \n\nThe first seems like a placeholder name that accidentally made it out of the alpha stage. Based on the docs, it seems like it should be called `construct_wagtail_userbar`.\n\nThe second seems like a straight up typo. I've never heard the word \"whitelister\" before. I'm pretty sure this hook should be called `construct_whitelisted_element_rules`.\n\nChanging the names of hooks is obviously a major undertaking, since some code bases will have already implemented them. But adding the new names and deprecating the old ones for a few releases should be entirely possible. I'd be happy to do this in a pull request, since it's only a dozen or lines of code to change, but I don't really know how wagtail handles deprecating old APIs.\n\n", "before_files": [{"content": "from django.shortcuts import render\nfrom django.contrib.auth.decorators import permission_required\n\nfrom wagtail.wagtailadmin.userbar import EditPageItem, AddPageItem, ApproveModerationEditPageItem, RejectModerationEditPageItem\nfrom wagtail.wagtailcore import hooks\nfrom wagtail.wagtailcore.models import Page, PageRevision\n\n\n@permission_required('wagtailadmin.access_admin', raise_exception=True)\ndef for_frontend(request, page_id):\n    items = [\n        EditPageItem(Page.objects.get(id=page_id)),\n        AddPageItem(Page.objects.get(id=page_id)),\n    ]\n\n    for fn in hooks.get_hooks('construct_wagtail_edit_bird'):\n        fn(request, items)\n\n    # Render the items\n    rendered_items = [item.render(request) for item in items]\n\n    # Remove any unrendered items\n    rendered_items = [item for item in rendered_items if item]\n\n    # Render the edit bird\n    return render(request, 'wagtailadmin/userbar/base.html', {\n        'items': rendered_items,\n    })\n\n\n@permission_required('wagtailadmin.access_admin', raise_exception=True)\ndef for_moderation(request, revision_id):\n    items = [\n        EditPageItem(PageRevision.objects.get(id=revision_id).page),\n        AddPageItem(PageRevision.objects.get(id=revision_id).page),\n        ApproveModerationEditPageItem(PageRevision.objects.get(id=revision_id)),\n        RejectModerationEditPageItem(PageRevision.objects.get(id=revision_id)),\n    ]\n\n    for fn in hooks.get_hooks('construct_wagtail_edit_bird'):\n        fn(request, items)\n\n    # Render the items\n    rendered_items = [item.render(request) for item in items]\n\n    # Remove any unrendered items\n    rendered_items = [item for item in rendered_items if item]\n\n    # Render the edit bird\n    return render(request, 'wagtailadmin/userbar/base.html', {\n        'items': rendered_items,\n    })\n", "path": "wagtail/wagtailadmin/views/userbar.py"}], "after_files": [{"content": "import warnings\n\nfrom django.shortcuts import render\nfrom django.contrib.auth.decorators import permission_required\n\nfrom wagtail.wagtailadmin.userbar import EditPageItem, AddPageItem, ApproveModerationEditPageItem, RejectModerationEditPageItem\nfrom wagtail.wagtailcore import hooks\nfrom wagtail.wagtailcore.models import Page, PageRevision\n\nfrom wagtail.utils.deprecation import RemovedInWagtail11Warning\n\n\n@permission_required('wagtailadmin.access_admin', raise_exception=True)\ndef for_frontend(request, page_id):\n    items = [\n        EditPageItem(Page.objects.get(id=page_id)),\n        AddPageItem(Page.objects.get(id=page_id)),\n    ]\n\n    # TODO: Remove in 1.1 release\n    run_deprecated_edit_bird_hook(request, items)\n\n    for fn in hooks.get_hooks('construct_wagtail_userbar'):\n        fn(request, items)\n\n    # Render the items\n    rendered_items = [item.render(request) for item in items]\n\n    # Remove any unrendered items\n    rendered_items = [item for item in rendered_items if item]\n\n    # Render the edit bird\n    return render(request, 'wagtailadmin/userbar/base.html', {\n        'items': rendered_items,\n    })\n\n\n@permission_required('wagtailadmin.access_admin', raise_exception=True)\ndef for_moderation(request, revision_id):\n    items = [\n        EditPageItem(PageRevision.objects.get(id=revision_id).page),\n        AddPageItem(PageRevision.objects.get(id=revision_id).page),\n        ApproveModerationEditPageItem(PageRevision.objects.get(id=revision_id)),\n        RejectModerationEditPageItem(PageRevision.objects.get(id=revision_id)),\n    ]\n\n    # TODO: Remove in 1.1 release\n    run_deprecated_edit_bird_hook(request, items)\n\n    for fn in hooks.get_hooks('construct_wagtail_userbar'):\n        fn(request, items)\n\n    # Render the items\n    rendered_items = [item.render(request) for item in items]\n\n    # Remove any unrendered items\n    rendered_items = [item for item in rendered_items if item]\n\n    # Render the edit bird\n    return render(request, 'wagtailadmin/userbar/base.html', {\n        'items': rendered_items,\n    })\n\n\ndef run_deprecated_edit_bird_hook(request, items):\n    for fn in hooks.get_hooks('construct_wagtail_edit_bird'):\n        fn(request, items)\n\n        warnings.warn(\n            \"The 'construct_wagtail_edit_bird' hook has been renamed to 'construct_wagtail_userbar'.\"\n            \"Please update function '%s' in '%s'.\" % (fn.__name__, fn.__module__), RemovedInWagtail11Warning\n        )\n", "path": "wagtail/wagtailadmin/views/userbar.py"}]}