Skip to content

Feature/allow kb edits#73

Merged
XanderVertegaal merged 12 commits into
developfrom
feature/allow-kb-edits
Feb 26, 2026
Merged

Feature/allow kb edits#73
XanderVertegaal merged 12 commits into
developfrom
feature/allow-kb-edits

Conversation

@XanderVertegaal

@XanderVertegaal XanderVertegaal commented Feb 23, 2026

Copy link
Copy Markdown
Contributor

This PR fixes a couple of issues revolving around KB items.

  • Creating/editing/deleting KB items is no longer limited to problem belonging to the USER dataset. All problems (incl. those from SICK, FraCaS and SNLI datasets) can now have KB annotations.

  • The "Add knowledge base item" and "Save problem" buttons are now visible if the user has the annotation.changeknowledgebase permission. Their visibility used to depend indirectly on user.can_edit_problem, which is meant for changes to a problem's hypothesis and sentences.

  • KB items can now be deleted. This was not possible before.

@jgonggrijp jgonggrijp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me. I have some comments for your perusal.

Comment thread backend/problem/serializers.py Outdated
Comment thread backend/problem/serializers_test.py Outdated
Comment thread backend/problem/serializers_test.py Outdated
Comment thread backend/problem/serializers_test.py
Comment thread backend/problem/serializers_test.py
{
<li class="mb-3">
@if (appMode === 'add' || appMode === 'edit') {
@if (canEditKb$ | async) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Question out of curiosity: is there any performance penalty to having the same observable piped through async in two places in the same template? I'm not expecting it to be a problem here, just asking to learn for future usage.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I had to look this up myself, and every | async call sets up a new subscription. If the observable is not shared (as we do in the case of canEditKb$ with shareReplay), I think you will get a new request to the backend for each individual subscription.

With Angular 19+, this risk of multiple backend requests can probably also be avoided by using only one async pipe in combination with @let:

@let canEdit = canEditKb$ | async;

Good to keep in mind; thanks for pointing this out!

Comment thread frontend/src/app/annotate/annotation-input/annotation-input.component.html Outdated
@XanderVertegaal XanderVertegaal merged commit 1e999be into develop Feb 26, 2026
1 check passed
@XanderVertegaal XanderVertegaal deleted the feature/allow-kb-edits branch February 26, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants