204 Commits

Author SHA1 Message Date
Apoorv Mishra
ad902af52c Move tree implementation out of collections store (#4763)
* refactor: attaching emoji in tree node is unnecessary

* refactor: pass depth and hasChildren as separate props

* refactor: move tree impl into a separate hook

* refactor: separate out as DocumentExplorer for reuse

* fix: separate search and node

* fix: review comments

* fix: tsc
2023-01-27 11:33:51 +05:30
Tom Moor
4b47bffcf5 fix: images and files with cyrillic names don't import (#4654)
closes #4559
2023-01-06 06:02:15 -08:00
Tom Moor
445d19f43e chore: Extract product name from translation strings (#4646) 2023-01-04 19:00:57 -08:00
Tom Moor
bb568d2e62 fix: Exports generate invalid internal links (#4639)
* refactoring

* Refactoring continues

* Refactor export, fix internal links in exported docs

* fix: Dupe document name detection

* sigh
2023-01-04 04:18:59 -08:00
Tom Moor
8e4270c321 feat: Add GA integration, support for GA4 (#4626)
* GA integration settings

* trackingId -> measurementId
Hook up script

* Public page GA tracking
Correct layout of settings

* Remove multiple codepaths for loading GA measurementID, add missing db index

* Remove unneccessary changes, tsc

* test
2023-01-01 07:29:08 -08:00
Tom Moor
f3469d25fe feat: Bulk HTML export (#4620)
* wip

* Working bulk html export

* Refactor

* test

* test
2022-12-30 09:42:20 -08:00
Tom Moor
1b8dd9399c chore: Export improvements (#4617)
* wip

* i18n
2022-12-27 09:51:39 -08:00
Tom Moor
0f19c550f9 fix: Uploaded and immediately deleted images are not removed from storage (#4562)
* fix: Uploaded and immediately deleted images are not removed from storage upon permanant delete
closes #4557

* Move attachment deletion async
2022-12-11 08:29:38 -08:00
Tom Moor
6e36ffb706 feat: Allow data imports larger than the standard attachment size (#4449)
* feat: Allow data imports larger than the standard attachment size

* Use correct preset for data imports

* Cleanup of expired attachments

* lint
2022-11-20 09:22:57 -08:00
Tom Moor
01a482552a fix: Unable to subscribe to fileOperation webhook events 2022-11-15 20:03:20 -05:00
Tom Moor
622f464b9f Store import<->document relationship (#4415)
* Store import<->document relationship

* Update 20221112152649-import-document-relationship.js

* Store importId on collection, UI tweaks on import screen
2022-11-12 08:22:41 -08:00
Tom Moor
79cbe304da fix: Allow viewers to upload avatar (#4349)
* fix: Allow viewers to upload avatar

* DeleteAttachmentTask

* fix: Previous avatar should be deleted on change, if possible

* fix: Also cleanup team logo on change
2022-10-29 06:08:20 -07:00
Apoorv Mishra
a89d30c735 Allow drafts to be created without requiring a collection (#4175)
* feat(server): allow document to be created without collectionId

* fix(server): policies for a draft doc without collection

* fix(app): hide share button for drafts

* feat(server): permissions around publishing a draft

* fix(server): return drafts without collection

* fix(server): handle draft deletion

* fix(server): show drafts in deleted docs

* fix(server): allow drafts without collection to be restored

* feat(server): return drafts in search results

* fix: use buildDraftDocument for drafts

* fix: remove isDraftWithoutCollection

* fix: do not return drafts for team

* fix: put invariants

* fix: query clause

* fix: check only for undefined

* fix: restore includeDrafts clause as it was before
2022-10-25 18:01:57 +05:30
Tom Moor
1fbc000e03 chore: Reduce test boilerplate (#4300)
* chore: Reduce test boilerplate

* mo
2022-10-15 19:40:21 -07:00
Tom Moor
8417818528 test 2022-10-04 09:26:34 -04:00
Tom Moor
125ddec60b Shortcircuit notification generation if there is no diff to render 2022-10-03 21:04:32 -04:00
Tom Moor
91d8d27f2d feat: Render diffs in email notifications (#4164)
* deps

* diffCompact

* Diffs in email

* test

* fix: Fade deleted images
fix: Don't include empty paragraphs as context
fix: Allow for same image multiple times and refactor

* Remove target _blank

* fix: Table heading incorrect color
2022-09-24 14:29:11 -07:00
Apoorv Mishra
7a590550c9 Sign webhook requests (#4156)
Co-authored-by: Tom Moor <tom.moor@gmail.com>
2022-09-24 14:19:26 -07:00
Tom Moor
35ea1cdff8 fix: Missing recipient.user, closes #4093 2022-09-09 22:30:31 +01:00
Tom Moor
54dc0521e5 fix: Missing recipient.user, closes #4093 2022-09-09 22:05:28 +01:00
Tom Moor
fa75d5585f feat: Show diff when navigating revision history (#4069)
* tidy

* Add title to HTML export

* fix: Add compatability for documents without collab state

* Add HTML download option to UI

* docs

* fix nodes that required document to render

* Refactor to allow for styling of HTML export

* div>article for easier programatic content extraction

* Allow DocumentHelper to be used with Revisions

* Add revisions.diff endpoint, first version

* Allow arbitrary revisions to be compared

* test

* HTML driven revision viewer

* fix: Dark mode styles for document diffs

* Add revision restore button to header

* test

* Support RTL languages in revision history viewer

* fix: RTL support
Remove unneccessary API requests

* Prefetch revision data

* Animate history sidebar

* fix: Cannot toggle history from timestamp
fix: Animation on each revision click

* Clarify currently editing history item
2022-09-08 02:17:52 -07:00
Apoorv Mishra
1e39b564fe Throttle email notifications upon updating document frequently (#4026)
* feat: add needed columns for throttling notifs

* feat: update model

* feat: deliver only one notif in a 12 hour window

* fix: address review comments

* prevent retry if notification update fails
* fix type compatibility instead of circumventing it
* add index for emailedAt

* fix: add metadata attr to EmailProps

* chore: decouple metadata from EmailProps

* chore: add test

* chore: revert sending metadata in props
2022-09-07 16:51:30 +05:30
Tom Moor
212985e18f feat: Allow viewers to be upgraded to editors on individual collections (#4023)
* Improve types

* More types, fix default permission for viewers added to collection

* fix change of default role for CollectionGroup

* Restore policy

* test

* tests
2022-08-30 23:12:27 -07:00
Tom Moor
b9f1fde2e3 test 2022-08-27 13:39:11 +02:00
Tom Moor
a1d4cca9d9 Add support for document subscriptions to websockets 2022-08-27 12:53:40 +02:00
Tom Moor
922bf53753 fix: Document subscriptions backfill not recursive 2022-08-27 11:58:21 +02:00
Tom Moor
1c8fadbe02 Merge branch 'tom/socket-refactor' 2022-08-27 11:51:38 +02:00
Apoorv Mishra
4dbad4e46c feat: Support embed configuration (#3980)
* wip

* stash

* fix: make authenticationId nullable fk

* fix: apply generics to resolve compile time type errors

* fix: loosen integration settings

* chore: refactor into functional component

* feat: pass integrations all the way to embeds

* perf: avoid re-fetching integrations

* fix: change attr name to avoid type overlap

* feat: use hostname from embed settings in matcher

* Revert "feat: use hostname from embed settings in matcher"

This reverts commit e7485d9cda4dcf45104e460465ca104a56c67ddc.

* feat: refactor  into a class

* chore: refactor url regex formation as a util

* fix: escape regex special chars

* fix: remove in-house escapeRegExp in favor of lodash's

* fix: sanitize url

* perf: memoize embeds

* fix: rename hostname to url and allow spreading entire settings instead of just url

* fix: replace diagrams with drawio

* fix: rename

* fix: support self-hosted and saas both

* fix: assert on settings url

* fix: move embed integrations loading to hook

* fix: address review comments

* fix: use observer in favor of explicit state setters

* fix: refactor useEmbedIntegrations into useEmbeds

* fix: use translations for toasts

Co-authored-by: Tom Moor <tom.moor@gmail.com>
2022-08-26 12:21:46 +05:30
CuriousCorrelation
24c71c38a5 feat: Document subscriptions (#3834)
Co-authored-by: Tom Moor <tom.moor@gmail.com>
2022-08-25 23:47:13 -07:00
Tom Moor
354a68a8b7 Remove long-deprecated documents.star/documents.unstar 2022-08-25 21:51:34 +02:00
Tom Moor
bb12f1fabb SocketProvider -> WebsocketProvider 2022-08-25 21:34:54 +02:00
Tom Moor
debadcb711 fix: Wrap websocket handlers in action
Separate documents.archive
2022-08-25 21:34:54 +02:00
Tom Moor
d2aea687f3 Remove collection fetch on document delete 2022-08-25 21:34:54 +02:00
Tom Moor
60309975e0 Allow usePolicy to fetch missing policies 2022-08-25 21:34:54 +02:00
Tom Moor
983010b5d8 fix: collections.create event not propagated when initialized with private permissions 2022-08-25 21:34:54 +02:00
Tom Moor
c62bfc4a60 Separate documents.update event 2022-08-25 21:34:54 +02:00
Tom Moor
7804f33e0d Separate teams.update event 2022-08-25 21:34:54 +02:00
Tom Moor
d17e6f3432 Separate documents.delete event 2022-08-25 21:34:54 +02:00
Tom Moor
4f1277f912 Separate groups.delete event 2022-08-25 21:34:54 +02:00
Tom Moor
b172da6fdf Separate collections.delete event 2022-08-25 21:34:54 +02:00
Tom Moor
138bc367dd types 2022-08-25 21:34:54 +02:00
Tom Moor
a869ab7609 fix: Improve error messaging when file cannot be fetched for import
related #4006
2022-08-24 21:25:19 +02:00
Apoorv Mishra
0c51bfb899 perf: reduce memory usage upon running server tests (#3949)
* perf: reduce memory usage upon running server tests

* perf: plug leaks in server/routes

* perf: plug leaks in server/scripts

* perf: plug leaks in server/policies

* perf: plug leaks in server/models

* perf: plug leaks in server/middlewares

* perf: plug leaks in server/commands

* fix: missing await on db.flush

* perf: plug leaks in server/queues

* chore: remove unused legacy funcs

* fix: await on db.flush

* perf: await on GC to run in between tests

* fix: remove db refs

* fix: revert embeds

* perf: plug leaks in shared/i18n
2022-08-11 21:39:17 +05:30
akp
8e1f42a9cb Add optional export notifications (#3935)
* Add `emails.export_completed` notification to settings menu

Signed-off-by: AKP <tom@tdpain.net>

* Don't send email when export_completed notifications are disabled

Signed-off-by: AKP <tom@tdpain.net>

* Automatically subscribe new users to `export_completed` notifications

Signed-off-by: AKP <tom@tdpain.net>

* Alter secondary text on export page to mention optional notifications

Signed-off-by: AKP <tom@tdpain.net>

* Alter toast text on collection export for optional notifications

Signed-off-by: AKP <tom@tdpain.net>

* Only subscribe new admins to export notifs

Signed-off-by: AKP <tom@tdpain.net>

* Move `export_completed` notification decision into `beforeSend`

Signed-off-by: AKP <tom@tdpain.net>

* Update server/emails/templates/ExportFailureEmail.tsx

Co-authored-by: Tom Moor <tom.moor@gmail.com>

* Update server/emails/templates/ExportSuccessEmail.tsx

Co-authored-by: Tom Moor <tom.moor@gmail.com>

Signed-off-by: AKP <tom@tdpain.net>
Co-authored-by: Tom Moor <tom.moor@gmail.com>
2022-08-11 07:31:35 -07:00
Tom Moor
1b00d51c74 fix: Check WebhookSubscription is not disabled before delivery attempt 2022-08-08 11:10:10 +02:00
Tom Moor
ea28dc46eb fix: Error in WebhookProcessor when team is permanatly destroyed 2022-07-26 22:33:48 +01:00
Tom Moor
b7b1f5e1fd fix: Cleanup attachments uploaded to S3 when import fails (#3868) 2022-07-26 12:10:13 -07:00
Tom Moor
f370b0296b fix: File operation cleanup task should also remove import data 2022-07-25 21:10:37 +01:00
Tom Moor
30190866f8 test: Flakey test 2022-07-25 08:59:30 +01:00
Tom Moor
5e852170f9 perf: Read attachment buffers only when neccessary, closes #3849 2022-07-24 19:15:34 +01:00