[CORE] Data Representation and Modelling refactor
This commit is contained in:
parent
b80479dc4e
commit
1111ee95f1
@ -100,7 +100,7 @@ class Avatar extends Entity
|
||||
|
||||
public function getUrl(): string
|
||||
{
|
||||
return Router::url('avatar', ['nickname' => Profile::getNicknameFromId($this->profile_id)]);
|
||||
return Router::url('avatar', ['nickname' => GSActor::getNicknameFromId($this->gsactor_id)]);
|
||||
}
|
||||
|
||||
public function getFile(): File
|
||||
@ -128,7 +128,7 @@ class Avatar extends Entity
|
||||
if (!$cascading) {
|
||||
$files = $this->getFile()->delete($cascade = true, $file_flush = false, $delete_files_now);
|
||||
} else {
|
||||
DB::remove(DB::getReference('avatar', ['profile_id' => $this->profile_id]));
|
||||
DB::remove(DB::getReference('avatar', ['gsactor_id' => $this->gsactor_id]));
|
||||
$file_path = $this->getFilePath();
|
||||
$files[] = $file_path;
|
||||
if ($flush) {
|
||||
@ -144,14 +144,14 @@ class Avatar extends Entity
|
||||
return [
|
||||
'name' => 'avatar',
|
||||
'fields' => [
|
||||
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'],
|
||||
'gsactor_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to gsactor table'],
|
||||
'file_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to file table'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'description' => 'date this record was created', 'default' => 'CURRENT_TIMESTAMP'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified', 'default' => 'CURRENT_TIMESTAMP'],
|
||||
],
|
||||
'primary key' => ['profile_id'],
|
||||
'primary key' => ['gsactor_id'],
|
||||
'foreign keys' => [
|
||||
'avatar_profile_id_fkey' => ['profile', ['profile_id' => 'id']],
|
||||
'avatar_gsactor_id_fkey' => ['gsactor', ['gsactor_id' => 'id']],
|
||||
'avatar_file_id_fkey' => ['file', ['file_id' => 'id']],
|
||||
],
|
||||
'indexes' => [
|
||||
|
@ -105,16 +105,13 @@ class Conversation
|
||||
return [
|
||||
'name' => 'conversation',
|
||||
'fields' => [
|
||||
'id' => ['type' => 'serial', 'not null' => true, 'description' => 'Unique identifier, (again) unrelated to notice id since 2016-01-06'],
|
||||
'uri' => ['type' => 'varchar', 'not null' => true, 'length' => 191, 'description' => 'URI of the conversation'],
|
||||
'url' => ['type' => 'varchar', 'length' => 191, 'description' => 'Resolvable URL, preferably remote (local can be generated on the fly)'],
|
||||
'id' => ['type' => 'serial', 'not null' => true, 'description' => 'Unique identifier'],
|
||||
'note_id' => ['type' => 'int', 'not null' => true, 'description' => 'Root of note for this conversation'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['id'],
|
||||
'unique keys' => [
|
||||
'conversation_uri_key' => ['uri'],
|
||||
],
|
||||
'primary key' => ['id'],
|
||||
'foreign keys' => ['conversation_note_id_fkey' => ['note', ['note_id' => 'id']]],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -108,8 +108,8 @@ class Follow
|
||||
return [
|
||||
'name' => 'follow',
|
||||
'fields' => [
|
||||
'follower' => ['type' => 'int', 'not null' => true, 'description' => 'profile listening'],
|
||||
'followed' => ['type' => 'int', 'not null' => true, 'description' => 'profile being listened to'],
|
||||
'follower' => ['type' => 'int', 'not null' => true, 'description' => 'gsactor listening'],
|
||||
'followed' => ['type' => 'int', 'not null' => true, 'description' => 'gsactor being listened to'],
|
||||
'uri' => ['type' => 'varchar', 'length' => 191, 'description' => 'universally unique identifier'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
|
@ -81,11 +81,11 @@ class FollowQueue
|
||||
public static function schemaDef(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'Follow_queue',
|
||||
'name' => 'follow_queue',
|
||||
'description' => 'Holder for Follow requests awaiting moderation.',
|
||||
'fields' => [
|
||||
'follower' => ['type' => 'int', 'not null' => true, 'description' => 'remote or local profile making the request'],
|
||||
'followed' => ['type' => 'int', 'not null' => true, 'description' => 'remote or local profile being followed to'],
|
||||
'follower' => ['type' => 'int', 'not null' => true, 'description' => 'gsactor making the request'],
|
||||
'followed' => ['type' => 'int', 'not null' => true, 'description' => 'gsactor being followed'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
|
||||
],
|
||||
'primary key' => ['follower', 'followed'],
|
||||
@ -94,8 +94,8 @@ class FollowQueue
|
||||
'Follow_queue_followed_created_idx' => ['followed', 'created'],
|
||||
],
|
||||
'foreign keys' => [
|
||||
'Follow_queue_follower_fkey' => ['profile', ['follower' => 'id']],
|
||||
'Follow_queue_followed_fkey' => ['profile', ['followed' => 'id']],
|
||||
'Follow_queue_follower_fkey' => ['gsactor', ['follower' => 'id']],
|
||||
'Follow_queue_followed_fkey' => ['gsactor', ['followed' => 'id']],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ use DateTimeInterface;
|
||||
use Functional as F;
|
||||
|
||||
/**
|
||||
* Entity for user profiles
|
||||
* Entity for actors
|
||||
*
|
||||
* @category DB
|
||||
* @package GNUsocial
|
||||
@ -39,7 +39,7 @@ use Functional as F;
|
||||
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class Profile extends Entity
|
||||
class GSActor extends Entity
|
||||
{
|
||||
// {{{ Autocode
|
||||
|
||||
@ -204,12 +204,12 @@ class Profile extends Entity
|
||||
|
||||
public static function getFromId(int $id): ?self
|
||||
{
|
||||
return DB::find('profile', ['id' => $id]);
|
||||
return DB::find('gsactor', ['id' => $id]);
|
||||
}
|
||||
|
||||
public static function getFromNickname(string $nickname): ?self
|
||||
{
|
||||
return DB::findOneBy('profile', ['nickname' => $nickname]);
|
||||
return DB::findOneBy('gsactor', ['nickname' => $nickname]);
|
||||
}
|
||||
|
||||
public static function getNicknameFromId(int $id): string
|
||||
@ -219,7 +219,7 @@ class Profile extends Entity
|
||||
|
||||
public function getSelfTags(): array
|
||||
{
|
||||
return DB::findBy('profile_tag', ['tagger' => $this->id, 'tagged' => $this->id]);
|
||||
return DB::findBy('gsactor_tag', ['tagger' => $this->id, 'tagged' => $this->id]);
|
||||
}
|
||||
|
||||
public function setSelfTags(array $tags, array $pt_existing): void
|
||||
@ -229,7 +229,7 @@ class Profile extends Entity
|
||||
$tag_to_remove = array_diff($tag_existing, $tags);
|
||||
$pt_to_remove = F\filter($pt_existing, function ($pt) use ($tag_to_remove) { return in_array($pt->getTag(), $tag_to_remove); });
|
||||
foreach ($tag_to_add as $tag) {
|
||||
$pt = new ProfileTag($this->id, $this->id, $tag);
|
||||
$pt = new GSActorTag($this->id, $this->id, $tag);
|
||||
DB::persist($pt);
|
||||
}
|
||||
foreach ($pt_to_remove as $pt) {
|
||||
@ -240,13 +240,13 @@ class Profile extends Entity
|
||||
public static function schemaDef(): array
|
||||
{
|
||||
$def = [
|
||||
'name' => 'profile',
|
||||
'description' => 'local and remote users have profiles',
|
||||
'name' => 'gsactor',
|
||||
'description' => 'local and remote users, groups and bots are gsactors, for instance',
|
||||
'fields' => [
|
||||
'id' => ['type' => 'serial', 'not null' => true, 'description' => 'unique identifier'],
|
||||
'nickname' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'nickname or username'],
|
||||
'fullname' => ['type' => 'text', 'description' => 'display name'],
|
||||
'roles' => ['type' => 'int', 'not null' => true, 'default' => UserRoles::USER, 'description' => 'Bitmap of permissions this profile has'],
|
||||
'roles' => ['type' => 'int', 'not null' => true, 'default' => UserRoles::USER, 'description' => 'Bitmap of permissions this gsactor has'],
|
||||
'homepage' => ['type' => 'text', 'description' => 'identifying URL'],
|
||||
'bio' => ['type' => 'text', 'description' => 'descriptive biography'],
|
||||
'location' => ['type' => 'text', 'description' => 'physical location'],
|
||||
@ -259,10 +259,10 @@ class Profile extends Entity
|
||||
],
|
||||
'primary key' => ['id'],
|
||||
'indexes' => [
|
||||
'profile_nickname_idx' => ['nickname'],
|
||||
'gsactor_nickname_idx' => ['nickname'],
|
||||
],
|
||||
'fulltext indexes' => [
|
||||
'profile_fulltext_idx' => ['nickname', 'fullname', 'location', 'bio', 'homepage']
|
||||
'gsactor_fulltext_idx' => ['nickname', 'fullname', 'location', 'bio', 'homepage'],
|
||||
],
|
||||
];
|
||||
|
@ -22,7 +22,7 @@ namespace App\Entity;
|
||||
use DateTimeInterface;
|
||||
|
||||
/**
|
||||
* Entity for User's Profile Block
|
||||
* Entity for User's GSActor Block
|
||||
*
|
||||
* @category DB
|
||||
* @package GNUsocial
|
||||
@ -35,7 +35,7 @@ use DateTimeInterface;
|
||||
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class ProfileBlock
|
||||
class GSActorBlock
|
||||
{
|
||||
// {{{ Autocode
|
||||
|
||||
@ -81,16 +81,16 @@ class ProfileBlock
|
||||
public static function schemaDef(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'profile_block',
|
||||
'name' => 'gsactor_block',
|
||||
'fields' => [
|
||||
'blocker' => ['type' => 'int', 'not null' => true, 'description' => 'user making the block'],
|
||||
'blocked' => ['type' => 'int', 'not null' => true, 'description' => 'profile that is blocked'],
|
||||
'blocked' => ['type' => 'int', 'not null' => true, 'description' => 'gsactor that is blocked'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['blocker', 'blocked'],
|
||||
'foreign keys' => [
|
||||
'profile_block_blocker_fkey' => ['user', ['blocker' => 'id']],
|
||||
'profile_block_blocked_fkey' => ['profile', ['blocked' => 'id']],
|
||||
'gsactor_block_blocker_fkey' => ['local_user', ['blocker' => 'id']],
|
||||
'gsactor_block_blocked_fkey' => ['gsactor', ['blocked' => 'id']],
|
||||
],
|
||||
];
|
||||
}
|
@ -17,12 +17,8 @@
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
// }}}
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use DateTimeInterface;
|
||||
|
||||
/**
|
||||
* Entity for List of profiles
|
||||
* Entity for List of gsactors
|
||||
*
|
||||
* @category DB
|
||||
* @package GNUsocial
|
||||
@ -35,7 +31,12 @@ use DateTimeInterface;
|
||||
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class ProfileList
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use DateTimeInterface;
|
||||
|
||||
class GSActorCircle
|
||||
{
|
||||
// {{{ Autocode
|
||||
|
||||
@ -177,34 +178,30 @@ class ProfileList
|
||||
public static function schemaDef(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'profile_list',
|
||||
'description' => 'a profile can have lists of profiles, to separate their timeline',
|
||||
'name' => 'gsactor_list',
|
||||
'description' => 'a gsactor can have lists of gsactors, to separate their timeline',
|
||||
'fields' => [
|
||||
'id' => ['type' => 'int', 'not null' => true, 'description' => 'unique identifier'],
|
||||
'tagger' => ['type' => 'int', 'not null' => true, 'description' => 'user making the tag'],
|
||||
'tag' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'people tag'],
|
||||
'description' => ['type' => 'text', 'description' => 'description of the people tag'],
|
||||
'private' => ['type' => 'bool', 'default' => false, 'description' => 'is this tag private'],
|
||||
'uri' => ['type' => 'varchar', 'length' => 191, 'description' => 'universal identifier'],
|
||||
'mainpage' => ['type' => 'varchar', 'length' => 191, 'description' => 'page to link to'],
|
||||
'tagged_count' => ['type' => 'int', 'default' => 0, 'description' => 'number of people tagged with this tag by this user'],
|
||||
'follower_count' => ['type' => 'int', 'default' => 0, 'description' => 'number of followers to this tag'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
'id' => ['type' => 'int', 'not null' => true, 'description' => 'unique identifier'],
|
||||
'tagger' => ['type' => 'int', 'not null' => true, 'description' => 'user making the tag'],
|
||||
'tag' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'gsactor tag'], // Join with GSActorTag
|
||||
'description' => ['type' => 'text', 'description' => 'description of the people tag'],
|
||||
'private' => ['type' => 'bool', 'default' => false, 'description' => 'is this tag private'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['tagger', 'tag'],
|
||||
'unique keys' => [
|
||||
'profile_list_id_key' => ['id'],
|
||||
'gsactor_list_id_key' => ['id'],
|
||||
],
|
||||
'foreign keys' => [
|
||||
'profile_list_tagger_fkey' => ['profile', ['tagger' => 'id']],
|
||||
'gsactor_list_tagger_fkey' => ['gsactor', ['tagger' => 'id']],
|
||||
],
|
||||
'indexes' => [
|
||||
'profile_list_modified_idx' => ['modified'],
|
||||
'profile_list_tag_idx' => ['tag'],
|
||||
'profile_list_tagger_tag_idx' => ['tagger', 'tag'],
|
||||
'profile_list_tagged_count_idx' => ['tagged_count'],
|
||||
'profile_list_follower_count_idx' => ['follower_count'],
|
||||
'gsactor_list_modified_idx' => ['modified'],
|
||||
'gsactor_list_tag_idx' => ['tag'],
|
||||
'gsactor_list_tagger_tag_idx' => ['tagger', 'tag'],
|
||||
'gsactor_list_tagged_count_idx' => ['tagged_count'],
|
||||
'gsactor_list_follower_count_idx' => ['follower_count'],
|
||||
],
|
||||
];
|
||||
}
|
@ -19,11 +19,10 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use DateTime;
|
||||
use DateTimeInterface;
|
||||
|
||||
/**
|
||||
* Entity for Profile Tag
|
||||
* Entity for GSActor Tag
|
||||
*
|
||||
* @category DB
|
||||
* @package GNUsocial
|
||||
@ -36,7 +35,7 @@ use DateTimeInterface;
|
||||
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class ProfileTag
|
||||
class GSActorTag
|
||||
{
|
||||
// {{{ Autocode
|
||||
|
||||
@ -91,33 +90,25 @@ class ProfileTag
|
||||
|
||||
// }}} Autocode
|
||||
|
||||
public function __construct(int $tagger, int $tagged, string $tag)
|
||||
{
|
||||
$this->tagger = $tagger;
|
||||
$this->tagged = $tagged;
|
||||
$this->tag = preg_replace('/ /', '_', trim($tag));
|
||||
$this->modified = new DateTime();
|
||||
}
|
||||
|
||||
public static function schemaDef(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'profile_tag',
|
||||
'name' => 'gsactor_tag',
|
||||
'fields' => [
|
||||
'tagger' => ['type' => 'int', 'not null' => true, 'description' => 'user making the tag'],
|
||||
'tagged' => ['type' => 'int', 'not null' => true, 'description' => 'profile tagged'],
|
||||
'tagged' => ['type' => 'int', 'not null' => true, 'description' => 'gsactor tagged'],
|
||||
'tag' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'hash tag associated with this notice'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['tagger', 'tagged', 'tag'],
|
||||
'foreign keys' => [
|
||||
'profile_tag_tagger_fkey' => ['profile', ['tagger' => 'id']],
|
||||
'profile_tag_tagged_fkey' => ['profile', ['tagged' => 'id']],
|
||||
'gsactor_tag_tagger_fkey' => ['gsactor', ['tagger' => 'id']],
|
||||
'gsactor_tag_tagged_fkey' => ['gsactor', ['tagged' => 'id']],
|
||||
],
|
||||
'indexes' => [
|
||||
'profile_tag_modified_idx' => ['modified'],
|
||||
'profile_tag_tagger_tag_idx' => ['tagger', 'tag'],
|
||||
'profile_tag_tagged_idx' => ['tagged'],
|
||||
'gsactor_tag_modified_idx' => ['modified'],
|
||||
'gsactor_tag_tagger_tag_idx' => ['tagger', 'tag'], // For Circles
|
||||
'gsactor_tag_tagged_idx' => ['tagged'],
|
||||
],
|
||||
];
|
||||
}
|
@ -22,7 +22,7 @@ namespace App\Entity;
|
||||
use DateTimeInterface;
|
||||
|
||||
/**
|
||||
* Entity for Profile Tag Subscription
|
||||
* Entity for Gsactor Tag Subscription
|
||||
*
|
||||
* @category DB
|
||||
* @package GNUsocial
|
||||
@ -35,7 +35,7 @@ use DateTimeInterface;
|
||||
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class ProfileTagFollow
|
||||
class GSActorTagFollow
|
||||
{
|
||||
// {{{ Autocode
|
||||
|
||||
@ -93,22 +93,21 @@ class ProfileTagFollow
|
||||
public static function schemaDef(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'profile_tag_follow',
|
||||
'name' => 'gsactor_tag_follow',
|
||||
'fields' => [
|
||||
'profile_tag_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to profile_tag'],
|
||||
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'],
|
||||
'gsactor_tag_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to gsactor_tag'],
|
||||
'gsactor_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to gsactor table'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['profile_tag_id', 'profile_id'],
|
||||
'primary key' => ['gsactor_tag_id', 'gsactor_id'],
|
||||
'foreign keys' => [
|
||||
'profile_tag_follow_profile_list_id_fkey' => ['profile_list', ['profile_tag_id' => 'id']],
|
||||
'profile_tag_follow_profile_id_fkey' => ['profile', ['profile_id' => 'id']],
|
||||
'gsactor_tag_follow_gsactor_list_id_fkey' => ['gsactor_list', ['gsactor_tag_id' => 'id']],
|
||||
'gsactor_tag_follow_gsactor_id_fkey' => ['gsactor', ['gsactor_id' => 'id']],
|
||||
],
|
||||
'indexes' => [
|
||||
// @fixme probably we want a (profile_id, created) index here?
|
||||
'profile_tag_follow_profile_id_idx' => ['profile_id'],
|
||||
'profile_tag_follow_created_idx' => ['created'],
|
||||
'gsactor_tag_follow_gsactor_id_idx' => ['gsactor_id'],
|
||||
'gsactor_tag_follow_created_idx' => ['created'],
|
||||
],
|
||||
];
|
||||
}
|
@ -264,7 +264,7 @@ class Group
|
||||
'name' => 'group',
|
||||
'fields' => [
|
||||
'id' => ['type' => 'serial', 'not null' => true],
|
||||
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'],
|
||||
'gsactor_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to gsactor table'],
|
||||
'nickname' => ['type' => 'varchar', 'length' => 64, 'description' => 'nickname for addressing'],
|
||||
'fullname' => ['type' => 'varchar', 'length' => 191, 'description' => 'display name'],
|
||||
'homepage' => ['type' => 'varchar', 'length' => 191, 'description' => 'URL, cached so we dont regenerate'],
|
||||
@ -272,7 +272,7 @@ class Group
|
||||
'is_local' => ['type' => 'bool', 'description' => 'whether this group was created in this instance'],
|
||||
'location' => ['type' => 'varchar', 'length' => 191, 'description' => 'related physical location, if any'],
|
||||
'original_logo' => ['type' => 'varchar', 'length' => 191, 'description' => 'original size logo'],
|
||||
'homepage_logo' => ['type' => 'varchar', 'length' => 191, 'description' => 'homepage (profile) size logo'],
|
||||
'homepage_logo' => ['type' => 'varchar', 'length' => 191, 'description' => 'homepage (gsactor) size logo'],
|
||||
'stream_logo' => ['type' => 'varchar', 'length' => 191, 'description' => 'stream-sized logo'],
|
||||
'mini_logo' => ['type' => 'varchar', 'length' => 191, 'description' => 'mini logo'],
|
||||
'uri' => ['type' => 'varchar', 'length' => 191, 'description' => 'universal identifier'],
|
||||
@ -285,14 +285,14 @@ class Group
|
||||
'primary key' => ['id'],
|
||||
'unique keys' => [
|
||||
'user_group_uri_key' => ['uri'],
|
||||
'user_profile_id_key' => ['profile_id'],
|
||||
'user_gsactor_id_key' => ['gsactor_id'],
|
||||
],
|
||||
'foreign keys' => [
|
||||
'user_group_id_fkey' => ['profile', ['profile_id' => 'id']],
|
||||
'user_group_id_fkey' => ['gsactor', ['gsactor_id' => 'id']],
|
||||
],
|
||||
'indexes' => [
|
||||
'user_group_nickname_idx' => ['nickname'],
|
||||
'user_group_profile_id_idx' => ['profile_id'],
|
||||
'user_group_gsactor_id_idx' => ['gsactor_id'],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
@ -95,15 +95,15 @@ class GroupBlock
|
||||
return [
|
||||
'name' => 'group_block',
|
||||
'fields' => [
|
||||
'group_id' => ['type' => 'int', 'not null' => true, 'description' => 'group profile is blocked from'],
|
||||
'blocked_profile' => ['type' => 'int', 'not null' => true, 'description' => 'profile that is blocked'],
|
||||
'group_id' => ['type' => 'int', 'not null' => true, 'description' => 'group gsactor is blocked from'],
|
||||
'blocked_gsactor' => ['type' => 'int', 'not null' => true, 'description' => 'gsactor that is blocked'],
|
||||
'blocker_user' => ['type' => 'int', 'not null' => true, 'description' => 'user making the block'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['group_id', 'blocked_profile'],
|
||||
'primary key' => ['group_id', 'blocked_gsactor'],
|
||||
'foreign keys' => [
|
||||
'group_block_group_id_fkey' => ['group', ['group_id' => 'id']],
|
||||
'group_block_blocked_fkey' => ['profile', ['blocked_profile' => 'id']],
|
||||
'group_block_blocked_fkey' => ['gsactor', ['blocked_gsactor' => 'id']],
|
||||
'group_block_blocker_fkey' => ['user', ['blocker_user' => 'id']],
|
||||
],
|
||||
];
|
||||
|
@ -84,17 +84,17 @@ class GroupJoinQueue
|
||||
'name' => 'group_join_queue',
|
||||
'description' => 'Holder for group join requests awaiting moderation.',
|
||||
'fields' => [
|
||||
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'remote or local profile making the request'],
|
||||
'gsactor_id' => ['type' => 'int', 'not null' => true, 'description' => 'remote or local gsactor making the request'],
|
||||
'group_id' => ['type' => 'int', 'not null' => true, 'description' => 'remote or local group to join, if any'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
|
||||
],
|
||||
'primary key' => ['profile_id', 'group_id'],
|
||||
'primary key' => ['gsactor_id', 'group_id'],
|
||||
'indexes' => [
|
||||
'group_join_queue_profile_id_created_idx' => ['profile_id', 'created'],
|
||||
'group_join_queue_gsactor_id_created_idx' => ['gsactor_id', 'created'],
|
||||
'group_join_queue_group_id_created_idx' => ['group_id', 'created'],
|
||||
],
|
||||
'foreign keys' => [
|
||||
'group_join_queue_profile_id_fkey' => ['profile', ['profile_id' => 'id']],
|
||||
'group_join_queue_gsactor_id_fkey' => ['gsactor', ['gsactor_id' => 'id']],
|
||||
'group_join_queue_group_id_fkey' => ['group', ['group_id' => 'id']],
|
||||
],
|
||||
];
|
||||
|
@ -120,24 +120,24 @@ class GroupMember
|
||||
'name' => 'group_member',
|
||||
'fields' => [
|
||||
'group_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to group table'],
|
||||
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to profile table'],
|
||||
'gsactor_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to gsactor table'],
|
||||
'is_admin' => ['type' => 'bool', 'default' => false, 'description' => 'is this user an admin?'],
|
||||
'uri' => ['type' => 'varchar', 'length' => 191, 'description' => 'universal identifier'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['group_id', 'profile_id'],
|
||||
'primary key' => ['group_id', 'gsactor_id'],
|
||||
'unique keys' => [
|
||||
'group_member_uri_key' => ['uri'],
|
||||
],
|
||||
'foreign keys' => [
|
||||
'group_member_group_id_fkey' => ['group', ['group_id' => 'id']],
|
||||
'group_member_profile_id_fkey' => ['profile', ['profile_id' => 'id']],
|
||||
'group_member_gsactor_id_fkey' => ['gsactor', ['gsactor_id' => 'id']],
|
||||
],
|
||||
'indexes' => [
|
||||
'group_member_profile_id_idx' => ['profile_id'],
|
||||
'group_member_gsactor_id_idx' => ['gsactor_id'],
|
||||
'group_member_created_idx' => ['created'],
|
||||
'group_member_profile_id_created_idx' => ['profile_id', 'created'],
|
||||
'group_member_gsactor_id_created_idx' => ['gsactor_id', 'created'],
|
||||
'group_member_group_id_created_idx' => ['group_id', 'created'],
|
||||
],
|
||||
];
|
||||
|
@ -241,9 +241,9 @@ class LocalUser extends Entity implements UserInterface
|
||||
|
||||
// }}} Autocode
|
||||
|
||||
public function getProfile()
|
||||
public function getActor()
|
||||
{
|
||||
return DB::findOneBy('profile', ['nickname' => $this->nickname]);
|
||||
return DB::findOneBy('gsactor', ['nickname' => $this->nickname]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -251,7 +251,7 @@ class LocalUser extends Entity implements UserInterface
|
||||
*/
|
||||
public function getRoles()
|
||||
{
|
||||
return UserRoles::bitmapToStrings($this->getProfile()->getRoles());
|
||||
return UserRoles::bitmapToStrings($this->getActor()->getRoles());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -344,8 +344,8 @@ class LocalUser extends Entity implements UserInterface
|
||||
'name' => 'local_user',
|
||||
'description' => 'local users, bots, etc',
|
||||
'fields' => [
|
||||
'nickname' => ['type' => 'varchar', 'length' => 64, 'description' => 'nickname or username, duped in profile'],
|
||||
'password' => ['type' => 'varchar', 'length' => 191, 'description' => 'salted password, can be null for OpenID users'],
|
||||
'nickname' => ['type' => 'varchar', 'length' => 64, 'description' => 'nickname or username, foreign key to gsactor'],
|
||||
'password' => ['type' => 'varchar', 'length' => 191, 'description' => 'salted password, can be null for users with federated authentication'],
|
||||
'outgoing_email' => ['type' => 'varchar', 'length' => 191, 'description' => 'email address for password recovery, notifications, etc.'],
|
||||
'incoming_email' => ['type' => 'varchar', 'length' => 191, 'description' => 'email address for post-by-email'],
|
||||
'is_email_verified' => ['type' => 'bool', 'default' => false, 'description' => 'Whether the user opened the comfirmation email'],
|
||||
@ -369,7 +369,7 @@ class LocalUser extends Entity implements UserInterface
|
||||
'user_uri_key' => ['uri'],
|
||||
],
|
||||
'foreign keys' => [
|
||||
'user_nickname_fkey' => ['profile', ['nickname' => 'nickname']],
|
||||
'user_nickname_fkey' => ['gsactor', ['nickname' => 'nickname']],
|
||||
'user_carrier_fkey' => ['sms_carrier', ['sms_carrier' => 'id']],
|
||||
],
|
||||
'indexes' => [
|
||||
|
@ -29,15 +29,11 @@ use DateTimeInterface;
|
||||
* @category DB
|
||||
* @package GNUsocial
|
||||
*
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2010 StatusNet Inc.
|
||||
* @author Mikael Nordfeldth <mmn@hethane.se>
|
||||
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @author Hugo Sales <hugo@fc.up.pt>
|
||||
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class Activity
|
||||
class Note
|
||||
{
|
||||
// {{{ Autocode
|
||||
|
||||
@ -227,47 +223,37 @@ class Activity
|
||||
public static function schemaDef(): array
|
||||
{
|
||||
$def = [
|
||||
'name' => 'activity',
|
||||
'name' => 'note',
|
||||
'fields' => [
|
||||
'id' => ['type' => 'serial', 'not null' => true],
|
||||
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'who made the activity'],
|
||||
'uri' => ['type' => 'varchar', 'length' => 191, 'description' => 'universally unique identifier, usually a tag URI'],
|
||||
'content' => ['type' => 'text', 'description' => 'activity content'],
|
||||
'rendered' => ['type' => 'text', 'description' => 'HTML version of the content'],
|
||||
'reply_to' => ['type' => 'int', 'description' => 'activity replied to (usually a guess)'],
|
||||
'is_local' => ['type' => 'bool', 'description' => 'was this activity generated by a local user'],
|
||||
'source' => ['type' => 'varchar', 'length' => 32, 'description' => 'source of activity, like "web", "im", or "clientname"'],
|
||||
'gsactor_id' => ['type' => 'int', 'not null' => true, 'description' => 'who made the note'],
|
||||
'content' => ['type' => 'text', 'description' => 'note content'],
|
||||
'reply_to' => ['type' => 'int', 'description' => 'note replied to, null if root of a conversation'],
|
||||
'is_local' => ['type' => 'bool', 'description' => 'was this note generated by a local actor'],
|
||||
'source' => ['type' => 'varchar', 'length' => 32, 'description' => 'source of note, like "web", "im", or "clientname"'],
|
||||
'conversation' => ['type' => 'int', 'description' => 'the local conversation id'],
|
||||
'repeat_of' => ['type' => 'int', 'description' => 'activity this is a repeat of'],
|
||||
'object_type' => ['type' => 'varchar', 'length' => 191, 'description' => 'URI representing activity streams object type', 'default' => null],
|
||||
'verb' => ['type' => 'varchar', 'length' => 191, 'description' => 'URI representing activity streams verb', 'default' => 'http://activitystrea.ms/schema/1.0/post'],
|
||||
'repeat_of' => ['type' => 'int', 'description' => 'note this is a repeat of'],
|
||||
'scope' => ['type' => 'int', 'description' => 'bit map for distribution scope; 0 = everywhere; 1 = this server only; 2 = addressees; 4 = groups; 8 = followers; 16 = messages; null = default'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['id'],
|
||||
'unique keys' => [
|
||||
'activity_uri_key' => ['uri'],
|
||||
],
|
||||
'primary key' => ['id'],
|
||||
'foreign keys' => [
|
||||
'activity_profile_id_fkey' => ['profile', ['profile_id' => 'id']],
|
||||
'activity_reply_to_fkey' => ['activity', ['reply_to' => 'id']],
|
||||
'activity_reply_to_fkey' => ['activity_source', ['source' => 'code']],
|
||||
'activity_conversation_fkey' => ['conversation', ['conversation' => 'id']],
|
||||
'activity_repeat_of_fkey' => ['activity', ['repeat_of' => 'id']], // @fixme: what about repeats of deleted activities?
|
||||
'note_gsactor_id_fkey' => ['gsactor', ['gsactor_id' => 'id']],
|
||||
'note_reply_to_fkey' => ['note', ['reply_to' => 'id']],
|
||||
'note_note_source_fkey' => ['note_source', ['source' => 'code']],
|
||||
'note_conversation_fkey' => ['conversation', ['conversation' => 'id']],
|
||||
'note_repeat_of_fkey' => ['note', ['repeat_of' => 'id']],
|
||||
],
|
||||
'indexes' => [
|
||||
'activity_created_id_is_local_idx' => ['created', 'id', 'is_local'],
|
||||
'activity_profile_id_idx' => ['profile_id', 'created', 'id'],
|
||||
'activity_is_local_created_profile_id_idx' => ['is_local', 'created', 'profile_id'],
|
||||
'activity_repeat_of_created_id_idx' => ['repeat_of', 'created', 'id'],
|
||||
'activity_conversation_created_id_idx' => ['conversation', 'created', 'id'],
|
||||
'activity_object_type_idx' => ['object_type'],
|
||||
'activity_verb_idx' => ['verb'],
|
||||
'activity_profile_id_verb_idx' => ['profile_id', 'verb'],
|
||||
'activity_replyto_idx' => ['reply_to'],
|
||||
'note_created_id_is_local_idx' => ['created', 'is_local'],
|
||||
'note_gsactor_created_idx' => ['gsactor_id', 'created'],
|
||||
'note_is_local_created_gsactor_idx' => ['is_local', 'created', 'gsactor_id'],
|
||||
'note_repeat_of_created_idx' => ['repeat_of', 'created'],
|
||||
'note_conversation_created_idx' => ['conversation', 'created'],
|
||||
'note_reply_to_idx' => ['reply_to'],
|
||||
],
|
||||
'fulltext indexes' => ['notice_fulltext_idx' => ['content']]
|
||||
'fulltext indexes' => ['notice_fulltext_idx' => ['content']],
|
||||
];
|
||||
|
||||
return $def;
|
@ -17,10 +17,6 @@
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
// }}}
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use DateTimeInterface;
|
||||
|
||||
/**
|
||||
* Entity for Notice Tag
|
||||
*
|
||||
@ -35,13 +31,18 @@ use DateTimeInterface;
|
||||
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class ActivityTag
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use DateTimeInterface;
|
||||
|
||||
class NoteHashtag
|
||||
{
|
||||
// {{{ Autocode
|
||||
|
||||
private string $tag;
|
||||
private int $activity_id;
|
||||
private \DateTimeInterface $created;
|
||||
private DateTimeInterface $created;
|
||||
|
||||
public function setTag(string $tag): self
|
||||
{
|
||||
@ -81,21 +82,21 @@ class ActivityTag
|
||||
public static function schemaDef(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'activity_tag',
|
||||
'description' => 'Hash tags',
|
||||
'name' => 'note_hashtag',
|
||||
'description' => 'Hash tags on notes',
|
||||
'fields' => [
|
||||
'tag' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'hash tag associated with this activity'],
|
||||
'activity_id' => ['type' => 'int', 'not null' => true, 'description' => 'activity tagged'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
|
||||
'tag' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'hash tag associated with this note'],
|
||||
'note_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to tagged note'],
|
||||
'modified' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['tag', 'activity_id'],
|
||||
'primary key' => ['tag', 'note_id'],
|
||||
'foreign keys' => [
|
||||
'activity_tag_activity_id_fkey' => ['activity', ['activity_id' => 'id']],
|
||||
'note_hashtag_note_id_fkey' => ['note', ['note_id' => 'id']],
|
||||
],
|
||||
'indexes' => [
|
||||
'activity_tag_created_idx' => ['created'],
|
||||
'activity_tag_activity_id_idx' => ['activity_id'],
|
||||
'activity_tag_tag_created_activity_id_idx' => ['tag', 'created', 'activity_id'],
|
||||
'note_tag_created_idx' => ['created'],
|
||||
'note_tag_note_id_idx' => ['note_id'],
|
||||
'note_tag_tag_created_note_id_idx' => ['tag', 'created', 'note_id'],
|
||||
],
|
||||
];
|
||||
}
|
@ -22,7 +22,7 @@ namespace App\Entity;
|
||||
use DateTimeInterface;
|
||||
|
||||
/**
|
||||
* Entity for Notice's location
|
||||
* Entity for Note's location
|
||||
*
|
||||
* @category DB
|
||||
* @package GNUsocial
|
||||
@ -35,7 +35,7 @@ use DateTimeInterface;
|
||||
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class ActivityLocation
|
||||
class NoteLocation
|
||||
{
|
||||
// {{{ Autocode
|
||||
|
||||
@ -119,19 +119,19 @@ class ActivityLocation
|
||||
return [
|
||||
'name' => 'activity_location',
|
||||
'fields' => [
|
||||
'activity_id' => ['type' => 'int', 'not null' => true, 'description' => 'activity this refers to'],
|
||||
'note_id' => ['type' => 'int', 'not null' => true, 'description' => 'activity this refers to'],
|
||||
'lat' => ['type' => 'numeric', 'precision' => 10, 'scale' => 7, 'description' => 'latitude'],
|
||||
'lon' => ['type' => 'numeric', 'precision' => 10, 'scale' => 7, 'description' => 'longitude'],
|
||||
'location_id' => ['type' => 'int', 'description' => 'location id if possible'],
|
||||
'location_service' => ['type' => 'int', 'size' => 'tiny', 'description' => 'service used to retrieve location information'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['activity_id'],
|
||||
'primary key' => ['note_id'],
|
||||
'foreign keys' => [
|
||||
'activity_location_activity_id_fkey' => ['activity', ['activity_id' => 'id']],
|
||||
'note_location_note_id_fkey' => ['note', ['note_id' => 'id']],
|
||||
],
|
||||
'indexes' => [
|
||||
'activity_location_location_id_idx' => ['location_id'],
|
||||
'note_location_location_id_idx' => ['location_id'],
|
||||
],
|
||||
];
|
||||
}
|
@ -35,7 +35,7 @@ use DateTimeInterface;
|
||||
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class ActivitySource
|
||||
class NoteSource
|
||||
{
|
||||
// {{{ Autocode
|
||||
|
||||
@ -105,12 +105,11 @@ class ActivitySource
|
||||
public static function schemaDef(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'activity_source',
|
||||
'name' => 'note_source',
|
||||
'fields' => [
|
||||
'code' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'code identifier'],
|
||||
'name' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'name of the source'],
|
||||
'url' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'url to link to'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['code'],
|
@ -106,22 +106,22 @@ class Notification
|
||||
{
|
||||
return [
|
||||
'name' => 'notification',
|
||||
'description' => 'Activity notification for profiles (that are not a mention and not result of a subscription)',
|
||||
'description' => 'Note notification for gsactors (that are not a mention and not result of a subscription)',
|
||||
'fields' => [
|
||||
'notice_id' => ['type' => 'int', 'not null' => true, 'description' => 'notice_id to give attention'],
|
||||
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'profile_id for feed receiver'],
|
||||
'reason' => ['type' => 'varchar', 'length' => 191, 'description' => 'Optional reason why this was brought to the attention of profile_id'],
|
||||
'gsactor_id' => ['type' => 'int', 'not null' => true, 'description' => 'gsactor_id for feed receiver'],
|
||||
'reason' => ['type' => 'varchar', 'length' => 191, 'description' => 'Optional reason why this was brought to the attention of gsactor_id'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['notice_id', 'profile_id'],
|
||||
'primary key' => ['notice_id', 'gsactor_id'],
|
||||
'foreign keys' => [
|
||||
'attention_notice_id_fkey' => ['notice', ['notice_id' => 'id']],
|
||||
'attention_profile_id_fkey' => ['profile', ['profile_id' => 'id']],
|
||||
'attention_gsactor_id_fkey' => ['gsactor', ['gsactor_id' => 'id']],
|
||||
],
|
||||
'indexes' => [
|
||||
'attention_notice_id_idx' => ['notice_id'],
|
||||
'attention_profile_id_idx' => ['profile_id'],
|
||||
'attention_gsactor_id_idx' => ['gsactor_id'],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
@ -1,138 +0,0 @@
|
||||
<?php
|
||||
|
||||
// {{{ License
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
// }}}
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use DateTimeInterface;
|
||||
|
||||
/**
|
||||
* Entity for Data class for Profile preferences
|
||||
*
|
||||
* @category DB
|
||||
* @package GNUsocial
|
||||
*
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2010 StatusNet Inc.
|
||||
* @author Mikael Nordfeldth <mmn@hethane.se>
|
||||
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @author Hugo Sales <hugo@fc.up.pt>
|
||||
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class ProfilePrefs
|
||||
{
|
||||
// {{{ Autocode
|
||||
|
||||
private int $profile_id;
|
||||
private string $namespace;
|
||||
private string $topic;
|
||||
private $data;
|
||||
private \DateTimeInterface $created;
|
||||
private \DateTimeInterface $modified;
|
||||
|
||||
public function setProfileId(int $profile_id): self
|
||||
{
|
||||
$this->profile_id = $profile_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getProfileId(): int
|
||||
{
|
||||
return $this->profile_id;
|
||||
}
|
||||
|
||||
public function setNamespace(string $namespace): self
|
||||
{
|
||||
$this->namespace = $namespace;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getNamespace(): string
|
||||
{
|
||||
return $this->namespace;
|
||||
}
|
||||
|
||||
public function setTopic(string $topic): self
|
||||
{
|
||||
$this->topic = $topic;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTopic(): string
|
||||
{
|
||||
return $this->topic;
|
||||
}
|
||||
|
||||
public function setData($data): self
|
||||
{
|
||||
$this->data = $data;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function setCreated(DateTimeInterface $created): self
|
||||
{
|
||||
$this->created = $created;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCreated(): DateTimeInterface
|
||||
{
|
||||
return $this->created;
|
||||
}
|
||||
|
||||
public function setModified(DateTimeInterface $modified): self
|
||||
{
|
||||
$this->modified = $modified;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getModified(): DateTimeInterface
|
||||
{
|
||||
return $this->modified;
|
||||
}
|
||||
|
||||
// }}} Autocode
|
||||
|
||||
public static function schemaDef(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'profile_prefs',
|
||||
'fields' => [
|
||||
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'user'],
|
||||
'namespace' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'namespace, like pluginname or category'],
|
||||
'topic' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'preference key, i.e. description, age...'],
|
||||
'data' => ['type' => 'blob', 'description' => 'topic data, may be anything'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['profile_id', 'namespace', 'topic'],
|
||||
'foreign keys' => [
|
||||
'profile_prefs_profile_id_fkey' => ['profile', ['profile_id' => 'id']],
|
||||
],
|
||||
'indexes' => [
|
||||
'profile_prefs_profile_id_idx' => ['profile_id'],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
@ -1,97 +0,0 @@
|
||||
<?php
|
||||
|
||||
// {{{ License
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
// }}}
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use DateTimeInterface;
|
||||
|
||||
/**
|
||||
* Entity for user profile role
|
||||
*
|
||||
* @category DB
|
||||
* @package GNUsocial
|
||||
*
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2010 StatusNet Inc.
|
||||
* @author Mikael Nordfeldth <mmn@hethane.se>
|
||||
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @author Hugo Sales <hugo@fc.up.pt>
|
||||
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class ProfileRole
|
||||
{
|
||||
// {{{ Autocode
|
||||
|
||||
private int $profile_id;
|
||||
private string $role;
|
||||
private \DateTimeInterface $created;
|
||||
|
||||
public function setProfileId(int $profile_id): self
|
||||
{
|
||||
$this->profile_id = $profile_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getProfileId(): int
|
||||
{
|
||||
return $this->profile_id;
|
||||
}
|
||||
|
||||
public function setRole(string $role): self
|
||||
{
|
||||
$this->role = $role;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRole(): string
|
||||
{
|
||||
return $this->role;
|
||||
}
|
||||
|
||||
public function setCreated(DateTimeInterface $created): self
|
||||
{
|
||||
$this->created = $created;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCreated(): DateTimeInterface
|
||||
{
|
||||
return $this->created;
|
||||
}
|
||||
|
||||
// }}} Autocode
|
||||
|
||||
public static function schemaDef(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'profile_role',
|
||||
'fields' => [
|
||||
'profile_id' => ['type' => 'int', 'not null' => true, 'description' => 'account having the role'],
|
||||
'role' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'string representing the role'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
|
||||
],
|
||||
'primary key' => ['profile_id', 'role'],
|
||||
'foreign keys' => [
|
||||
'profile_role_profile_id_fkey' => ['profile', ['profile_id' => 'id']],
|
||||
],
|
||||
'indexes' => ['profile_role_role_created_profile_id_idx' => ['role', 'created', 'profile_id']],
|
||||
];
|
||||
}
|
||||
}
|
@ -22,13 +22,11 @@ namespace App\Entity;
|
||||
use DateTimeInterface;
|
||||
|
||||
/**
|
||||
* Entity for user IM preferences
|
||||
* Entity for user notification preferences
|
||||
*
|
||||
* @category DB
|
||||
* @package GNUsocial
|
||||
*
|
||||
* @author Craig Andrews <candrews@integralblue.com>
|
||||
* @copyright 2009 StatusNet Inc.
|
||||
* @author Hugo Sales <hugo@fc.up.pt>
|
||||
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
@ -215,7 +213,7 @@ class UserNotificationPrefs
|
||||
'fields' => [
|
||||
'user_id' => ['type' => 'int', 'not null' => true],
|
||||
'transport' => ['type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'transport (ex email. xmpp, aim)'],
|
||||
'target_profile_id' => ['type' => 'int', 'default' => null, 'description' => 'If not null, settings are specific only to a given profiles'],
|
||||
'target_gsactor_id' => ['type' => 'int', 'default' => null, 'description' => 'If not null, settings are specific only to a given gsactors'],
|
||||
'activity_by_followed' => ['type' => 'bool', 'not null' => true, 'default' => true, 'description' => 'Notify when a new activity by someone we follow is made'],
|
||||
'mention' => ['type' => 'bool', 'not null' => true, 'default' => true, 'description' => 'Notify when mentioned by someone we do not follow'],
|
||||
'reply' => ['type' => 'bool', 'not null' => true, 'default' => true, 'description' => 'Notify when someone replies to a notice made by us'],
|
||||
@ -231,10 +229,10 @@ class UserNotificationPrefs
|
||||
'primary key' => ['user_id', 'transport'],
|
||||
'foreign keys' => [
|
||||
'user_notification_prefs_user_id_fkey' => ['user', ['user_id' => 'id']],
|
||||
'user_notification_prefs_target_profile' => ['profile', ['target_profile_id' => 'id']],
|
||||
'user_notification_prefs_target_gsactor' => ['gsactor', ['target_gsactor_id' => 'id']],
|
||||
],
|
||||
'indexes' => [
|
||||
'user_notification_prefs_user_target_profile_idx' => ['user_id', 'target_profile_id'],
|
||||
'user_notification_prefs_user_target_gsactor_idx' => ['user_id', 'target_gsactor_id'],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user