Global: Add toggle home page between My Page and My Feed

The switch is in the interface settings. Closes #361
This commit is contained in:
Maxim Leshchenko 2022-05-23 09:18:06 +01:00
parent 0d86837699
commit 060100821d
No known key found for this signature in database
GPG key ID: BB9C44A8733FBEEE
7 changed files with 28 additions and 1 deletions

View file

@ -85,6 +85,11 @@ class User extends RowModel
{ {
return (bool) $this->getRecord()->microblog; return (bool) $this->getRecord()->microblog;
} }
function getMainPage(): int
{
return $this->getRecord()->main_page;
}
function getChandlerGUID(): string function getChandlerGUID(): string
{ {

View file

@ -14,7 +14,12 @@ final class AboutPresenter extends OpenVKPresenter
{ {
if(!is_null($this->user)) { if(!is_null($this->user)) {
header("HTTP/1.1 302 Found"); header("HTTP/1.1 302 Found");
header("Location: /id" . $this->user->id);
if($this->user->identity->getMainPage())
header("Location: /feed");
else
header("Location: /id" . $this->user->id);
exit; exit;
} }

View file

@ -419,6 +419,9 @@ final class UserPresenter extends OpenVKPresenter
if(in_array($this->postParam("nsfw"), [0, 1, 2])) if(in_array($this->postParam("nsfw"), [0, 1, 2]))
$user->setNsfwTolerance((int) $this->postParam("nsfw")); $user->setNsfwTolerance((int) $this->postParam("nsfw"));
if(in_array($this->postParam("main_page"), [0, 1]))
$user->setMain_Page((int) $this->postParam("main_page"));
} else if($_GET['act'] === "lMenu") { } else if($_GET['act'] === "lMenu") {
$settings = [ $settings = [
"menu_bildoj" => "photos", "menu_bildoj" => "photos",

View file

@ -500,6 +500,17 @@
</select> </select>
</td> </td>
</tr> </tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_ui_settings_main_page}</span>
</td>
<td>
<select name="main_page">
<option value="0" {if !$user->getMainPage()}selected{/if}>{_my_page}</option>
<option value="1" {if $user->getMainPage()}selected{/if}>{_my_feed}</option>
</select>
</td>
</tr>
<tr> <tr>
<td width="120" valign="top" align="right"> <td width="120" valign="top" align="right">
<input type="checkbox" name="theme_for_session" value="1"> <input type="checkbox" name="theme_for_session" value="1">

View file

@ -0,0 +1 @@
ALTER TABLE `profiles` ADD COLUMN `main_page` tinyint(3) unsigned NOT NULL DEFAULT 0 AFTER `microblog`;

View file

@ -463,6 +463,7 @@
"ui_settings_view_of_posts" = "View of posts"; "ui_settings_view_of_posts" = "View of posts";
"ui_settings_view_of_posts_old" = "Old"; "ui_settings_view_of_posts_old" = "Old";
"ui_settings_view_of_posts_microblog" = "Microblog"; "ui_settings_view_of_posts_microblog" = "Microblog";
"ui_settings_main_page" = "Main page";
"additional_links" = "Additional links"; "additional_links" = "Additional links";
"ad_poster" = "Ad poster"; "ad_poster" = "Ad poster";

View file

@ -491,6 +491,7 @@
"ui_settings_view_of_posts" = "Вид постов"; "ui_settings_view_of_posts" = "Вид постов";
"ui_settings_view_of_posts_old" = "Старый"; "ui_settings_view_of_posts_old" = "Старый";
"ui_settings_view_of_posts_microblog" = "Микроблог"; "ui_settings_view_of_posts_microblog" = "Микроблог";
"ui_settings_main_page" = "Главная страница";
"additional_links" = "Дополнительные ссылки"; "additional_links" = "Дополнительные ссылки";
"ad_poster" = "Рекламный плакат"; "ad_poster" = "Рекламный плакат";