Skip to content

Commit 2c62d91

Browse files
authored
Merge pull request #1836 from python-gitlab/jlvillal/id_to_encodedid
chore(objects): use `self.encoded_id` where applicable
2 parents 34110dd + 75758bf commit 2c62d91

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

gitlab/v4/objects/todos.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def mark_as_done(self, **kwargs: Any) -> Dict[str, Any]:
2727
Returns:
2828
A dict with the result
2929
"""
30-
path = f"{self.manager.path}/{self.id}/mark_as_done"
30+
path = f"{self.manager.path}/{self.encoded_id}/mark_as_done"
3131
server_data = self.manager.gitlab.http_post(path, **kwargs)
3232
if TYPE_CHECKING:
3333
assert isinstance(server_data, dict)

gitlab/v4/objects/users.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def block(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
179179
Returns:
180180
Whether the user status has been changed
181181
"""
182-
path = f"/users/{self.id}/block"
182+
path = f"/users/{self.encoded_id}/block"
183183
server_data = self.manager.gitlab.http_post(path, **kwargs)
184184
if server_data is True:
185185
self._attrs["state"] = "blocked"
@@ -200,7 +200,7 @@ def follow(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
200200
Returns:
201201
The new object data (*not* a RESTObject)
202202
"""
203-
path = f"/users/{self.id}/follow"
203+
path = f"/users/{self.encoded_id}/follow"
204204
return self.manager.gitlab.http_post(path, **kwargs)
205205

206206
@cli.register_custom_action("User")
@@ -218,7 +218,7 @@ def unfollow(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
218218
Returns:
219219
The new object data (*not* a RESTObject)
220220
"""
221-
path = f"/users/{self.id}/unfollow"
221+
path = f"/users/{self.encoded_id}/unfollow"
222222
return self.manager.gitlab.http_post(path, **kwargs)
223223

224224
@cli.register_custom_action("User")
@@ -236,7 +236,7 @@ def unblock(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
236236
Returns:
237237
Whether the user status has been changed
238238
"""
239-
path = f"/users/{self.id}/unblock"
239+
path = f"/users/{self.encoded_id}/unblock"
240240
server_data = self.manager.gitlab.http_post(path, **kwargs)
241241
if server_data is True:
242242
self._attrs["state"] = "active"
@@ -257,7 +257,7 @@ def deactivate(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
257257
Returns:
258258
Whether the user status has been changed
259259
"""
260-
path = f"/users/{self.id}/deactivate"
260+
path = f"/users/{self.encoded_id}/deactivate"
261261
server_data = self.manager.gitlab.http_post(path, **kwargs)
262262
if server_data:
263263
self._attrs["state"] = "deactivated"
@@ -278,7 +278,7 @@ def activate(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
278278
Returns:
279279
Whether the user status has been changed
280280
"""
281-
path = f"/users/{self.id}/activate"
281+
path = f"/users/{self.encoded_id}/activate"
282282
server_data = self.manager.gitlab.http_post(path, **kwargs)
283283
if server_data:
284284
self._attrs["state"] = "active"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy