mirror of
https://github.com/openvk/openvk
synced 2024-11-13 10:39:24 +03:00
Fixup "Groups: Transfer community permissions to another user (#348)"
Didn't notice these problems during the code review :3
This commit is contained in:
parent
1d5a599734
commit
846510ef93
2 changed files with 20 additions and 8 deletions
|
@ -291,7 +291,18 @@ final class GroupPresenter extends OpenVKPresenter
|
|||
$this->flashFail("err", tr("error"), tr("forbidden"));
|
||||
|
||||
$club->setOwner($newOwnerId);
|
||||
$club->addManager($this->user->id);
|
||||
|
||||
$club->addManager($this->user->identity);
|
||||
$oldOwnerManager = $club->getManager($this->user->identity);
|
||||
$oldOwnerManager->setHidden($club->isOwnerHidden());
|
||||
$oldOwnerManager->setComment($club->getOwnerComment());
|
||||
$oldOwnerManager->save();
|
||||
|
||||
$newOwnerManager = $club->getManager($newOwner);
|
||||
$club->setOwner_Hidden($newOwnerManager->isHidden());
|
||||
$club->setOwner_Comment($newOwnerManager->getComment());
|
||||
$club->removeManager($newOwner);
|
||||
|
||||
$club->save();
|
||||
|
||||
$this->flashFail("succ", tr("information_-1"), tr("group_owner_setted", $newOwner->getCanonicalName(), $club->getName()));
|
||||
|
|
|
@ -123,21 +123,22 @@
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
<script n:if="$club->getOwner()->getId() != $user->getId() && $manager && $thisUser->getId() == $club->getOwner()->getId()">
|
||||
console.log("gayshit")
|
||||
function changeOwner(club, newOwner) {
|
||||
let action = "/groups/" + club + "/setNewOwner/" + newOwner;
|
||||
const action = "/groups/" + club + "/setNewOwner/" + newOwner;
|
||||
|
||||
MessageBox(tr("group_changeowner_modal_title"), `
|
||||
tr("group_changeowner_modal_text", {$user->getFullName()})
|
||||
MessageBox({_group_changeowner_modal_title}, `
|
||||
{tr("group_changeowner_modal_text", htmlentities($user->getFullName()))|noescape}
|
||||
<br/><br/>
|
||||
<form id="transfer-owner-permissions-form" method="post">
|
||||
<label for="password">tr("password")</label>
|
||||
<label for="password">{_password|noescape}</label>
|
||||
<input type="password" id="password" name="password" required />
|
||||
<input type="hidden" name="hash" value={$csrfToken} />
|
||||
</form>
|
||||
`, [tr("transfer"), tr("cancel")], [
|
||||
`, [{_transfer}, {_cancel}], [
|
||||
() => {
|
||||
$('#transfer-owner-permissions-form').attr('action', action);
|
||||
$("#transfer-owner-permissions-form").attr("action", action);
|
||||
document.querySelector("#transfer-owner-permissions-form").submit();
|
||||
}, Function.noop
|
||||
]);
|
||||
|
|
Loading…
Reference in a new issue