mconf-web
mconf-web copied to clipboard
Move creation of recent activities from controllers to models/observers
Author Name: Leonardo Daronco (Leonardo Daronco) Original Redmine Issue: 1128, http://dev.mconf.org/redmine/issues/1128
Currently, recent activity items are created in the controllers, when an object is created or updated. The only reason this is not done in models/observer, is because we need access to the current user, the user that created/updated the model, but we don't have it in the models.
Adding an attribute to store the user that created the model in all models that crrently create recent activities in the controllers (spaces, posts, events, news) would solve the issue. And having this attribute is not only interesting for the recent activities, but to show to the users and for admins to know who created the models.
Original Redmine Comment Author Name: Leonardo Daronco (Leonardo Daronco) Original Date: 2014-10-27T17:56:31Z
The version of Public Activity current in development (2.x) apparently has a way of accessing the controller and the current user from the model, see https://github.com/pokonski/public_activity#set-the-activitys-owner-to-current_user-by-default So it might be better to move things to the models after migrating to the new Public Activity.