Skip to content

Enable updates on ProjectIssueNotes #113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 12, 2016
Merged

Conversation

adamreid
Copy link

@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()

@@ -935,7 +935,7 @@ class ProjectHookManager(BaseManager):
class ProjectIssueNote(GitlabObject):
_url = '/projects/%(project_id)s/issues/%(issue_id)s/notes'
_constructorTypes = {'author': 'User'}
canUpdate = False
canUpdate = True
Copy link
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
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