Skip to content

Add Notion import #1050

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
5bc5237
🐛(backend) fix link definition select options linked to ancestors
sampaccoud Apr 6, 2025
f94356f
✨(backend) add ancestors links definitions to document abilities
sampaccoud Apr 6, 2025
eda4e35
♻️(backend) remove different reach for authenticated and anonymous
sampaccoud Apr 11, 2025
27e2db9
♻️(backend) refactor resource access viewset
sampaccoud Apr 12, 2025
9a4405b
♻️(backend) factorize document query set annotation
sampaccoud Apr 12, 2025
e409117
✨(backend) we want to display ancestors accesses on a document share
sampaccoud Apr 12, 2025
05f2170
✨(backend) give an order to choices
sampaccoud Apr 23, 2025
3650423
♻️(backend) refactor get_select_options to take definitions dict
sampaccoud Apr 24, 2025
4d6c4a0
✅(backend) fix randomly failing test on user search
sampaccoud May 2, 2025
fbcd5d0
♻️(backend) simplify roles by returning only the max role
sampaccoud Apr 25, 2025
83f1c22
✨(backend) add ancestors link reach and role to document API
sampaccoud Apr 28, 2025
f64d251
✨(backend) add computed link reach and role to document API
sampaccoud Apr 28, 2025
53f205f
♻️(backend) optimize refactoring access abilities and fix inheritance
sampaccoud May 2, 2025
f8cedbf
fixup! ♻️(backend) optimize refactoring access abilities and fix inhe…
sampaccoud May 20, 2025
9cdf726
✨(backend) add max ancestors role field to document access endpoint
sampaccoud May 2, 2025
ae970c8
♻️(backend) stop requiring owner for non-root documents
sampaccoud May 4, 2025
31ff695
✅(backend) fix randomly failing test due to delay before check
sampaccoud May 4, 2025
da6dda7
🐛(backend) allow creating accesses when privileged by heritage
sampaccoud May 6, 2025
e695ed5
✨(backend) add document path and depth to accesses endpoint
sampaccoud May 7, 2025
26bf92e
🐛(backend) fix creating/updating document accesses for teams
sampaccoud May 7, 2025
c9c58aa
♻️(backend) simplify further select options on link reach/role
sampaccoud May 9, 2025
fc9cda9
✨(backend) add max_role field to the document access API endpoint
sampaccoud May 13, 2025
fe8a926
🐛(backend) fix link definition select options linked to ancestors
sampaccoud Apr 6, 2025
c9a0234
✨(backend) add ancestors links definitions to document abilities
sampaccoud Apr 6, 2025
b95f061
♻️(backend) simplify roles by returning only the max role
sampaccoud Apr 25, 2025
41ae267
🐛(backend) fix link definition select options linked to ancestors
sampaccoud Apr 6, 2025
e99ad9c
✨(backend) add ancestors links definitions to document abilities
sampaccoud Apr 6, 2025
f48ad03
🐛(back) keep info if document has deleted children
PanchoutNathan Mar 17, 2025
32373fa
➕(frontend) updated dependencies and added new packages
PanchoutNathan Mar 17, 2025
544f740
✨(frontend) Added drag-and-drop functionality for document management
PanchoutNathan Mar 17, 2025
32a44c7
✨(frontend) added subpage management and document tree features
PanchoutNathan Mar 17, 2025
f6e6fad
✨(frontend) added new features for document management
PanchoutNathan Mar 27, 2025
6e0bddb
🔥(frontend) silent next.js error
AntoLC Mar 31, 2025
4fef197
✏️(frontend) child document with different wording
AntoLC Apr 2, 2025
1106303
✨(frontend) add new SVG assets and skeleton loading styles
PanchoutNathan May 15, 2025
139c42f
✨(backend) update Docker Hub workflow and fix migration conflict
PanchoutNathan May 15, 2025
d943ba2
✨(frontend) enhance document management types and utilities
PanchoutNathan May 19, 2025
e16846b
✨(frontend) refactor document access API and remove infinite query
PanchoutNathan May 19, 2025
c879da7
✨(frontend) enhance document sharing and visibility features
PanchoutNathan May 19, 2025
5698a04
✨(frontend) enhance document sharing and access management
PanchoutNathan May 19, 2025
c10ae98
✨(frontend) update test descriptions for clarity and consistency
PanchoutNathan May 20, 2025
a397689
Add basic oauth flow
emersion Jun 2, 2025
252b87a
notion-schemas: add a framework for some schemas of the notion api.
Castavo Jun 2, 2025
e3523e7
Add import_notion service
clarani Jun 2, 2025
01544f6
notion-schemas: add some more schemas
Castavo Jun 2, 2025
974bb86
Add blocks converter to y-provider
emersion Jun 2, 2025
f2c5754
wip: add document creation code
emersion Jun 2, 2025
53e41bd
notion-import: use schemas
Castavo Jun 2, 2025
63039be
Fix ValueError in NotionPage.get_title()
emersion Jun 2, 2025
7fad79f
Remove awkward debugging log
emersion Jun 2, 2025
6bebe67
Fix 400 in Notion search
emersion Jun 2, 2025
3f31453
Simplify Notion API error handling
emersion Jun 2, 2025
2f0ef45
Create one document per root Notion page
emersion Jun 2, 2025
b7db0b3
Add super dumb block converter
emersion Jun 2, 2025
7bae379
notion-schemas: add catcah-all unsupported block type
Castavo Jun 2, 2025
4955ccf
just add some colors
Castavo Jun 2, 2025
216c55f
just add a link type
Castavo Jun 2, 2025
74bcea7
Fix typo lol
emersion Jun 2, 2025
1c7371a
It's not a match
emersion Jun 2, 2025
c838039
fixup
Castavo Jun 2, 2025
b5e3f1a
Unionize all of these rich folks
emersion Jun 2, 2025
6aabba6
notion-import: tidy up
Castavo Jun 2, 2025
c8d44e8
notion-schemas: better unsupported objects
Castavo Jun 2, 2025
0c86a9b
Add import button
NicolasRitouet Jun 22, 2025
7eea481
notion-schemas: add tables
Castavo Jun 2, 2025
0496520
notion-schemas: blocks: add child-page and video
Castavo Jun 2, 2025
70c283d
Don't reuse token in redirect endpoint
emersion Jun 3, 2025
4699870
Move Notion API details to settings
emersion Jun 3, 2025
979bc07
Introduce ImportedDocument
emersion Jun 3, 2025
4b56e6c
handle heading blocks
clarani Jun 3, 2025
d1d85ef
notion-import: tidy parsing
Castavo Jun 2, 2025
721a888
notion-import: handle dividers
Castavo Jun 3, 2025
35e8ef4
Add support for child pages
emersion Jun 3, 2025
cf343c6
Add DocumentAccess for child docs, just in case
emersion Jun 3, 2025
48ba52b
Introduce NotionFile
emersion Jun 3, 2025
fb27708
notion-import: add table & fix converter error message
Castavo Jun 3, 2025
f2248cc
add FRONTEND_URL to env settings
clarani Jun 3, 2025
2f68809
Add a loading page during import
clarani Jun 3, 2025
a9ed917
Ajout support Bullet list and Number list
NicolasRitouet Jun 3, 2025
9284879
add format text
Tguisnet Jun 3, 2025
41f44be
tidy
Castavo Jun 3, 2025
10b85ec
notion-import: handle sub list items
Castavo Jun 3, 2025
36fbf65
convert_block returns now list of dict
clarani Jun 3, 2025
0c815f2
handle columns and columns list
clarani Jun 3, 2025
15c3ca8
notion-import: handle notion todos
Castavo Jun 3, 2025
578409e
fixup
Castavo Jun 3, 2025
3c938ae
Handle uploaded images
emersion Jun 3, 2025
b3eb0ff
Fix missing arg in convert_block()
emersion Jun 3, 2025
33f21ff
tidy
Castavo Jun 3, 2025
9337e42
Struggle update
emersion Jun 3, 2025
6c276c2
fix
Castavo Jun 3, 2025
ac6742d
notion-schemas: handle callouts
Castavo Jun 3, 2025
da02423
add partial links
Tguisnet Jun 3, 2025
adc6029
notion-schemas: handle code blocks
Castavo Jun 3, 2025
81ef2e7
notion-schemas: handle bookmarks
Castavo Jun 3, 2025
70451ba
notion-schemas: fix heading handling
Castavo Jun 3, 2025
9310550
notion-schemas: fix default table width
Castavo Jun 3, 2025
e69ce24
improve links
Tguisnet Jun 3, 2025
3d9547d
C'est le WIP maintenant
emersion Jun 3, 2025
42f42fc
Disable content negotiation
emersion Jun 3, 2025
116a7e3
add eventSource in useImportNotion
clarani Jun 3, 2025
96e36e6
fancy progress bar
clarani Jun 3, 2025
b1d52cc
notion-import: handle child page blocks
Castavo Jun 3, 2025
7af6e8d
notion-import: adapt child page block to progress stream
Castavo Jun 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/docker-hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
push:
branches:
- 'main'
- 'feature/doc-dnd'
tags:
- 'v*'
pull_request:
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ and this project adheres to

## Added

- ✨(frontend) multi-pages #701
- ✨(backend) include ancestors accesses on document accesses list view #846
- ✨(backend) add ancestors links reach and role to document API #846
- 🚸(backend) make document search on title accent-insensitive #874
- 🚩 add homepage feature flag #861
- 📝(doc) update contributing policy (commit signatures are now mandatory) #895
Expand All @@ -54,22 +57,30 @@ and this project adheres to

## Changed

- ♻️(backend) stop requiring owner for non-root documents #846
- ♻️(backend) simplify roles by ranking them and return only the max role #846
- ⚡️(frontend) reduce unblocking time for config #867
- ♻️(frontend) bind UI with ability access #900
- ♻️(frontend) use built-in Quote block #908

## Fixed

- 🐛(backend) fix link definition select options linked to ancestors #846
- 🐛(nginx) fix 404 when accessing a doc #866
- 🔒️(drf) disable browsable HTML API renderer #919
- 🔒(frontend) enhance file download security #889
- 🐛(backend) race condition create doc #633
- 🐛(frontend) fix breaklines in custom blocks #908

## Fixed

- 🐛(backend) fix link definition select options linked to ancestors #846

## [3.1.0] - 2025-04-07

## Added

- ✨(backend) add ancestors links definitions to document abilities #846
- 🚩(backend) add feature flag for the footer #841
- 🔧(backend) add view to manage footer json #841
- ✨(frontend) add custom css style #771
Expand All @@ -81,6 +92,7 @@ and this project adheres to

## Fixed

- 🐛(backend) fix link definition select options linked to ancestors #846
- 🐛(back) validate document content in serializer #822
- 🐛(frontend) fix selection click past end of content #840

Expand Down
1 change: 1 addition & 0 deletions env.d/development/common.dist
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ COLLABORATION_WS_URL=ws://localhost:4444/collaboration/ws/

# Frontend
FRONTEND_THEME=default
FRONTEND_URL=http://localhost:3000
55 changes: 46 additions & 9 deletions src/backend/core/api/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from rest_framework import permissions

from core import choices
from core.models import DocumentAccess, RoleChoices, get_trashbin_cutoff

ACTION_FOR_METHOD_TO_PERMISSION = {
Expand Down Expand Up @@ -96,26 +97,27 @@ def has_permission(self, request, view):
).exists()


class AccessPermission(permissions.BasePermission):
"""Permission class for access objects."""
class ResourceWithAccessPermission(permissions.BasePermission):
"""A permission class for templates and invitations."""

def has_permission(self, request, view):
"""check create permission for templates."""
return request.user.is_authenticated or view.action != "create"

def has_object_permission(self, request, view, obj):
"""Check permission for a given object."""
abilities = obj.get_abilities(request.user)
action = view.action
try:
action = ACTION_FOR_METHOD_TO_PERMISSION[view.action][request.method]
except KeyError:
pass
return abilities.get(action, False)


class DocumentAccessPermission(AccessPermission):
class DocumentPermission(permissions.BasePermission):
"""Subclass to handle soft deletion specificities."""

def has_permission(self, request, view):
"""check create permission for documents."""
return request.user.is_authenticated or view.action != "create"

def has_object_permission(self, request, view, obj):
"""
Return a 404 on deleted documents
Expand All @@ -127,10 +129,45 @@ def has_object_permission(self, request, view, obj):
) and deleted_at < get_trashbin_cutoff():
raise Http404

# Compute permission first to ensure the "user_roles" attribute is set
has_permission = super().has_object_permission(request, view, obj)
abilities = obj.get_abilities(request.user)
action = view.action
try:
action = ACTION_FOR_METHOD_TO_PERMISSION[view.action][request.method]
except KeyError:
pass

has_permission = abilities.get(action, False)

if obj.ancestors_deleted_at and not RoleChoices.OWNER in obj.user_roles:
raise Http404

return has_permission


class ResourceAccessPermission(IsAuthenticated):
"""Permission class for document access objects."""

def has_permission(self, request, view):
"""check create permission for accesses in documents tree."""
if super().has_permission(request, view) is False:
return False

if view.action == "create":
role = getattr(view, view.resource_field_name).get_role(request.user)
if role not in choices.PRIVILEGED_ROLES:
raise exceptions.PermissionDenied(
"You are not allowed to manage accesses for this resource."
)

return True

def has_object_permission(self, request, view, obj):
"""Check permission for a given object."""
abilities = obj.get_abilities(request.user)

requested_role = request.data.get("role")
if requested_role and requested_role not in abilities.get("set_role_to", []):
return False

action = view.action
return abilities.get(action, False)
Loading