def _process_notify(cls, account, op_json, block_date): """Handle legacy 'follow' plugin ops (follow/mute/clear, reblog) mark_read {date: {type: 'date'}} """ try: command, payload = valid_op_json(op_json) valid_command(command, valid=('setLastRead')) if command == 'setLastRead': valid_keys(payload, optional=['date']) explicit_date = payload.get('date', None) if explicit_date is None: date = block_date log.info( "setLastRead op: `%s' uses implicit head block time: `%s'", op_json, block_date) else: date = valid_date(explicit_date) if date > block_date: log.warning( "setLastRead::date: `%s' exceeds head block time. Correcting to head block time: `%s'", date, block_date) date = block_date Notify.set_lastread(account, date) except AssertionError as e: log.warning("notify op fail: %s in %s", e, op_json)
def _process_notify(cls, account, op_json, block_date): """Handle legacy 'follow' plugin ops (follow/mute/clear, reblog) mark_read {date: {type: 'date'}} """ try: command, payload = valid_op_json(op_json) valid_command(command, valid=('setLastRead')) if command == 'setLastRead': valid_keys(payload, required=['date']) date = valid_date(payload['date']) assert date <= block_date Notify.set_lastread(account, date) except AssertionError as e: log.warning("notify op fail: %s in %s", e, op_json)