forked from bluesky-social/atproto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Manage communication templates for moderation purposes (bluesky-soc…
…ial#2045) * ✨ Add initial lexicons to manage communication templates * ✨ All 3 endpoints are functional * ✨ Add list and delete endpoints * ✅ Add tests for communication template CRUD * 🔒 Allow only admins to create and update templates * 🧹 Cleanup according to PR review * ✨ Make updatedBy and createdBy optional in lexicon * ✨ Typo * ✨ Allow string id and update lexicon language * ✅ Fix tests * ✨ content -> contentMarkdown * ✨ Change column name in db table * add changeset --------- Co-authored-by: Devin Ivy <[email protected]>
- Loading branch information
Showing
52 changed files
with
2,581 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@atproto/api': patch | ||
--- | ||
|
||
support new lexicons for admin communication templates |
43 changes: 43 additions & 0 deletions
43
lexicons/com/atproto/admin/createCommunicationTemplate.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "com.atproto.admin.createCommunicationTemplate", | ||
"defs": { | ||
"main": { | ||
"type": "procedure", | ||
"description": "Administrative action to create a new, re-usable communication (email for now) template.", | ||
"input": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"required": ["subject", "contentMarkdown", "name"], | ||
"properties": { | ||
"name": { | ||
"type": "string", | ||
"description": "Name of the template." | ||
}, | ||
"contentMarkdown": { | ||
"type": "string", | ||
"description": "Content of the template, markdown supported, can contain variable placeholders." | ||
}, | ||
"subject": { | ||
"type": "string", | ||
"description": "Subject of the message, used in emails." | ||
}, | ||
"createdBy": { | ||
"type": "string", | ||
"format": "did", | ||
"description": "DID of the user who is creating the template." | ||
} | ||
} | ||
} | ||
}, | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "ref", | ||
"ref": "com.atproto.admin.defs#communicationTemplateView" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
lexicons/com/atproto/admin/deleteCommunicationTemplate.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "com.atproto.admin.deleteCommunicationTemplate", | ||
"defs": { | ||
"main": { | ||
"type": "procedure", | ||
"description": "Delete a communication template.", | ||
"input": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"required": ["id"], | ||
"properties": { | ||
"id": { "type": "string" } | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
lexicons/com/atproto/admin/listCommunicationTemplates.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "com.atproto.admin.listCommunicationTemplates", | ||
"defs": { | ||
"main": { | ||
"type": "query", | ||
"description": "Get list of all communication templates.", | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"required": ["communicationTemplates"], | ||
"properties": { | ||
"communicationTemplates": { | ||
"type": "array", | ||
"items": { | ||
"type": "ref", | ||
"ref": "com.atproto.admin.defs#communicationTemplateView" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
lexicons/com/atproto/admin/updateCommunicationTemplate.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "com.atproto.admin.updateCommunicationTemplate", | ||
"defs": { | ||
"main": { | ||
"type": "procedure", | ||
"description": "Administrative action to update an existing communication template. Allows passing partial fields to patch specific fields only.", | ||
"input": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"required": ["id"], | ||
"properties": { | ||
"id": { | ||
"type": "string", | ||
"description": "ID of the template to be updated." | ||
}, | ||
"name": { | ||
"type": "string", | ||
"description": "Name of the template." | ||
}, | ||
"contentMarkdown": { | ||
"type": "string", | ||
"description": "Content of the template, markdown supported, can contain variable placeholders." | ||
}, | ||
"subject": { | ||
"type": "string", | ||
"description": "Subject of the message, used in emails." | ||
}, | ||
"updatedBy": { | ||
"type": "string", | ||
"format": "did", | ||
"description": "DID of the user who is updating the template." | ||
}, | ||
"disabled": { | ||
"type": "boolean" | ||
} | ||
} | ||
} | ||
}, | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "ref", | ||
"ref": "com.atproto.admin.defs#communicationTemplateView" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.