Closed (fixed)
Project:
Activity
Version:
5.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
14 Jan 2008 at 03:38 UTC
Updated:
4 Nov 2009 at 05:30 UTC
Scope is a great feature and ALL/SELF is a great start. However matching feature sets of existing social networks requires a scope defined by user's buddy relationships. I suggest this extension to Activity module:
define('ACTIVITY_SCOPE_BUDDIES_BOTH', 2); // confirmed two-way buddy relationship
define('ACTIVITY_SCOPE_BUDDIES_OF_USER', 3); // one-way buddies named by this user
define('ACTIVITY_SCOPE_BUDDIES_NAMED_BY', 4); // users who named this user a one-way buddy
All three scopes are needed to support one- and two- way relationships. Perhaps more scopes could be added in the future.
Comments
Comment #1
dkruglyak commentedThis should be marked as ready to go...
Comment #2
robertdouglass commentedSo I changed things again before the DRUPAL-5--3-0-BETA version. There is now a new table:
mysql> describe activity_targets;
aid is a fk to activity. target_uid is the person to whom the message should be visible (a $user->uid). Target role is a string defined in hook_activity_info by the implementing modules. Here's an example implementation:
As you see the roles each have their own message templates. This means that an activity message knows the user and the user role, thus has a personalized message. I think this will meet the need you were trying to address with your patch.
Comment #3
dkruglyak commentedOK, this looks like a very substantive update. Several thoughts after reviewing and testing the code:
1) Activities vs. Requests
As I look at your user_relationshipsactivity_activity_info example, does it try to implement requests as activities or merely track activities generated by actions on requests? I think activities should not be confused with requests. Activity is a permanent record of what is happening while request is a transient message that requires a response (which may however generate activities). Request needs to be able to support multiple possible actions (e.g. "Accept", "Bite Chumps", "Ignore"), each tied to a callback (see http://drupal.org/node/203335).
2) Scope vs. Targets/Roles
Adding activity target roles is a great idea and I see how you want them to replace scope. However there is a risk that contrib modules would populate target_role column with non-standard data - that would not aggregate well in per-role views. I suggest defining several constants and documenting the conventions for naming roles. E.g. now you have 'all' and 'author', but have we documented and communicated their semantics? At the very least we should declare and document the constants for these standard roles:
* all => public sitewide visibility
* self => personal notification page (I think 'author' is not good, since many self-actions have nothing to do with authoring)
* friends => ones I proposed originally (perhaps with 3 different flavors, per above)
3) Activity Recording & Display
There are two separate issues, but they are related. As far as Recording, modules like nodeactivity generate a huge number of messages, per every nodetype / operation combo. There should be a checkbox setting to turn them off at the same granularity as messages are customized (e.g. I do not want any activities generated for Usernode). As far as Display, right now the built-in output features ("All Activity", "My Activity") are broken and show no message content. They need to be fixed, but I think we should move the module to use Views (with Usernode), to take advantage of all its power. There should be ways to expose anything from the activity data field.
4) Standards/Conventions for Data Field
Being able to capture any data related to a message is great, but I think we should have some guidelines / conventions for structure of the field. As far as I see this new architecture closely mirrors Facebook Newsfeed / Mini-feed. What would be great is to standardize the data field a little bit to have suggested way to represent every component of the Facebook feed API:
http://wiki.developers.facebook.com/index.php/Feed.publishTemplatizedAction
Please comment or suggest alternative solutions.
Comment #4
robertdouglass commented1) Activities vs. Requests
You're talking about a distinction that only exists at the user_relationships or buddylist module level. The philosophy of the activity module is to let those modules deal with the distinction between a request and an activity. If you leave the field blank on admin/settings/admin, no message will get generated, so you as the administrator also have the power to decide whether a request should be shown or not.
2) Scope vs. Targets/Roles
Again, the roles are completely module specific. Privatemsg might define the 'sender' and 'recipient' roles and not the 'all' role. The 'all' is the only universal one because it is tied to the target user ACTIVITY_ALL. The important thing to keep in mind is that target_uid determines who sees the message, and target_role determines which message template shows it. Thus there is no use in defining or standardizing the roles as they only exist for the benefit of the implementing module.
3) Activity Recording & Display
I want to see an activitypreferences module that lets users decide which activity they see and what activity they have recorded. I've tried to make provisions for this in the base API. Also, for the admin, there is always the option of leaving the message template fields blank and thus not having messages for that combination.
4) Standards/Conventions for Data Field
The Facebook API is great and I want that level of flexibility. I don't know yet that the activity API can handle all of what Facebook does... I think we need some stronger language tools before we can reach that level. Again, though, I don't see much chance of standardizing, other than finding data that is available to all modules and putting that in the activity module's token support. The problem's with standardizing all come from the fact that any module can implement activity support (and that's good).
Comment #5
sirkitree commented5.x unsupported