From 6d3e6b42849ad14b15cb4c41c4f8baac45e58df0 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 28 Dec 2009 10:58:49 -0800 Subject: move flag creation to a method of data object --- plugins/UserFlag/flagprofile.php | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'plugins/UserFlag/flagprofile.php') diff --git a/plugins/UserFlag/flagprofile.php b/plugins/UserFlag/flagprofile.php index 55753f4e8..2d0f0abb9 100644 --- a/plugins/UserFlag/flagprofile.php +++ b/plugins/UserFlag/flagprofile.php @@ -105,19 +105,9 @@ class FlagprofileAction extends ProfileFormAction assert(!empty($user)); assert(!empty($this->profile)); - $ufp = new User_flag_profile(); + // throws an exception on error - $ufp->profile_id = $this->profile->id; - $ufp->user_id = $user->id; - $ufp->created = common_sql_now(); - - if (!$ufp->insert()) { - $msg = sprintf(_("Couldn't flag profile '%s' for review."), - $this->profile->nickname); - throw new ServerException($msg); - } - - $ufp->free(); + User_flag_profile::create($user->id, $this->profile->id); if ($this->boolean('ajax')) { $this->ajaxResults(); -- cgit v1.2.3-54-g00ecf