Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
8b91d23
return 503 for API if maintanence_mode is set to ture
mkovalua Apr 23, 2026
6e3360e
set maintenance mode via admin
mkovalua Apr 24, 2026
6655865
resolve CR comments add unittests
mkovalua Apr 24, 2026
d49a26e
resolve CR comments update unittests
mkovalua Apr 27, 2026
86784a3
update tests
mkovalua Apr 27, 2026
d959d1c
Merge pull request #11706 from mkovalua/feature/ENG-10768
brianjgeiger Apr 30, 2026
e3ab66a
[ENG-10774] Provide extra options to populate newly created templates…
Ostap-Zherebetskyi May 1, 2026
b985424
[ENG-10775] Move notification management from admin/admin to badmin a…
Ostap-Zherebetskyi May 1, 2026
0d4bd1d
[ENG-10943] Add the 'id' and 'event_name' attributes to the 'Subscrip…
Ostap-Zherebetskyi May 1, 2026
701cb69
Merge pull request #11720 from CenterForOpenScience/develop
adlius May 1, 2026
237c66a
[ENG-10943] Add the 'id' and 'event_name' attributes to the 'Subscrip…
Ostap-Zherebetskyi May 5, 2026
cfdcc01
[ENG-11055] Fix conditional logic in pending registration template (#…
Ostap-Zherebetskyi May 7, 2026
d35445e
[ENG-10776] Log invalid user account status to Sentry with detailed u…
Ostap-Zherebetskyi May 15, 2026
1577c60
Merge remote-tracking branch 'upstream/develop' into feature/merge-de…
cslzchen May 21, 2026
530fb37
Redo migration for MaintenanceMode
cslzchen May 22, 2026
502913e
Add back manual modifications for osf 0040_maintenancemode
cslzchen May 22, 2026
03fabb9
Merge pull request #11750 from cslzchen/feature/merge-develop
cslzchen May 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions admin/base/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
re_path(r'^draft_registrations/', include('admin.draft_registrations.urls', namespace='draft_registrations')),
re_path(r'^files/', include('admin.files.urls', namespace='files')),
re_path(r'^share_reindex/', include('admin.share_reindex.urls', namespace='share_reindex')),
re_path(r'^notifications/', include('admin.notifications.urls', namespace='notifications')),
]),
),
]
Expand Down
14 changes: 8 additions & 6 deletions admin/maintenance/views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytz
import datetime

from osf.models import MaintenanceState
from osf.models import MaintenanceState, MaintenanceMode
import website.maintenance as maintenance
from admin.maintenance.forms import MaintenanceForm

Expand Down Expand Up @@ -36,15 +36,17 @@ def get_context_data(self, **kwargs):
maintenance = MaintenanceState.objects.first()
kwargs['form'] = MaintenanceForm()
kwargs['current_alert'] = model_to_dict(maintenance) if maintenance else None
kwargs['maintenance_mode'] = MaintenanceMode.is_under_maintenance()
return super().get_context_data(**kwargs)

def post(self, request, *args, **kwargs):
data = request.POST

start = convert_eastern_to_utc(data['start']).isoformat() if data.get('start') else None
end = convert_eastern_to_utc(data['end']).isoformat() if data.get('end') else None

maintenance.set_maintenance(data.get('message', ''), data['level'], start, end)
if maintenance_mode := data.get('maintenance_mode'):
MaintenanceMode(maintenance_mode=False if maintenance_mode == 'True' else True).save()
else:
start = convert_eastern_to_utc(data['start']).isoformat() if data.get('start') else None
end = convert_eastern_to_utc(data['end']).isoformat() if data.get('end') else None
maintenance.set_maintenance(data.get('message', ''), data['level'], start, end)
return redirect('maintenance:display')


Expand Down
12 changes: 11 additions & 1 deletion admin/management/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,17 @@ def post(self, request):
class SyncNotificationTemplates(ManagementCommandPermissionView):

def post(self, request):
populate_notification_types()
run_type = request.POST.get('run_type')
if run_type == 'restore_one':
template_name = request.POST.get('template_name')
if not template_name:
messages.error(request, 'A template name must be specified when restoring one template. Check your inputs and try again')
return redirect(reverse('management:commands'))
populate_notification_types(restore_one=template_name)
elif run_type == 'restore_all':
populate_notification_types(restore_all=True)
else:
populate_notification_types()
messages.success(request, 'Notification templates have been successfully synced.')
return redirect(reverse('management:commands'))

Expand Down
8 changes: 8 additions & 0 deletions admin/notifications/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django import forms
from osf.models import NotificationType


class NotificationTypeForm(forms.ModelForm):
class Meta:
model = NotificationType
fields = '__all__'
14 changes: 14 additions & 0 deletions admin/notifications/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from django.urls import re_path
from . import views

app_name = 'admin'

urlpatterns = [
re_path(r'$', views.NotificationsList.as_view(), name='list'),
re_path(r'types/$', views.NotificationTypeList.as_view(), name='types_list'),
re_path(r'type_display/(?P<pk>\d+)/$', views.NotificationTypeDisplay.as_view(), name='type_display'),
re_path(r'type_detail/(?P<pk>\d+)/$', views.NotificationTypeDetail.as_view(), name='type_detail'),
re_path(r'types_preview/(?P<pk>\d+)/$', views.NotificationTypePreview.as_view(), name='types_preview'),
re_path(r'subscriptions/$', views.NotificationSubscriptionsList.as_view(), name='subscriptions_list'),
re_path(r'email_tasks/$', views.EmailTasksList.as_view(), name='email_tasks_list'),
]
Loading