Skip to content

Commit f002a22

Browse files
authored
✨(global) allow user to send internal message through ThreadEvent (#566)
When a Thread has several accesses or is linked to a shared mailbox, an input allows to post internal messages. It also allows to mention user in a message. The ThreadEvent model is the foundation to enrich Threads with further kind of event. Co-authored-by: Sylvain Zimmer <sylvinus@users.noreply.github.com>
1 parent 5a9bfd5 commit f002a22

File tree

59 files changed

+5267
-109
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+5267
-109
lines changed

.github/ISSUE_TEMPLATE/Bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ A clear and concise description of what you expected to happen (or code).
1818
3. And then the bug happens!
1919

2020
**Environment**
21-
- Drive version:
21+
- Message version:
2222
- Platform:
2323

2424
**Possible Solution**

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,10 @@ showmigrations: ## show all migrations for the messages project.
393393
@$(MANAGE_DB) showmigrations
394394
.PHONY: showmigrations
395395

396-
superuser: ## Create an admin superuser with password "admin"
396+
superuser: ## Create an admin superuser with password "admin" and promote user1 as superuser
397397
@echo "$(BOLD)Creating a Django superuser$(RESET)"
398398
@$(MANAGE_DB) createsuperuser --email admin@admin.local --password admin
399+
@$(MANAGE_DB) createsuperuser --email user1@example.local --password user1
399400
.PHONY: superuser
400401

401402
shell-back: ## open a shell in the backend container

src/backend/core/admin.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,11 +422,21 @@ class ThreadAccessInline(admin.TabularInline):
422422
readonly_fields = ("read_at", "starred_at")
423423

424424

425+
class ThreadEventInline(admin.TabularInline):
426+
"""Inline class for the ThreadEvent model"""
427+
428+
model = models.ThreadEvent
429+
autocomplete_fields = ("author", "channel")
430+
raw_id_fields = ("message",)
431+
readonly_fields = ("created_at",)
432+
extra = 0
433+
434+
425435
@admin.register(models.Thread)
426436
class ThreadAdmin(admin.ModelAdmin):
427437
"""Admin class for the Thread model"""
428438

429-
inlines = [ThreadAccessInline]
439+
inlines = [ThreadAccessInline, ThreadEventInline]
430440
list_display = (
431441
"id",
432442
"subject",

0 commit comments

Comments
 (0)