not all that better way to distinguish add book to shelf vs tag

This commit is contained in:
Mouse Reeve 2020-11-28 18:23:34 -08:00
parent b4fe9f160f
commit 1789b091d6

View file

@ -293,11 +293,11 @@ def handle_unboost(activity):
@app.task @app.task
def handle_add(activity): def handle_add(activity):
''' putting a book on a shelf ''' ''' putting a book on a shelf '''
# TODO absofuckinglutely not an acceptable solution #this is janky as heck but I haven't thought of a better solution
if 'tag' in activity['id']: try:
activitypub.AddBook(**activity).to_model(models.Tag)
else:
activitypub.AddBook(**activity).to_model(models.ShelfBook) activitypub.AddBook(**activity).to_model(models.ShelfBook)
except activitypub.ActivitySerializerError:
activitypub.AddBook(**activity).to_model(models.Tag)
@app.task @app.task