The language is now stored as well

This commit is contained in:
Michael 2023-09-03 04:20:09 +00:00
parent 573050c6ef
commit e68f781f9d
3 changed files with 4 additions and 1 deletions

View file

@ -12,6 +12,7 @@ Fields
| owner-id | Item owner | int unsigned | NO | | 0 | | | owner-id | Item owner | int unsigned | NO | | 0 | |
| contact-type | Person, organisation, news, community, relay | tinyint | NO | | 0 | | | contact-type | Person, organisation, news, community, relay | tinyint | NO | | 0 | |
| media-type | Type of media in a bit array (1 = image, 2 = video, 4 = audio | tinyint | NO | | 0 | | | media-type | Type of media in a bit array (1 = image, 2 = video, 4 = audio | tinyint | NO | | 0 | |
| language | Language information about this post | varbinary(128) | YES | | NULL | |
| created | | datetime | YES | | NULL | | | created | | datetime | YES | | NULL | |
| comments | Number of comments | mediumint unsigned | YES | | NULL | | | comments | Number of comments | mediumint unsigned | YES | | NULL | |
| activities | Number of activities (like, dislike, ...) | mediumint unsigned | YES | | NULL | | | activities | Number of activities (like, dislike, ...) | mediumint unsigned | YES | | NULL | |

View file

@ -60,7 +60,7 @@ class Engagement
return; return;
} }
$parent = Post::selectFirst(['created', 'owner-id', 'uid', 'private', 'contact-contact-type'], ['uri-id' => $item['parent-uri-id']]); $parent = Post::selectFirst(['created', 'owner-id', 'uid', 'private', 'contact-contact-type', 'language'], ['uri-id' => $item['parent-uri-id']]);
if ($parent['private'] != Item::PUBLIC) { if ($parent['private'] != Item::PUBLIC) {
Logger::debug('Non public posts are not stored', ['uri-id' => $item['uri-id'], 'parent-uri-id' => $item['parent-uri-id'], 'uid' => $parent['uid'], 'private' => $parent['private']]); Logger::debug('Non public posts are not stored', ['uri-id' => $item['uri-id'], 'parent-uri-id' => $item['parent-uri-id'], 'uid' => $parent['uid'], 'private' => $parent['private']]);
return; return;
@ -88,6 +88,7 @@ class Engagement
'owner-id' => $parent['owner-id'], 'owner-id' => $parent['owner-id'],
'contact-type' => $parent['contact-contact-type'], 'contact-type' => $parent['contact-contact-type'],
'media-type' => $mediatype, 'media-type' => $mediatype,
'language' => $parent['language'],
'created' => $parent['created'], 'created' => $parent['created'],
'comments' => DBA::count('post', ['parent-uri-id' => $item['parent-uri-id'], 'gravity' => Item::GRAVITY_COMMENT]), 'comments' => DBA::count('post', ['parent-uri-id' => $item['parent-uri-id'], 'gravity' => Item::GRAVITY_COMMENT]),
'activities' => DBA::count('post', [ 'activities' => DBA::count('post', [

View file

@ -1330,6 +1330,7 @@ return [
"owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Item owner"], "owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Item owner"],
"contact-type" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Person, organisation, news, community, relay"], "contact-type" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Person, organisation, news, community, relay"],
"media-type" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Type of media in a bit array (1 = image, 2 = video, 4 = audio"], "media-type" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Type of media in a bit array (1 = image, 2 = video, 4 = audio"],
"language" => ["type" => "varbinary(128)", "comment" => "Language information about this post"],
"created" => ["type" => "datetime", "comment" => ""], "created" => ["type" => "datetime", "comment" => ""],
"comments" => ["type" => "mediumint unsigned", "comment" => "Number of comments"], "comments" => ["type" => "mediumint unsigned", "comment" => "Number of comments"],
"activities" => ["type" => "mediumint unsigned", "comment" => "Number of activities (like, dislike, ...)"], "activities" => ["type" => "mediumint unsigned", "comment" => "Number of activities (like, dislike, ...)"],