Skip to content

Enable updates on ProjectIssueNotes#113

Merged
gpocentek merged 3 commits intopython-gitlab:masterfrom
adamreid:master
May 12, 2016
Merged

Enable updates on ProjectIssueNotes#113
gpocentek merged 3 commits intopython-gitlab:masterfrom
adamreid:master

Conversation

@adamreid
Copy link
Copy Markdown

@adamreid adamreid commented May 6, 2016

According to the GitLab API Docs Issue comments can be updated by api calls. This very minor change enables this in python-gitlab

This is useful to me and perhaps others for things like annotating comments with references to external issue trackers not supported in GitLab already. This change would allow notes on issues to be modified and saved, for example:

import os
from gitlab import Gitlab
gl = Gitlab(os.environ['GITLAB_HOST'], os.environ['GITLAB_TOKEN'])
note = gl.project.get('adamreid/test').issues.get(1).notes.get(1)
note.body = note.body.replace('issue:1234','issue:[1234](http://issues.example.com/issue/1234)')
note.save()

_url = '/projects/%(project_id)s/issues/%(issue_id)s/notes'
_constructorTypes = {'author': 'User'}
canUpdate = False
canUpdate = True
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the line (canUpdate defaults to True in the GitlabObject class).

Otherwise looks good.

@gpocentek gpocentek merged commit f5c75cb into python-gitlab:master May 12, 2016
@gpocentek
Copy link
Copy Markdown
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants