Improvements to activity stream body helper
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mahara |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
Aaron reported the following when reviewing the activity stream block patch:
1. There are some strings with counts in them that need to be changed to the flexible plural format.
2. There's a big chain of if-elses in lib/activity.php starting on line 1055, which are for sending different sets of parameters to get_string depending on what was passed in. I suspect we may be able to reduce that by using sprintf positional parameters.
The patch will fix the above and more. The changes include the following:
- Removed the big if-then-else statement. Now, all params are passed to all activity stream strings and the string specifies which params to use where, using parameter position notation (e.g. "%1$d"). As a result of this there was a lot of simplification of the code (not just the big "if").
- Made several strings pluralized where applicable.
- The 'viewer' can be passed in to the helper function. All strings in the helper now user the specified user's language, rather than defaulting to $USER.
- In ActivityTypeArt
Patch for "master" branch: https:/ /reviews. mahara. org/3434