diff --git a/src/Entity/Avatar.php b/src/Entity/Avatar.php index 9adca72b88..c33bcbbf6c 100644 --- a/src/Entity/Avatar.php +++ b/src/Entity/Avatar.php @@ -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' => [ diff --git a/src/Entity/Conversation.php b/src/Entity/Conversation.php index d36fa5d07b..0cf5862da2 100644 --- a/src/Entity/Conversation.php +++ b/src/Entity/Conversation.php @@ -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']]], ]; } } diff --git a/src/Entity/Follow.php b/src/Entity/Follow.php index 7780f94303..542746f6c1 100644 --- a/src/Entity/Follow.php +++ b/src/Entity/Follow.php @@ -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'], diff --git a/src/Entity/FollowQueue.php b/src/Entity/FollowQueue.php index e9628e8e77..3ff2ff3dde 100644 --- a/src/Entity/FollowQueue.php +++ b/src/Entity/FollowQueue.php @@ -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']], ], ]; } diff --git a/src/Entity/Profile.php b/src/Entity/GSActor.php similarity index 92% rename from src/Entity/Profile.php rename to src/Entity/GSActor.php index fa9e7a272d..80bb271ee7 100644 --- a/src/Entity/Profile.php +++ b/src/Entity/GSActor.php @@ -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'], ], ]; diff --git a/src/Entity/ProfileBlock.php b/src/Entity/GSActorBlock.php similarity index 89% rename from src/Entity/ProfileBlock.php rename to src/Entity/GSActorBlock.php index 419a5d8a98..ee24282849 100644 --- a/src/Entity/ProfileBlock.php +++ b/src/Entity/GSActorBlock.php @@ -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']], ], ]; } diff --git a/src/Entity/ProfileList.php b/src/Entity/GSActorCircle.php similarity index 68% rename from src/Entity/ProfileList.php rename to src/Entity/GSActorCircle.php index e56e0a4f54..06600a02f1 100644 --- a/src/Entity/ProfileList.php +++ b/src/Entity/GSActorCircle.php @@ -17,12 +17,8 @@ // along with GNU social. If not, see . // }}} -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'], ], ]; } diff --git a/src/Entity/ProfileTag.php b/src/Entity/GSActorTag.php similarity index 81% rename from src/Entity/ProfileTag.php rename to src/Entity/GSActorTag.php index 3bbb8307f9..99fe20cd59 100644 --- a/src/Entity/ProfileTag.php +++ b/src/Entity/GSActorTag.php @@ -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'], ], ]; } diff --git a/src/Entity/ProfileTagFollow.php b/src/Entity/GSActorTagFollow.php similarity index 77% rename from src/Entity/ProfileTagFollow.php rename to src/Entity/GSActorTagFollow.php index 1553809993..c6fa6007e3 100644 --- a/src/Entity/ProfileTagFollow.php +++ b/src/Entity/GSActorTagFollow.php @@ -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'], ], ]; } diff --git a/src/Entity/Group.php b/src/Entity/Group.php index 70fa9bbf58..5940f46c13 100644 --- a/src/Entity/Group.php +++ b/src/Entity/Group.php @@ -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'], ], ]; } diff --git a/src/Entity/GroupBlock.php b/src/Entity/GroupBlock.php index 340cdb5ded..dd0c2e1a81 100644 --- a/src/Entity/GroupBlock.php +++ b/src/Entity/GroupBlock.php @@ -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']], ], ]; diff --git a/src/Entity/GroupJoinQueue.php b/src/Entity/GroupJoinQueue.php index 15f6ed8634..815e3921c1 100644 --- a/src/Entity/GroupJoinQueue.php +++ b/src/Entity/GroupJoinQueue.php @@ -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']], ], ]; diff --git a/src/Entity/GroupMember.php b/src/Entity/GroupMember.php index a43bae3f1d..16f61cba8b 100644 --- a/src/Entity/GroupMember.php +++ b/src/Entity/GroupMember.php @@ -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'], ], ]; diff --git a/src/Entity/LocalUser.php b/src/Entity/LocalUser.php index bd0148149f..b8187336d7 100644 --- a/src/Entity/LocalUser.php +++ b/src/Entity/LocalUser.php @@ -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' => [ diff --git a/src/Entity/Activity.php b/src/Entity/Note.php similarity index 69% rename from src/Entity/Activity.php rename to src/Entity/Note.php index a6de78619a..1df234e951 100644 --- a/src/Entity/Activity.php +++ b/src/Entity/Note.php @@ -29,15 +29,11 @@ use DateTimeInterface; * @category DB * @package GNUsocial * - * @author Zach Copley - * @copyright 2010 StatusNet Inc. - * @author Mikael Nordfeldth - * @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org * @author Hugo Sales * @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; diff --git a/src/Entity/ActivityTag.php b/src/Entity/NoteHashtag.php similarity index 70% rename from src/Entity/ActivityTag.php rename to src/Entity/NoteHashtag.php index 4508737990..d9f7ca8ac0 100644 --- a/src/Entity/ActivityTag.php +++ b/src/Entity/NoteHashtag.php @@ -17,10 +17,6 @@ // along with GNU social. If not, see . // }}} -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'], ], ]; } diff --git a/src/Entity/ActivityLocation.php b/src/Entity/NoteLocation.php similarity index 91% rename from src/Entity/ActivityLocation.php rename to src/Entity/NoteLocation.php index 1e1a225778..6b7b013467 100644 --- a/src/Entity/ActivityLocation.php +++ b/src/Entity/NoteLocation.php @@ -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'], ], ]; } diff --git a/src/Entity/ActivitySource.php b/src/Entity/NoteSource.php similarity index 93% rename from src/Entity/ActivitySource.php rename to src/Entity/NoteSource.php index 16bf72db53..715ae6c460 100644 --- a/src/Entity/ActivitySource.php +++ b/src/Entity/NoteSource.php @@ -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'], diff --git a/src/Entity/Notification.php b/src/Entity/Notification.php index 24f5abdf2c..acedfbf356 100644 --- a/src/Entity/Notification.php +++ b/src/Entity/Notification.php @@ -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'], ], ]; } diff --git a/src/Entity/ProfilePrefs.php b/src/Entity/ProfilePrefs.php deleted file mode 100644 index 1b1e0fe74b..0000000000 --- a/src/Entity/ProfilePrefs.php +++ /dev/null @@ -1,138 +0,0 @@ -. -// }}} - -namespace App\Entity; - -use DateTimeInterface; - -/** - * Entity for Data class for Profile preferences - * - * @category DB - * @package GNUsocial - * - * @author Zach Copley - * @copyright 2010 StatusNet Inc. - * @author Mikael Nordfeldth - * @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org - * @author Hugo Sales - * @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'], - ], - ]; - } -} diff --git a/src/Entity/ProfileRole.php b/src/Entity/ProfileRole.php deleted file mode 100644 index 50b0becf13..0000000000 --- a/src/Entity/ProfileRole.php +++ /dev/null @@ -1,97 +0,0 @@ -. -// }}} - -namespace App\Entity; - -use DateTimeInterface; - -/** - * Entity for user profile role - * - * @category DB - * @package GNUsocial - * - * @author Zach Copley - * @copyright 2010 StatusNet Inc. - * @author Mikael Nordfeldth - * @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org - * @author Hugo Sales - * @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']], - ]; - } -} diff --git a/src/Entity/UserNotificationPrefs.php b/src/Entity/UserNotificationPrefs.php index 7925fde439..53fd62f6be 100644 --- a/src/Entity/UserNotificationPrefs.php +++ b/src/Entity/UserNotificationPrefs.php @@ -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 - * @copyright 2009 StatusNet Inc. * @author Hugo Sales * @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'], ], ]; }