Skip to content

Commit

Permalink
automatically record who triggered an event
Browse files Browse the repository at this point in the history
  • Loading branch information
Changaco committed Sep 9, 2021
1 parent 178d643 commit 6a410d8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions liberapay/models/participant.py
Original file line number Diff line number Diff line change
Expand Up @@ -1809,6 +1809,10 @@ def get_balances(self):
# ======

def add_event(self, c, type, payload, recorder=None):
if recorder is None:
state = website.state.get(None)
if state:
recorder = getattr(state.get('user'), 'id', None)
return c.one("""
INSERT INTO events
(participant, type, payload, recorder)
Expand Down

0 comments on commit 6a410d8

Please sign in to comment.