Skip to content

Add collaboration requests#183

Open
TGyAkos wants to merge 9 commits intomainfrom
feature/collaborating-groups
Open

Add collaboration requests#183
TGyAkos wants to merge 9 commits intomainfrom
feature/collaborating-groups

Conversation

@TGyAkos
Copy link
Copy Markdown

@TGyAkos TGyAkos commented Mar 4, 2026

  • Change Event editing page, so that Categories can be chosen
  • Change Event editing page, so that Pages can be chosen
  • Change Post editing page, so that Categories and Pages can be chosen
  • Make new page where admins can accept incoming collaboration requests, where admins can choose which categories do they wish to connect the incoming Post/Event
  • On Post/Event editing page check whether the user is in the respective PEK group, if its true list out the possible connectable Categories, then save event as normal, if it isn't save the page as normal, without any new categories, when the other admin confirms which categories he wants to connect the incoming Post/Event, then save that to the existing Posts/Events categories and delete that CollaborationRequest record from the db
  • Update the existing code for Post/Event editing, so it will auto populate the new fields
  • add migrations

@TGyAkos TGyAkos self-assigned this Mar 4, 2026
@TGyAkos TGyAkos added the epic Upcoming features of StartSCH label Mar 4, 2026
@TGyAkos TGyAkos linked an issue Mar 4, 2026 that may be closed by this pull request
@TGyAkos
Copy link
Copy Markdown
Author

TGyAkos commented Mar 5, 2026

Code is kinda doo-doo, but works

Comment on lines +63 to +66
var canCreateEvent = AuthorizationService.CanCreateEvent(_page);
var canCreatePost = AuthorizationService.CanCreatePost(_page);
// TODO what role should be required to accept collaboration requests ASK ALBI
var canAcceptCollaborationRequests = canCreatePost && canCreateEvent;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What role should be used to allow collaborations?

Copy link
Copy Markdown
Member

@albi005 albi005 Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a AuthorizationService.CanAcceptCollaborationRequests identical to AuthorizationService.CanCreatePost/AuthorizationService.CanCreateEvent

@TGyAkos TGyAkos requested a review from albi005 March 5, 2026 16:12
@TGyAkos TGyAkos marked this pull request as ready for review March 5, 2026 16:13
Comment on lines +63 to +66
var canCreateEvent = AuthorizationService.CanCreateEvent(_page);
var canCreatePost = AuthorizationService.CanCreatePost(_page);
// TODO what role should be required to accept collaboration requests ASK ALBI
var canAcceptCollaborationRequests = canCreatePost && canCreateEvent;
Copy link
Copy Markdown
Member

@albi005 albi005 Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a AuthorizationService.CanAcceptCollaborationRequests identical to AuthorizationService.CanCreatePost/AuthorizationService.CanCreateEvent

Elfogadás
</button>
<button type="button" @onclick="() => Deny(request)"
class="small text round error standard">Elutasítás
Copy link
Copy Markdown
Member

@albi005 albi005 Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


protected override async Task OnInitializedAsync()
{
await InterestService.LoadIndex;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this does not work as InterestService.LoadIndex attaches the entities to the scoped DbContext. You already load Categories below, so you can just remove this line

if (_page == null)
return;

_items.AddRange(await db.EventCollaborationRequests
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these 2 queries can be replaced by a single db.CollaborationRequests query

{
await using var db = await DbFactory.CreateDbContextAsync();

if (request is EventCollaborationRequest evInfo)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to type-check, just do the query on db.CollaborationRequests

i'd also add a check here for whether the user has permission to do this

@@ -0,0 +1,178 @@
@attribute [Authorize]
@page "/collaborations/{PageId:int}"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@page "/collaboration-requests/{CollaborationRequestId:int}"

instead of having a per-Page list for collaboration requests, show all of them under AdminDashboardPage with a link to this page, where the user can accept or deny the request

<div
style="display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid #ccc; border-radius: 12px;">
<span>@(category.Name ?? category.Page.Name ?? category.Page.PekName)</span>
<button type="button" @onclick="() => RemoveCollaborationCategory(category)">×
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use Material input chips instead: https://material-web.dev/components/chip/

<div style="display: flex; gap: 16px; margin-top: 16px;">
<div style="flex: 1;">
<div class="small filled round">
Kiválasztott kollaboráló körök
Copy link
Copy Markdown
Member

@albi005 albi005 Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • instead of 2 columns show both together and mark pages that require a collaboration request with a pending icon
  • for adding new pages, add a button that opens a dialog with a list of all pages. add a note below pages that require a collaboration request
  • show the Page selected using the categories query parameter as selected here

Comment thread StartSch/Services/EventService.cs Outdated
int eventId,
int? parentId,
HashSet<int> categoryIds,
HashSet<int> possibleCollaborationRequestPageIds,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge categoryIds and possibleCollaborationRequestPageIds and compute possibleCollaborationRequestPageIds dynamically

Comment thread StartSch/Services/PostService.cs Outdated
int postId,
int? eventId,
HashSet<int> categoryIds,
HashSet<int> possibleCollaborationRequestPageIds,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as EventService

@albi005 albi005 changed the title collaboration for posts/events Implement collaboration requests Mar 19, 2026
@albi005 albi005 changed the title Implement collaboration requests Add collaboration requests Mar 19, 2026
@TGyAkos TGyAkos requested a review from albi005 March 21, 2026 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

epic Upcoming features of StartSCH

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow inviting collaborating groups for events/posts

2 participants