Skip to content

Commit

Permalink
chore: code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Faraz Maqsood authored and Muhammad Faraz Maqsood committed Sep 16, 2024
1 parent e3cc16a commit f0d0389
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,3 @@ def _url_for_flag_abuse_thread(thread_id):

def _url_for_unflag_abuse_thread(thread_id):
return f"{settings.PREFIX}/threads/{thread_id}/abuse_unflag"


def _url_for_pin_thread(thread_id):
return f"{settings.PREFIX}/threads/{thread_id}/pin"


def _url_for_un_pin_thread(thread_id):
return f"{settings.PREFIX}/threads/{thread_id}/unpin"
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from . import models, settings, utils
from forum import api as forum_api
from forum.utils import ForumV2RequestError


class User(models.Model):

Expand Down Expand Up @@ -142,17 +142,13 @@ def subscribed_threads(self, query_params=None):
)

def _retrieve(self, *args, **kwargs):
url = self.url(action='get', params=self.attributes)
retrieve_params = self.default_retrieve_params.copy()
retrieve_params.update(kwargs)
if self.attributes.get('course_id'):
retrieve_params['course_id'] = str(self.course_id)
if self.attributes.get('group_id'):
retrieve_params['group_id'] = self.group_id
try:
response = forum_api.retrieve_user(self.attributes["id"], retrieve_params)
except ForumV2RequestError as e:
raise str(e)
response = forum_api.retrieve_user(self.attributes["id"], retrieve_params)
self._update_from_response(response)

def retire(self, retired_username):
Expand Down

0 comments on commit f0d0389

Please sign in to comment.