Flags (new and updated tags)
On the projects screen, you may see flags like “new” or “updated” against projects, assets or files:
catalog_flags (API class CatalogFlags. Anything older than its expires field is automatically removed.
The flags are set from the Events model:
updateFlags is supplied an event and a list of users. It then upserts (creates or updates) that flag per-user. The CatalogFlags determines whether an event is a project, asset, or file level flag by extracting that information from the event in the collect() function.
The UI inspects project.$flags (an array of strings, generally empty if nothing is new/updated) to determine whether to display flags.
To do anything with flags, an event has to:
- Be triggered by something - i.e. have a rule - you can see a list of rules in Events::$_rules.
- Have a collector in the
CatalogFlags::collect()function. - Have one or more users returned from the
Events::__users()function - Each matching user gets a flag set. If not users match, no flags set.
Serving flags to the user
There is a Flags proxy. If a controller wants to embed flags, it can do something like:project for project flags, file for file flags, etc.
Troubleshooting
We have historically had many issues with this system. Places to look:- Are flags being set by events?
- Are the flags set for all the users they are supposed to be?
- Have users somehow cleared flags?
- I don’t think they can do this, but…
- Is an event being created?
- At the time of writing, there is no event for project update, for example, in Events::$_rules
- Is there a collector in
CatalogFlags::collect()function for the event? - Maybe if there are more than
Xusers it fails? - When the events are created, is the date being set correctly?
- See the mongo docs on
expireAfterSeconds
Specific test scripts
Testing asset updates (Events::ASSET_UPDATE)
TODO how in the heck does this work?????!!!!Back to docs index | Next page in recommended reading order >>