4
4
5
5
from jinja2 import Environment
6
6
from lando import settings
7
-
7
+ from lando . ui . legacy . forms import UserSettingsForm
8
8
9
9
import datetime
10
10
import logging
13
13
14
14
from typing import Optional
15
15
16
+ from django .contrib import messages
17
+
16
18
FAQ_URL = "https://wiki.mozilla.org/Phabricator/FAQ#Lando"
17
19
SEC_BUG_DOCS = "https://firefox-source-docs.mozilla.org/bug-mgmt/processes/security-approval.html" # noqa: E501
18
20
@@ -312,6 +314,16 @@ def message_type_to_notification_class(flash_message_category: str) -> str:
312
314
def environment (** options ):
313
315
env = Environment (** options )
314
316
env .globals .update (
317
+ {
318
+ "config" : settings ,
319
+ "get_messages" : messages .get_messages ,
320
+ "is_user_authenticated" : is_user_authenticated (env ),
321
+ "new_settings_form" : UserSettingsForm ,
322
+ "url" : reverse ,
323
+ "user_has_phabricator_token" : user_has_phabricator_token (env ),
324
+ }
325
+ )
326
+ env .filters .update (
315
327
{
316
328
"avatar_url" : avatar_url ,
317
329
"bug_url" : bug_url ,
@@ -323,15 +335,13 @@ def environment(**options):
323
335
"graph_height" : graph_height ,
324
336
"graph_width" : graph_width ,
325
337
"graph_x_pos" : graph_x_pos ,
326
- "is_user_authenticated" : is_user_authenticated (env ),
327
338
"linkify_bug_numbers" : linkify_bug_numbers ,
328
339
"linkify_faq" : linkify_faq ,
329
340
"linkify_revision_ids" : linkify_revision_ids ,
330
341
"linkify_revision_urls" : linkify_revision_urls ,
331
342
"linkify_sec_bug_docs" : linkify_sec_bug_docs ,
332
343
"linkify_transplant_details" : linkify_transplant_details ,
333
344
"message_type_to_notification_class" : message_type_to_notification_class ,
334
- # "new_settings_form": new_settings_form,
335
345
"repo_path" : repo_path ,
336
346
"reviewer_to_action_text" : reviewer_to_action_text ,
337
347
"reviewer_to_status_badge_class" : reviewer_to_status_badge_class ,
@@ -340,8 +350,6 @@ def environment(**options):
340
350
"static" : static ,
341
351
"tostatusbadgeclass" : tostatusbadgeclass ,
342
352
"tostatusbadgename" : tostatusbadgename ,
343
- "url" : reverse ,
344
- "user_has_phabricator_token" : user_has_phabricator_token (env ),
345
353
}
346
354
)
347
355
return env
0 commit comments