X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FUserFlag%2Fflagprofile.php;h=7096d3748e4cb9fd3cfe2edab43264799d71e6a2;hb=ebaf5a972ef88947d70b6e52393cb600402e7148;hp=283eea40ce157289d811ebc55f5c5071ff0631c7;hpb=67dc78b6218bce86f6b783c34e02775f5b8cb21f;p=quix0rs-gnu-social.git diff --git a/plugins/UserFlag/flagprofile.php b/plugins/UserFlag/flagprofile.php index 283eea40ce..7096d3748e 100644 --- a/plugins/UserFlag/flagprofile.php +++ b/plugins/UserFlag/flagprofile.php @@ -60,13 +60,6 @@ class FlagprofileAction extends ProfileFormAction assert(!empty($user)); // checked above assert(!empty($this->profile)); // checked above - if (User_flag_profile::exists($this->profile->id, - $user->id)) { - // TRANS: Client error when setting flag that has already been set for a profile. - $this->clientError(_m('Flag already exists.')); - return false; - } - return true; } @@ -104,7 +97,13 @@ class FlagprofileAction extends ProfileFormAction // throws an exception on error - User_flag_profile::create($user->id, $this->profile->id); + if (User_flag_profile::exists($this->profile->id, + $user->id)) { + // We'll return to the profile page (or return the updated AJAX form) + // showing the current state, so no harm done. + } else { + User_flag_profile::create($user->id, $this->profile->id); + } if ($this->boolean('ajax')) { $this->ajaxResults();