fix(frontend & backend): unsubscribe from brain (#2373)

# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged

## Screenshots (if appropriate):
This commit is contained in:
Antoine Dewez 2024-03-21 11:51:10 -07:00 committed by GitHub
parent ca6e4455a6
commit 1381a0729e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 6 deletions

View File

@ -458,11 +458,7 @@ async def unsubscribe_from_brain_handler(
if brain is None:
raise HTTPException(status_code=404, detail="Brain not found")
if brain.status != "public":
raise HTTPException(
status_code=403,
detail="You cannot subscribe to this brain without invitation",
)
# check if user is already subscribed to brain
user_brain = brain_user_service.get_brain_for_user(current_user.id, brain_id)
if user_brain is None:

View File

@ -42,7 +42,7 @@ const BrainsManagement = (): JSX.Element => {
hidden: !isOwnedByCurrentUser || !brain?.max_files,
},
{
label: "Delete brain",
label: isOwnedByCurrentUser ? "Delete Brain" : "Unsubscribe from Brain",
color: "dangerous",
onClick: () => {
setIsDeleteOrUnsubscribeModalOpened(true);