Spaces:
Sleeping
Sleeping
Delete uploaded numbered files
Browse files
292-groovy-snippet-to-get-the-comment-visibility.md
DELETED
|
@@ -1,44 +0,0 @@
|
|
| 1 |
-
# Groovy snippet to get the comment visibility
|
| 2 |
-
|
| 3 |
-
> المصدر: https://appfire.atlassian.net/wiki/spaces/JMWE/pages/462061873/Groovy+snippet+to+get+the+comment+visibility
|
| 4 |
-
|
| 5 |
-
---
|
| 6 |
-
|
| 7 |
-
### Abstract
|
| 8 |
-
|
| 9 |
-
This code snippet checks the visibility of the comment added on the transition screen
|
| 10 |
-
|
| 11 |
-
### Logic
|
| 12 |
-
|
| 13 |
-
Access the entity property which indicates the visibility of the comment.
|
| 14 |
-
|
| 15 |
-
### Snippet
|
| 16 |
-
|
| 17 |
-
`import groovy.json.JsonParserType
|
| 18 |
-
import groovy.json.JsonSlurper
|
| 19 |
-
def commentProperties = transientVars["commentProperty"] as String[]
|
| 20 |
-
def isInternalComment = false
|
| 21 |
-
if (commentProperties) {
|
| 22 |
-
def commentProperty = commentProperties.first()
|
| 23 |
-
def props = new JsonSlurper().setType(JsonParserType.LAX).parseText(commentProperty)
|
| 24 |
-
isInternalComment = props.find { it.key == "sd.public.comment" }?.get("value")?.get("internal")
|
| 25 |
-
}
|
| 26 |
-
return isInternalComment.toBoolean()`
|
| 27 |
-
|
| 28 |
-
### Placeholders
|
| 29 |
-
|
| 30 |
-
NA
|
| 31 |
-
|
| 32 |
-
### Examples
|
| 33 |
-
|
| 34 |
-
The output of this code is a boolean value that can be used to control the execution of a post-function or a validator. For example,
|
| 35 |
-
|
| 36 |
-
- Send an email to a specific user only when an internal comment is added
|
| 37 |
-
- Block the user from adding unrestricted comments on a specific transition
|
| 38 |
-
|
| 39 |
-
### References
|
| 40 |
-
|
| 41 |
-
- [Issue interface](https://appfire.atlassian.net/wiki/spaces/JMCF/pages/78316748/Issue+interface "https://appfire.atlassian.net/wiki/spaces/JMCF/pages/78316748/Issue+interface")
|
| 42 |
-
- [**Groovy Documentation**](http://groovy.codehaus.org/User+Guide "http://groovy.codehaus.org/User+Guide")
|
| 43 |
-
|
| 44 |
-
### Related articles
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|