m14t/sots — Issue #96: Integrate achievement events with action events
Author: aaronhall
Created: 2011-11-04 13:55:00+00:00
State: open

Each is implemented separately, and overlap in some places.

See `lib/action_event' and `lib/user_event`. The plan is to refactor the action events and use `lib/user_event/sotsUserEvent` as a base for them.

@m14t - a few notes if you have to deal with this today:

sotsUserEvents are only used for the achievements right now. sotsUserEvents should be added to the sotsUserEventSchema in myUser. The results of events added to the schema (like new achievements for users) aren't applied in the database until `sotsUserEventSchema::trigger` is called. The component included at the bottom of the layout to render the notifications (`notifications/renderComponent`) calls that `trigger` method. The gotcha is if an event is added and the request is redirected before that renderComponent is executed (you have to call that `trigger()` method yourself on the schema (calling it on the event itself won't work as expected -- something else to cleanup)). I'll figure out a better way to do this later.

Action events (`lib/action_event`) are used to trigger user actions (like reading or sharing an update, pledging, etc.). Examples for triggering those events are in `apps/frontend/modules/action_demo/actions/actions.class.php`. BaseActionEvents don't use sotsUserEventSchema, they're just fired and applied to the user one at a time.