Comments allow users to provide feedback or collaborate on objects. There are two main areas for comment customization: categories and workflows.
- Comment types: Create a new comment category to define different types of comments.
- Default categories:
Question,Issue,Comment. - Custom categories: For our app, we will create the following types:
Comment,Suggestion, andQuestion.
- Default categories:
- Comment workflows: Assign workflows to comments to manage their lifecycle.
- Define both workflow states (e.g., comment status can be changed from
NewtoAnswered) and transitions, including any restrictions.- Restriction example: only an Admin can mark a comment as
Answered.
- Restriction example: only an Admin can mark a comment as
- Define both workflow states (e.g., comment status can be changed from
Let’s see how to configure custom comments.
Download the full example package here: Recipe Manager (Custom Comments and Comment Workflows).json
1. Create a comment type category
First, create a comment type category asset and define the comment types it includes. Let’s start with a blank template:
"commentTypeCategories": [
{
"key": "",
"name": "",
"defaultCommentTypeKey": "",
"isVisible": true,
"commentTypes": [
{
"key": "",
"name": "",
"colorKey": "",
//"workflowKey": "",
"isVisible": true,
//"isRemovable": true
}
]
}
],
| Property | Purpose |
|---|---|
key | Unique key of the comment type category. This is needed to assign the category to an application. |
name | Display name for the comment category in Dawiso’s UI. |
defaultCommentTypeKey | Key of the comment type selected by default when you add a new comment. |
isVisible | Determines whether the comment category is visible. |
commentTypes | Defines individual comment types within this category. |
Each comment type has the following properties:
| Property | Purpose |
|---|---|
key | Unique key of the comment type. At least one must be assigned as the default (defaultCommentTypeKey). |
name | Display name for the comment type in Dawiso’s UI. |
colorKey | Comment color in Dawiso’s UI. Choose a predefined color from Settings > Configuration > Colors. |
workflowKey | Key of a workflow (optional). Used if we want to track comment resolution status. |
isVisible | Determines whether the comment type is visible. |
isRemovable | Indicates whether the comment type tag can be removed from a comment. |
Example: Recipe Manager comment type category
For the Recipe Manager app, there are three comment types in the Feedback comment type category: Comment, Suggestion, Question.
Click here to show the example.
"commentTypeCategories": [
{
"key": "feedback",
"name": "Feedback",
"defaultCommentTypeKey": "comment",
"isVisible": true,
"commentTypes": [
{
"key": "comment",
"name": "Comment",
"colorKey": "core_light_blue",
"isVisible": true,
"isRemovable": true
},
{
"key": "suggestion",
"name": "Suggestion",
"colorKey": "avatar_green",
"workflowKey": "feedback_workflow",
"isVisible": true,
"isRemovable": true
},
{
"key": "question",
"name": "Question",
"colorKey": "avatar_orange",
"workflowKey": "feedback_workflow",
"isVisible": true,
"isRemovable": true
}
]
}
],2. Assign the comment category to an application
Now that the comment category and comment types are created, we need to assign the category to an application.
To do this, create a commentTypeCategoryApplications asset using the blank template below:
"commentTypeCategoryApplications": [
{
"applicationKey": "",
"commentTypeCategoryKey": ""
}
],
| Property | Purpose |
|---|---|
applicationKey | Key of the application that can use this comment type category. |
commentTypeCategoryKey | Key of the assigned comment type category. |
This can be done in a separate package if you want to:
- Define the category independently.
- Assign the category to multiple applications.
Example: Recipe Manager assigning comment type category
For the recipe manager, we assigned the category in the following way:
Click here to show the example.
"commentTypeCategoryApplications": [
{
"applicationKey": "app",
"commentTypeCategoryKey": "feedback"
}
],3. [Optional] Define comment workflow
Finally, you can define a workflow for comment types that require resolution tracking. This is useful for handling issues or questions that need a clear unresolved-to-resolved workflow.
To set up a comment workflow:
- Create
workflowStates. - Define
workflowsand their transitions. - Assign the workflow to specific comment types.
For more information on workflows, refer to our basic application tutorial.
Example: Recipe Manager app comment workflow
In our example application, workflow is available for the Suggestion and Question comment types to mark which have been resolved.
Click here to show the example.
"workflowStates": [
...
{
"key": "new",
"name": "New",
"iconKey": "core_draft",
"colorKey": "core_empty"
},
{
"key": "answered",
"name": "Answered",
"iconKey": "core_draft",
"colorKey": "core_approved"
}
],
"workflows": [
...
{
"key": "feedback_workflow",
"name": "Feedback Workflow",
"initStateKey": "new",
"isSelectable": false,
"transitions": [
{
"fromStateKey": "new",
"toStateKey": "answered"
},
{
"fromStateKey": "answered",
"toStateKey": "new"
}
]
}
],
...
"commentTypeCategories": [
{
"key": "feedback",
...
"commentTypes": [
{
"key": "comment",
...
},
{
"key": "suggestion",
...
"workflowKey": "feedback_workflow",
...
},
{
"key": "question",
...
"workflowKey": "feedback_workflow",
...
}
]
}
],Let user roles delete comments in a workflow state
To let users with a given user role delete other users’ comments in a certain state, add commentRemovable to the workflow state’s asCommentState property. For example, stewards can delete a comment once it is in the answered state:
{
"key": "answered",
"name": "Answered",
"iconKey": "core_draft",
"colorKey": "core_status_approved",
"asCommentState": {
"commentRemovable": [
{
"userRelationTypeKeys": ["core#steward"],
"commentTypeKeys": ["#comment"]
}
]
}
}
For all rules and the key format, see the workflow states reference.
Revision-scoped comments
Users can filter object comments by revision. To enable this for an object type, flag exactly one of its supported attribute types with the is_revision_attribute feature. Each comment thread then belongs to the revision (a period of that attribute’s value history) that was current when the thread was started. If more than one attribute type is flagged, the filter is switched off. For more information, see features (attribute type).