Skip to content

Commit

Permalink
config: add subcommunity invitation request notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
carlinmack authored and slint committed Nov 27, 2024
1 parent 51d3097 commit 6ea8db5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
5 changes: 5 additions & 0 deletions invenio_app_rdm/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1365,6 +1365,11 @@ def github_link_render(record):
community_notifications.SubCommunityCreate.type: community_notifications.SubCommunityCreate,
community_notifications.SubCommunityAccept.type: community_notifications.SubCommunityAccept,
community_notifications.SubCommunityDecline.type: community_notifications.SubCommunityDecline,
# Subcommunity invitation request
community_notifications.SubComInvitationCreate.type: community_notifications.SubComInvitationCreate,
community_notifications.SubComInvitationAccept.type: community_notifications.SubComInvitationAccept,
community_notifications.SubComInvitationDecline.type: community_notifications.SubComInvitationDecline,
community_notifications.SubComInvitationExpire.type: community_notifications.SubComInvitationExpire,
}
"""Notification builders."""

Expand Down
21 changes: 5 additions & 16 deletions invenio_app_rdm/requests_ui/views/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from invenio_communities.members.services.request import CommunityInvitation
from invenio_communities.proxies import current_identities_cache
from invenio_communities.subcommunities.services.request import (
SubCommunityRequest,
SubCommunityInvitationRequest,
SubCommunityRequest,
)
from invenio_communities.utils import identity_cache_key
from invenio_communities.views.communities import render_community_theme_template
Expand Down Expand Up @@ -245,7 +245,9 @@ def community_dashboard_request_view(request, community, community_ui, **kwargs)
is_record_inclusion = request_type == CommunityInclusion.type_id
is_member_invitation = request_type == CommunityInvitation.type_id
is_subcommunity_request = request_type == SubCommunityRequest.type_id
is_subcommunity_invitation_request = request_type == SubCommunityInvitationRequest.type_id
is_subcommunity_invitation_request = (
request_type == SubCommunityInvitationRequest.type_id
)
request_is_accepted = request["status"] == AcceptAction.status_to

permissions = community.has_permissions_to(
Expand Down Expand Up @@ -297,20 +299,7 @@ def community_dashboard_request_view(request, community, community_ui, **kwargs)
include_deleted=False,
)

elif is_subcommunity_request:
return render_community_theme_template(
f"invenio_requests/{request_type}/index.html",
theme=community.to_dict().get("theme", {}),
base_template="invenio_communities/details/base.html",
invenio_request=request.to_dict(),
community=community_ui,
permissions=permissions,
request_is_accepted=request_is_accepted,
user_avatar=avatar,
include_deleted=False,
)

elif is_subcommunity_invitation_request:
elif is_subcommunity_request or is_subcommunity_invitation_request:
return render_community_theme_template(
f"invenio_requests/{request_type}/index.html",
theme=community.to_dict().get("theme", {}),
Expand Down

0 comments on commit 6ea8db5

Please sign in to comment.