mirror of
https://github.com/directus/directus.git
synced 2026-04-03 03:00:39 -04:00
Add notifications system and support user mentions in comments (#9861)
* v-menu de/activated onKeyDown. No List yet. * v-list * add user suggestion * uuids replaced * user-popover working * avatars flex row with usernames in suggestions * added space to end of uuid insert * autofocus + move caret to end of last insert * removed unnecessary setTimeout() * fixed filter 500 with ids * better fix * New translations en-US.yaml (French) (#9907) * New translations en-US.yaml (French) (#9912) * New translations en-US.yaml (French) (#9916) * New translations en-US.yaml (Russian) (#9918) * New translations en-US.yaml (Swedish) (#9920) * Email updates (#9921) * add from name for emails * updatd email template style * reset password email copy * updated logo to newest version * update invite email copy * decouple field template logic * push up styling * Start on new v-template-input * Add notifications API endpoints Squashed commit of the following: commit 9d86721ef795d03bc55693c0f99bde8e269d60e9 Merge: b4458c19f34131d06eAuthor: rijkvanzanten <rijkvanzanten@me.com> Date: Mon Nov 22 09:27:43 2021 -0500 Merge branch 'mentions' into mentions-api commit b4458c19f7c54f18fa415fc04c63642c2f5a17b0 Author: rijkvanzanten <rijkvanzanten@me.com> Date: Thu Nov 18 18:34:04 2021 -0500 Remove unused import commit e6a9d36bbfdf95cb18d29336da61ecb14b677934 Author: rijkvanzanten <rijkvanzanten@me.com> Date: Thu Nov 18 18:28:31 2021 -0500 Extract user mentions from comments commit b3e571a2daa287e1740a050096913662a57e9861 Merge: c93b833d2af2a6dd7fAuthor: rijkvanzanten <rijkvanzanten@me.com> Date: Thu Nov 18 17:39:52 2021 -0500 Merge branch 'mentions' into mentions-api commit c93b833d2b848e306c434b370d4e4e11967e85d0 Author: rijkvanzanten <rijkvanzanten@me.com> Date: Thu Nov 18 17:35:45 2021 -0500 Send emails w/ parsed MD commit 64bbd6596f20a07028d2387d60e33dfe4f91c032 Author: rijkvanzanten <rijkvanzanten@me.com> Date: Thu Nov 18 16:18:16 2021 -0500 Add notifications endpoint + permissions commit fba55c02dc9c303a38b1b958350684cccd3dd82c Author: rijkvanzanten <rijkvanzanten@me.com> Date: Thu Nov 18 15:33:28 2021 -0500 Add system data for notifications * push * Make v-template-input work * Add the two-way binding * submit button posting, not clearing text area * comment text area clearing on submit * Replace insertion correctly * Added scope support to LDAP group and user search (#9529) * Added scope support LDAP group and user search * Fixed linter screwing up my markdown * Update docs/configuration/config-options.md * Always return correct DN for user with sub scope * Fix indeterminate meta and schema property in advanded field creation (#9924) * Fix impossibility to save M2M (alterations not triggered) (#9992) * Fix alterations refactor * fix roles aggregate query (#9994) * Update iis.md (#9998) added the IIS URL Rewrite module as a requirement * New translations en-US.yaml (English, United Kingdom) (#10001) * Fix LDAP race condition (#9993) * Fix input ui * Revert changes to v-field-template * Update mentions permissions * Fix linter warnings * Optimize sending flow * Revert "Rename activity->notifications module (#9446)" This reverts commit428e5d4ea9. * Add notifications drawer * Update migrations * Improve constraints * Add email notifications toggle on users * Add docs, fix graphql support * Move caret-pos to devdeps * Remove unused new triggerKeyPressed system * Remove unused use-caret composable Co-authored-by: Nitwel <nitwel@arcor.de> Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com> Co-authored-by: Ben Haynes <ben@rngr.org> Co-authored-by: Aiden Foxx <aiden.foxx@sbab.se> Co-authored-by: Oreille <33065839+Oreilles@users.noreply.github.com> Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com> Co-authored-by: Paul Boudewijn <paul@helderinternet.nl>
This commit is contained in:
29
api/src/database/migrations/20211118A-add-notifications.ts
Normal file
29
api/src/database/migrations/20211118A-add-notifications.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { Knex } from 'knex';
|
||||
|
||||
export async function up(knex: Knex): Promise<void> {
|
||||
await knex.schema.createTable('directus_notifications', (table) => {
|
||||
table.increments();
|
||||
table.timestamp('timestamp').notNullable();
|
||||
table.string('status').defaultTo('inbox');
|
||||
table.uuid('recipient').notNullable().references('id').inTable('directus_users').onDelete('CASCADE');
|
||||
table.uuid('sender').notNullable().references('id').inTable('directus_users');
|
||||
table.string('subject').notNullable();
|
||||
table.text('message');
|
||||
table.string('collection', 64);
|
||||
table.string('item');
|
||||
});
|
||||
|
||||
await knex.schema.alterTable('directus_users', (table) => {
|
||||
table.boolean('email_notifications').defaultTo(true);
|
||||
});
|
||||
|
||||
await knex('directus_users').update({ email_notifications: true });
|
||||
}
|
||||
|
||||
export async function down(knex: Knex): Promise<void> {
|
||||
await knex.schema.dropTable('directus_notifications');
|
||||
|
||||
await knex.schema.alterTable('directus_users', (table) => {
|
||||
table.dropColumn('email_notifications');
|
||||
});
|
||||
}
|
||||
@@ -72,6 +72,20 @@
|
||||
- collection: directus_settings
|
||||
action: read
|
||||
|
||||
- collection: directus_notifications
|
||||
action: read
|
||||
permissions:
|
||||
recipient:
|
||||
_eq: $CURRENT_USER
|
||||
fields: '*'
|
||||
|
||||
- collection: directus_notifications
|
||||
action: update
|
||||
permissions:
|
||||
recipient:
|
||||
_eq: $CURRENT_USER
|
||||
fields: 'status'
|
||||
|
||||
- collection: directus_users
|
||||
action: read
|
||||
permissions:
|
||||
|
||||
@@ -63,3 +63,5 @@ data:
|
||||
note: $t:directus_collection.directus_dashboards
|
||||
- collection: directus_panels
|
||||
note: $t:directus_collection.directus_panels
|
||||
- collection: directus_notifications
|
||||
note: $t:directus_collection.directus_notifications
|
||||
|
||||
12
api/src/database/system-data/fields/notifications.yaml
Normal file
12
api/src/database/system-data/fields/notifications.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
table: directus_notifications
|
||||
|
||||
fields:
|
||||
- field: id
|
||||
- field: timestamp
|
||||
special: date-created
|
||||
- field: recipient
|
||||
- field: sender
|
||||
- field: subject
|
||||
- field: message
|
||||
- field: collection
|
||||
- field: item
|
||||
@@ -90,6 +90,11 @@ fields:
|
||||
special: conceal
|
||||
width: half
|
||||
|
||||
- field: email_notifications
|
||||
interface: boolean
|
||||
width: half
|
||||
special: boolean
|
||||
|
||||
- field: admin_divider
|
||||
interface: presentation-divider
|
||||
options:
|
||||
|
||||
@@ -82,3 +82,9 @@ data:
|
||||
- many_collection: directus_panels
|
||||
many_field: user_created
|
||||
one_collection: directus_users
|
||||
- many_collection: directus_notifications
|
||||
many_field: recipient
|
||||
one_collection: directus_users
|
||||
- many_collection: directus_notifications
|
||||
many_field: sender
|
||||
one_collection: directus_users
|
||||
|
||||
Reference in New Issue
Block a user