Skip to content

Commit c6926e6

Browse files
authored
Merge pull request #193 from Urgau/fix-delegated-comment
Fix delegate comment
2 parents 0d97917 + 7aded29 commit c6926e6

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

homu/comments.py

+9
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ def render(self):
6666

6767

6868
class Delegated(Comment):
69+
def __init__(self, bot=None, **args):
70+
# Because homu needs to leave a comment for the delegated person,
71+
# we need to know the correct botname to use. However, we don't want to
72+
# save that botname in our state JSON. So we need a custom constructor
73+
# to grab the botname and delegate the rest of the keyword args to the
74+
# Comment constructor.
75+
super().__init__(**args)
76+
self.bot = bot
77+
6978
params = ["delegator", "delegate"]
7079

7180
def render(self):

homu/main.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,8 @@ def parse_commands(body, username, user_id, repo_label, repo_cfg, state,
664664
if realtime:
665665
state.add_comment(comments.Delegated(
666666
delegator=username,
667-
delegate=state.delegate
667+
delegate=state.delegate,
668+
bot=my_username
668669
))
669670

670671
elif command.action == 'undelegate':
@@ -684,7 +685,8 @@ def parse_commands(body, username, user_id, repo_label, repo_cfg, state,
684685
if realtime:
685686
state.add_comment(comments.Delegated(
686687
delegator=username,
687-
delegate=state.delegate
688+
delegate=state.delegate,
689+
bot=my_username
688690
))
689691

690692
elif command.action == 'retry' and realtime:

0 commit comments

Comments
 (0)