GroupsalmonAction updated to stronger typing standards
This commit is contained in:
parent
cdefeda659
commit
595d231d9a
@ -17,9 +17,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET')) {
|
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package OStatusPlugin
|
* @package OStatusPlugin
|
||||||
@ -29,7 +27,7 @@ class GroupsalmonAction extends SalmonAction
|
|||||||
{
|
{
|
||||||
var $group = null;
|
var $group = null;
|
||||||
|
|
||||||
function prepare($args)
|
protected function prepare(array $args=array())
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
|
||||||
@ -42,7 +40,7 @@ class GroupsalmonAction extends SalmonAction
|
|||||||
|
|
||||||
$this->group = User_group::getKV('id', $id);
|
$this->group = User_group::getKV('id', $id);
|
||||||
|
|
||||||
if (empty($this->group)) {
|
if (!$this->group instanceof User_group) {
|
||||||
// TRANS: Client error.
|
// TRANS: Client error.
|
||||||
$this->clientError(_m('No such group.'));
|
$this->clientError(_m('No such group.'));
|
||||||
}
|
}
|
||||||
@ -51,7 +49,7 @@ class GroupsalmonAction extends SalmonAction
|
|||||||
$this->target = $this->group;
|
$this->target = $this->group;
|
||||||
|
|
||||||
$oprofile = Ostatus_profile::getKV('group_id', $id);
|
$oprofile = Ostatus_profile::getKV('group_id', $id);
|
||||||
if ($oprofile) {
|
if ($oprofile instanceof Ostatus_profile) {
|
||||||
// TRANS: Client error.
|
// TRANS: Client error.
|
||||||
$this->clientError(_m('Cannot accept remote posts for a remote group.'));
|
$this->clientError(_m('Cannot accept remote posts for a remote group.'));
|
||||||
}
|
}
|
||||||
@ -124,7 +122,7 @@ class GroupsalmonAction extends SalmonAction
|
|||||||
function handleJoin()
|
function handleJoin()
|
||||||
{
|
{
|
||||||
$oprofile = $this->ensureProfile();
|
$oprofile = $this->ensureProfile();
|
||||||
if (!$oprofile) {
|
if (!$oprofile instanceof Ostatus_profile) {
|
||||||
// TRANS: Client error.
|
// TRANS: Client error.
|
||||||
$this->clientError(_m('Cannot read profile to set up group membership.'));
|
$this->clientError(_m('Cannot read profile to set up group membership.'));
|
||||||
}
|
}
|
||||||
@ -162,7 +160,7 @@ class GroupsalmonAction extends SalmonAction
|
|||||||
function handleLeave()
|
function handleLeave()
|
||||||
{
|
{
|
||||||
$oprofile = $this->ensureProfile();
|
$oprofile = $this->ensureProfile();
|
||||||
if (!$oprofile) {
|
if (!$oprofile instanceof Ostatus_profile) {
|
||||||
// TRANS: Client error displayed when group membership cannot be cancelled
|
// TRANS: Client error displayed when group membership cannot be cancelled
|
||||||
// TRANS: because the remote profile could not be read.
|
// TRANS: because the remote profile could not be read.
|
||||||
$this->clientError(_m('Cannot read profile to cancel group membership.'));
|
$this->clientError(_m('Cannot read profile to cancel group membership.'));
|
||||||
@ -181,7 +179,6 @@ class GroupsalmonAction extends SalmonAction
|
|||||||
// TRANS: Server error. %1$s is a profile URI, %2$s is a group nickname.
|
// TRANS: Server error. %1$s is a profile URI, %2$s is a group nickname.
|
||||||
$this->serverError(sprintf(_m('Could not remove remote user %1$s from group %2$s.'),
|
$this->serverError(sprintf(_m('Could not remove remote user %1$s from group %2$s.'),
|
||||||
$oprofile->uri, $this->group->nickname));
|
$oprofile->uri, $this->group->nickname));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user