Redo some changes
This commit is contained in:
parent
bd62d548db
commit
bc2694bf7f
3 changed files with 4 additions and 66 deletions
|
@ -1,60 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Model\Item;
|
||||
|
||||
/**
|
||||
* Toggle pinned items
|
||||
*/
|
||||
class Pinned extends BaseModule
|
||||
{
|
||||
public static function rawContent($parameters)
|
||||
{
|
||||
$a = self::getApp();
|
||||
$pinned = 0;
|
||||
$itemId = null;
|
||||
|
||||
if (!local_user()) {
|
||||
exit();
|
||||
}
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
if ($a->argc > 1) {
|
||||
$itemId = intval($a->argv[1]);
|
||||
}
|
||||
|
||||
if (!$itemId) {
|
||||
exit();
|
||||
}
|
||||
|
||||
$item = Item::selectFirstForUser(local_user(), ['pinned'], ['uid' => local_user(), 'id' => $itemId]);
|
||||
if (empty($item)) {
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!intval($item['pinned'])) {
|
||||
$pinned = 1;
|
||||
}
|
||||
|
||||
Item::update(['pinned' => $pinned], ['id' => $itemId]);
|
||||
|
||||
// See if we've been passed a return path to redirect to
|
||||
$returnPath = $_REQUEST['return'] ?? '';
|
||||
if ($returnPath) {
|
||||
$rand = '_=' . time();
|
||||
if (strpos($returnPath, '?')) {
|
||||
$rand = "&$rand";
|
||||
} else {
|
||||
$rand = "?$rand";
|
||||
}
|
||||
|
||||
$a->internalRedirect($returnPath . $rand);
|
||||
}
|
||||
|
||||
// the json doesn't really matter, it will either be 0 or 1
|
||||
echo json_encode($pinned);
|
||||
exit();
|
||||
}
|
||||
}
|
|
@ -34,7 +34,7 @@
|
|||
use Friendica\Database\DBA;
|
||||
|
||||
if (!defined('DB_UPDATE_VERSION')) {
|
||||
define('DB_UPDATE_VERSION', 1324);
|
||||
define('DB_UPDATE_VERSION', 1323);
|
||||
}
|
||||
|
||||
return [
|
||||
|
@ -1384,8 +1384,7 @@ return [
|
|||
"iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["item" => "id"], "comment" => "Item id"],
|
||||
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["user" => "uid"], "comment" => "User id"],
|
||||
"hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Marker to hide an item from the user"],
|
||||
"ignored" => ["type" => "boolean", "comment" => "Ignore this thread if set"],
|
||||
"pinned" => ["type" => "boolean", "comment" => "The item is pinned on the profile page"]
|
||||
"ignored" => ["type" => "boolean", "comment" => "Ignore this thread if set"]
|
||||
],
|
||||
"indexes" => [
|
||||
"PRIMARY" => ["uid", "iid"]
|
||||
|
|
|
@ -179,9 +179,8 @@ return [
|
|||
'/{type}/{customize}/{name}' => [Module\Photo::class, [R::GET]],
|
||||
],
|
||||
|
||||
'/pinned/{item:\d+}' => [Module\Pinned::class, [R::GET]],
|
||||
'/pretheme' => [Module\ThemeDetails::class, [R::GET]],
|
||||
'/probe' => [Module\Debug\Probe::class, [R::GET]],
|
||||
'/pretheme' => [Module\ThemeDetails::class, [R::GET]],
|
||||
'/probe' => [Module\Debug\Probe::class, [R::GET]],
|
||||
|
||||
'/profile' => [
|
||||
'/{nickname}' => [Module\Profile::class, [R::GET]],
|
||||
|
|
Loading…
Reference in a new issue