Skip to content

Commit

Permalink
Merge tag '24.06.0' into develop
Browse files Browse the repository at this point in the history
B&I release 24.06.0
  • Loading branch information
cslzchen committed Sep 12, 2024
2 parents 63365d8 + 06782e9 commit 4cb9cc4
Show file tree
Hide file tree
Showing 67 changed files with 1,786 additions and 1,357 deletions.
6 changes: 3 additions & 3 deletions .github/actions/start-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ runs:
- name: Copy Settings
shell: bash
run: |
cp website/settings/local-travis.py website/settings/local.py
cp api/base/settings/local-travis.py api/base/settings/local.py
cp website/settings/local-ci.py website/settings/local.py
cp api/base/settings/local-ci.py api/base/settings/local.py
mkdir -p ~/preprints
touch ~/preprints/index.html
- name: PIP install
Expand All @@ -41,7 +41,7 @@ runs:
shell: bash
run: |
# bumped psycopg to match requirements.txt, as otherwise build would fail
poetry run python3 -m invoke travis-addon-settings
poetry run python3 -m invoke ci-addon-settings
pip uninstall uritemplate.py --yes
# use yarn add --exact to match versions in yarn.lock w/o installing all deps
yarn add --exact bower@^1.8.8
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- uses: actions/checkout@v2
- uses: ./.github/actions/start-build
- name: Run tests
run: poetry run python3 -m invoke test-travis-addons -n 1 --junit
run: poetry run python3 -m invoke test-ci-addons -n 1 --junit
- name: Upload report
if: (github.event_name != 'pull_request') && (success() || failure()) # run this step even if previous step failed
uses: ./.github/actions/gen-report
Expand All @@ -79,7 +79,7 @@ jobs:
- uses: actions/checkout@v2
- uses: ./.github/actions/start-build
- name: Run tests
run: poetry run python3 -m invoke test-travis-website -n 1 --junit
run: poetry run python3 -m invoke test-ci-website -n 1 --junit
- name: Upload report
if: (github.event_name != 'pull_request') && (success() || failure()) # run this step even if previous step failed
uses: ./.github/actions/gen-report
Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
- name: NVM & yarn install
run: poetry run python3 -m invoke assets --dev
- name: Run test
run: poetry run python3 -m invoke test-travis-api1-and-js -n 1 --junit
run: poetry run python3 -m invoke test-ci-api1-and-js -n 1 --junit
- name: Upload report
if: (github.event_name != 'pull_request') && (success() || failure()) # run this step even if previous step failed
uses: ./.github/actions/gen-report
Expand All @@ -135,7 +135,7 @@ jobs:
- uses: actions/checkout@v2
- uses: ./.github/actions/start-build
- name: Run tests
run: poetry run python3 -m invoke test-travis-api2 -n 1 --junit
run: poetry run python3 -m invoke test-ci-api2 -n 1 --junit
- name: Upload report
if: (github.event_name != 'pull_request') && (success() || failure()) # run this step even if previous step failed
uses: ./.github/actions/gen-report
Expand Down Expand Up @@ -163,7 +163,7 @@ jobs:
- uses: actions/checkout@v2
- uses: ./.github/actions/start-build
- name: Run tests
run: poetry run python3 -m invoke test-travis-api3-and-osf -n 1 --junit
run: poetry run python3 -m invoke test-ci-api3-and-osf -n 1 --junit
- name: Upload report
if: (github.event_name != 'pull_request') && (success() || failure()) # run this step even if previous step failed
uses: ./.github/actions/gen-report
185 changes: 0 additions & 185 deletions .travis.yml

This file was deleted.

14 changes: 14 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

We follow the CalVer (https://calver.org/) versioning scheme: YY.MINOR.MICRO.

24.06.0 (2024-09-12)
====================

- Fix duplicate notifications for contributor-add failures
- Allow Read and Write contributors to view a project's draft registrations
- Change how files for withdrawn registrations are surfaced in the API
- Fix date displayed in citation for a registration
- New API endpoint /users/me/draft_preprints/
- Add button to admin to move preprint from initial to pending
- Update language in notifications to indicate preprint resubmission
- Fix Preprint emails so they are sent as expected
- Fix ORCiD email by sending them after changes are committed to DB
- Remove references of TravisCI

24.05.0 (2024-07-22)
====================
- Bump base python version from py3.6 to py3.12.
Expand Down
3 changes: 3 additions & 0 deletions addons/base/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@ def get_authenticated_resource(resource_id):
if resource.deleted:
raise HTTPError(http_status.HTTP_410_GONE, message='Resource has been deleted.')

if getattr(resource, 'is_retracted', False):
raise HTTPError(http_status.HTTP_410_GONE, message='Resource has been retracted.')

return resource


Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions admin/nodes/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@
name='recalculate-node-storage'),
re_path(r'^(?P<guid>[a-z0-9]+)/make_private/$', views.NodeMakePrivate.as_view(), name='make-private'),
re_path(r'^(?P<guid>[a-z0-9]+)/make_public/$', views.NodeMakePublic.as_view(), name='make-public'),
re_path(r'^(?P<guid>[a-z0-9]+)/remove_notifications/$', views.NodeRemoveNotificationView.as_view(), name='node-remove-notifications'),
]
25 changes: 22 additions & 3 deletions admin/nodes/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from admin.base.utils import change_embargo_date, validate_embargo_date
from admin.base.views import GuidView
from admin.base.forms import GuidForm
from admin.notifications.views import detect_duplicate_notifications, delete_selected_notifications

from api.share.utils import update_share
from api.caching.tasks import update_storage_usage_cache
Expand Down Expand Up @@ -92,12 +93,30 @@ class NodeView(NodeMixin, GuidView):
raise_exception = True

def get_context_data(self, **kwargs):
return super().get_context_data(**{
context = super().get_context_data(**kwargs)
node = self.get_object()

detailed_duplicates = detect_duplicate_notifications(node_id=node.id)

context.update({
'SPAM_STATUS': SpamStatus,
'STORAGE_LIMITS': settings.StorageLimits,
'node': kwargs.pop('object', self.get_object()),
}, **kwargs)
'node': node,
'duplicates': detailed_duplicates
})

return context

class NodeRemoveNotificationView(View):
def post(self, request, *args, **kwargs):
selected_ids = request.POST.getlist('selected_notifications')
if selected_ids:
delete_selected_notifications(selected_ids)
messages.success(request, 'Selected notifications were successfully deleted.')
else:
messages.error(request, 'No notifications selected for deletion.')

return redirect('nodes:node', guid=kwargs.get('guid'))

class NodeSearchView(PermissionRequiredMixin, FormView):
""" Allows authorized users to search for a node by it's guid.
Expand Down
30 changes: 30 additions & 0 deletions admin/notifications/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from osf.models.notifications import NotificationSubscription
from django.db.models import Count

def delete_selected_notifications(selected_ids):
NotificationSubscription.objects.filter(id__in=selected_ids).delete()

def detect_duplicate_notifications(node_id=None):
query = NotificationSubscription.objects.values('_id').annotate(count=Count('_id')).filter(count__gt=1)
if node_id:
query = query.filter(node_id=node_id)

detailed_duplicates = []
for dup in query:
notifications = NotificationSubscription.objects.filter(
_id=dup['_id']
).order_by('created')

for notification in notifications:
detailed_duplicates.append({
'id': notification.id,
'_id': notification._id,
'event_name': notification.event_name,
'created': notification.created,
'count': dup['count'],
'email_transactional': [u._id for u in notification.email_transactional.all()],
'email_digest': [u._id for u in notification.email_digest.all()],
'none': [u._id for u in notification.none.all()]
})

return detailed_duplicates
26 changes: 25 additions & 1 deletion admin/preprints/forms.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
from django import forms

from osf.models import Preprint

from osf.utils.workflows import ReviewStates

class ChangeProviderForm(forms.ModelForm):
class Meta:
model = Preprint
fields = ('provider',)


class MachineStateForm(forms.ModelForm):
class Meta:
model = Preprint
fields = ('machine_state',)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

if not self.instance.is_public:
self.fields['machine_state'].widget.attrs['disabled'] = 'disabled'
else:
if self.instance.machine_state == ReviewStates.INITIAL.db_name:
self.fields['machine_state'].choices = [
(ReviewStates.INITIAL.value, ReviewStates.INITIAL.value),
(ReviewStates.PENDING.value, ReviewStates.PENDING.value),
]
else:
# Disabled Option you are on
self.fields['machine_state'].widget.attrs['disabled'] = 'disabled'
self.fields['machine_state'].choices = [
(self.instance.machine_state.title(), self.instance.machine_state)
]
Loading

0 comments on commit 4cb9cc4

Please sign in to comment.