Improvements to activity stream body helper

Bug #1328760 reported by Nathan Lewis
6
This bug affects 1 person
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 ActivityTypeArtefactCommentFeedback, the object type name is now being calculated using ActivityType::get_object_type_name, which simplifies the code.

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/3434

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/3434
Committed: http://gitorious.org/mahara/mahara/commit/2e47dfb1d51368767f27316172c270cb1b8405c4
Submitter: Aaron Wells (<email address hidden>)
Branch: master

commit 2e47dfb1d51368767f27316172c270cb1b8405c4
Author: Nathan Lewis <email address hidden>
Date: Wed Jun 11 15:26:37 2014 +1200

Improvements to activity stream body helper (Bug #1328760)

Change-Id: Ie1c127c1677efef5ce3d48f2b187f91fc60837cb
Signed-off-by: Nathan Lewis <email address hidden>

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/3439

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Patch for "master" branch: https://reviews.mahara.org/3440

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/3439
Committed: http://gitorious.org/mahara/mahara/commit/a6ebd6beee38476b2ae297783a5079f2bcd8344f
Submitter: Yuliya Bozhko (<email address hidden>)
Branch: master

commit a6ebd6beee38476b2ae297783a5079f2bcd8344f
Author: Aaron Wells <email address hidden>
Date: Fri Jun 13 13:40:45 2014 +1200

Pluralize this string even though it's not currently used (Bug 1328760)

The way the code is written, the count passed to "participantsmany" will
always be 2 or more. Therefore, the singular version of this string will
never be used, the way the code is currently written.

However, I think it's a good idea to store it as a proper pluralizable string
anyway, because having it as an array may be necessary in order for it to get
detected as a pluralizable string by the software translators are using. And
it's also possible that future code development could result in the number 1
getting passed to this string.

Change-Id: I87487e2cb64de53b144b19162392b3c0adda860c

Revision history for this message
Aaron Wells (u-aaronw) wrote :

Totara has asked us not to merge in the activity stream.

Changed in mahara:
status: New → Won't Fix
tags: added: activitystream
Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/3459
Committed: http://gitorious.org/mahara/mahara/commit/82c845d95cb719a32b8ac2647babd4d0b2739c9e
Submitter: Yuliya Bozhko (<email address hidden>)
Branch: master

commit 82c845d95cb719a32b8ac2647babd4d0b2739c9e
Author: Nathan Lewis <email address hidden>
Date: Tue Jun 24 13:12:37 2014 +1200

Reverting activity stream patches (Bug #1316324)

Content from the following commits was reverted:

Patch 3327: 7a7673c052687558e4dd1df0286c938069ed26df
"Add activity stream block (Bug #1316324)"

Patch 3374: c538c7451be5076764ec6440a49331768a13414f
"Add likes to activity streams (Bug #1321480)"

Patch 3432: 121e90279fb8f72d81f47c5302726b6a93b7c776
"Add new parameters to the get_activity_body function (Bug #1328729)"

Patch 3434: 2e47dfb1d51368767f27316172c270cb1b8405c4
"Improvements to activity stream body helper (Bug #1328760)"

Change-Id: Id03c156a7c8c016c8dc76c998a73310ea57fe0a5
Signed-off-by: Nathan Lewis <email address hidden>

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.