X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Feditgroup.php;h=4b596cade95cb22871904d1b0ed34781fea56f30;hb=c6f09306b1c72296db8b55500a5d6a2ea8cd5dd2;hp=cf160803563ddc651459fe60393a4feb9aeadecb;hpb=ac47015e2b9b4a82ef497d203fb971b7f128ad41;p=quix0rs-gnu-social.git diff --git a/actions/editgroup.php b/actions/editgroup.php index cf16080356..4b596cade9 100644 --- a/actions/editgroup.php +++ b/actions/editgroup.php @@ -81,26 +81,30 @@ class EditgroupAction extends GroupDesignAction } if (!$nickname) { - $this->clientError(_('No nickname'), 404); + $this->clientError(_('No nickname.'), 404); return false; } $groupid = $this->trimmed('groupid'); + if ($groupid) { $this->group = User_group::staticGet('id', $groupid); } else { - $this->group = User_group::staticGet('nickname', $nickname); + $local = Local_group::staticGet('nickname', $nickname); + if ($local) { + $this->group = User_group::staticGet('id', $local->group_id); + } } if (!$this->group) { - $this->clientError(_('No such group'), 404); + $this->clientError(_('No such group.'), 404); return false; } $cur = common_current_user(); if (!$cur->isAdmin($this->group)) { - $this->clientError(_('You must be an admin to edit the group'), 403); + $this->clientError(_('You must be an admin to edit the group.'), 403); return false; } @@ -165,7 +169,7 @@ class EditgroupAction extends GroupDesignAction { $cur = common_current_user(); if (!$cur->isAdmin($this->group)) { - $this->clientError(_('You must be an admin to edit the group'), 403); + $this->clientError(_('You must be an admin to edit the group.'), 403); return; } @@ -245,6 +249,7 @@ class EditgroupAction extends GroupDesignAction $this->group->homepage = $homepage; $this->group->description = $description; $this->group->location = $location; + $this->group->mainpage = common_local_url('showgroup', array('nickname' => $nickname)); $result = $this->group->update($orig); @@ -259,6 +264,12 @@ class EditgroupAction extends GroupDesignAction $this->serverError(_('Could not create aliases.')); } + if ($nickname != $orig->nickname) { + common_log(LOG_INFO, "Saving local group info."); + $local = Local_group::staticGet('group_id', $this->group->id); + $local->setNickname($nickname); + } + $this->group->query('COMMIT'); if ($this->group->nickname != $orig->nickname) { @@ -272,10 +283,10 @@ class EditgroupAction extends GroupDesignAction function nicknameExists($nickname) { - $group = User_group::staticGet('nickname', $nickname); + $group = Local_group::staticGet('nickname', $nickname); if (!empty($group) && - $group->id != $this->group->id) { + $group->group_id != $this->group->id) { return true; }