diff --git a/Web/Presenters/GroupPresenter.php b/Web/Presenters/GroupPresenter.php
index a253ea72..1314a1a4 100644
--- a/Web/Presenters/GroupPresenter.php
+++ b/Web/Presenters/GroupPresenter.php
@@ -269,4 +269,20 @@ final class GroupPresenter extends OpenVKPresenter
$this->notFound();
}
}
+
+ function renderChangeOwner(int $id, int $newOwnerID): void
+ {
+ $this->assertUserLoggedIn();
+ $this->willExecuteWriteAction();
+
+ $club = $this->clubs->get($id);
+ $newOwner = (new Users)->get($newOwnerID);
+ if($this->user->id !== $club->getOwner()->getId())
+ $this->flashFail("err", tr("error"), tr("forbidden"));
+
+ $club->setOwner($newOwnerID);
+ $club->save();
+
+ $this->flashFail("succ", tr("information_-1"), tr("group_owner_setted", $newOwner->getCanonicalName(), $club->getName()));
+ }
}
diff --git a/Web/Presenters/templates/Group/Followers.xml b/Web/Presenters/templates/Group/Followers.xml
index ead3368a..114b2228 100644
--- a/Web/Presenters/templates/Group/Followers.xml
+++ b/Web/Presenters/templates/Group/Followers.xml
@@ -91,6 +91,12 @@
{_promote_to_admin}
{/if}
+ {if $club->getOwner()->getId() != $user->getId() && $manager && $thisUser->getId() == $club->getOwner()->getId()}
+ |
+
+ {_promote_to_owner}
+
+ {/if}
{if $manager}
|
diff --git a/Web/routes.yml b/Web/routes.yml
index 715a8a84..7a0ad2ac 100644
--- a/Web/routes.yml
+++ b/Web/routes.yml
@@ -73,6 +73,8 @@ routes:
handler: "Group->attend"
- url: "/al_comments.pl/create/{text}/{num}"
handler: "Comment->makeComment"
+ - url: "/groups/{num}/setNewOwner/{num}"
+ handler: "Group->changeOwner"
- url: "/comment{num}/like"
handler: "Comment->like"
- url: "/comment{num}/delete"
diff --git a/locales/en.strings b/locales/en.strings
index 8ff0ee01..c4fefeb9 100644
--- a/locales/en.strings
+++ b/locales/en.strings
@@ -229,6 +229,7 @@
"role" = "Role";
"administrator" = "Administrator";
"promote_to_admin" = "Promote to admin";
+"promote_to_owner" = "Promote to owner";
"devote" = "Devote";
"set_comment" = "Set comment";
"hidden_yes" = "Hidden: Yes";
@@ -240,6 +241,8 @@
"group_display_all_administrators" = "Display all administrators";
"group_dont_display_administrators_list" = "Display nothing";
+"group_owner_setted" = "New owner ($1) has been successfully assigned to community $2. If you want to return the community, please contact the technical support of the site.";
+
"participants_zero" = "No participants";
"participants_one" = "$1 participant";
"participants_other" = "$1 participant";
diff --git a/locales/ru.strings b/locales/ru.strings
index 1532df73..9b237f4d 100644
--- a/locales/ru.strings
+++ b/locales/ru.strings
@@ -239,6 +239,7 @@
"role" = "Роль";
"administrator" = "Администратор";
"promote_to_admin" = "Повысить до администратора";
+"promote_to_owner" = "Назначить владельцем";
"devote" = "Разжаловать";
"set_comment" = "Изменить комментарий";
"hidden_yes" = "Скрыт: Да";
@@ -250,6 +251,8 @@
"group_display_all_administrators" = "Отображать всех администраторов";
"group_dont_display_administrators_list" = "Ничего не отображать";
+"group_owner_setted" = "Новый владелец ($1) успешно назначен в сообщество $2. Если Вы хотите вернуть сообщество, обратитесь в техническую поддержку сайта.";
+
"participants_zero" = "Ни одного участника";
"participants_one" = "Один участник";
"participants_few" = "$1 участника";