Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira-Python: add_comment() does not post as internal comment.

pchang38
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 11, 2018

I have a script that is supposed to add a comment after updating the groups of a user:

 

Example, Calling the function:

jira_comment(jira, jira_issue, "This user has been added to jira groups: {0} by slack user: {1}".format(jira_groups, slack_username), True)

Function:

if internal_flag:
resp = jira_object.add_comment(
issue=issue,
body=comment,
visibility=None,
is_internal=True
)
else:
resp = jira_object.add_comment(
issue=issue,
body=comment,
visibility=None,
is_internal=False
)







I expected the comment to be "Restricted to Service Desk Team" but it fails to do so and the comment is visible for any user. Any help? 

 

3 answers

0 votes
Валентин Нелипенко
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 22, 2021

Вот примеры добавления внутреннего и публичного комментариев.

"""Запрос на добавление комментария в задаче"""
issue = jira.issue('SD-503')
comment = jira.add_comment(issue, 'Внутренний комментарий', visibility={'key': 'sd.public.comment'},
is_internal=True)
"""Добавление внутреннего комментария в задаче"""

issue = jira.issue('SD-503')
comment = jira.add_comment(issue, 'Публичный комментарий')
"""Добавление публичного комментария в задаче"""

0 votes
pchang38
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 12, 2018

Hi, Gonchik

 

I am using jira-python module to generate the json. I took a quick look and it looks like they just take in the arguments from the "add_comment()" function and form a dictionary then json.dumps() before making a requests.

 

I am using the function and passing in True for the variable: "is_internal" when calling it.

 

Here is the source code for the function:

https://jira.readthedocs.io/en/master/_modules/jira/client.html#JIRA.add_comment

Thanks,

Peter

arpitha U
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 23, 2019

Hello,

Am having the same issue. Were you able to get this working and add comment restricted to team members? 

 

Thanks

Arpi

0 votes
Gonchik Tsymzhitov
Community Champion
September 11, 2018

Hi! 

May I know you function generate the correct json ? 

like this

{"body":comment, "properties":[{"key":"sd.public.comment","value":{"internal":True}},]}

 

Also, I will be happy if you create Pull Request into this repo this https://github.com/AstroMatt/atlassian-python-api

 

Thanks 

Cheers,

Gonchik Tsymzhitov

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events