add xchan_created, quote message blocks added to (mostly) invisible activities

This commit is contained in:
nobody 2020-11-18 20:09:05 -08:00
parent 6cb40adf12
commit ec9996e66a
6 changed files with 57 additions and 7 deletions

View file

@ -2304,26 +2304,28 @@ class Activity {
$mention = self::get_actor_bbmention($obj_actor['id']);
$quoted_content = '[quote]' . $content['content'] . '[/quote]';
if ($act->type === 'Like') {
$content['content'] = sprintf( t('Likes %1$s\'s %2$s'),$mention, ((ActivityStreams::is_an_actor($act->obj['type'])) ? t('Profile') : $act->obj['type'])) . EOL . EOL . $content['content'];
$content['content'] = sprintf( t('Likes %1$s\'s %2$s'),$mention, ((ActivityStreams::is_an_actor($act->obj['type'])) ? t('Profile') : $act->obj['type'])) . EOL . EOL . $quoted_content;
}
if ($act->type === 'Dislike') {
$content['content'] = sprintf( t('Doesn\'t like %1$s\'s %2$s'),$mention, ((ActivityStreams::is_an_actor($act->obj['type'])) ? t('Profile') : $act->obj['type'])) . EOL . EOL . $content['content'];
$content['content'] = sprintf( t('Doesn\'t like %1$s\'s %2$s'),$mention, ((ActivityStreams::is_an_actor($act->obj['type'])) ? t('Profile') : $act->obj['type'])) . EOL . EOL . $quoted_content;
}
// handle event RSVPs
if (($act->obj['type'] === 'Event') || ($act->obj['type'] === 'Invite' && array_path_exists('object/type',$act->obj) && $act->obj['object']['type'] === 'Event')) {
if ($act->type === 'Accept') {
$content['content'] = sprintf( t('Will attend %s\'s event'),$mention) . EOL . EOL . $content['content'];
$content['content'] = sprintf( t('Will attend %s\'s event'),$mention) . EOL . EOL . $quoted_content;
}
if ($act->type === 'Reject') {
$content['content'] = sprintf( t('Will not attend %s\'s event'),$mention) . EOL . EOL . $content['content'];
$content['content'] = sprintf( t('Will not attend %s\'s event'),$mention) . EOL . EOL . $quoted_content;
}
if ($act->type === 'TentativeAccept') {
$content['content'] = sprintf( t('May attend %s\'s event'),$mention) . EOL . EOL . $content['content'];
$content['content'] = sprintf( t('May attend %s\'s event'),$mention) . EOL . EOL . $quoted_content;
}
if ($act->type === 'TentativeReject') {
$content['content'] = sprintf( t('May not attend %s\'s event'),$mention) . EOL . EOL . $content['content'];
$content['content'] = sprintf( t('May not attend %s\'s event'),$mention) . EOL . EOL . $quoted_content;
}
}

43
Zotlabs/Update/_1244.php Normal file
View file

@ -0,0 +1,43 @@
<?php
namespace Zotlabs\Update;
class _1244 {
function run() {
q("START TRANSACTION");
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
$r1 = q("ALTER TABLE xchan ADD xchan_created timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' ");
$r2 = q("create index \"xchan_created_idx\" on xchan (\"xchan_created\")");
$r = ($r1 && $r2);
}
else {
$r = q("ALTER TABLE `xchan` ADD `xchan_created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' ,
ADD INDEX `xchan_created` (`xchan_created`)");
}
if($r) {
q("COMMIT");
return UPDATE_SUCCESS;
}
q("ROLLBACK");
return UPDATE_FAILED;
}
function verify() {
$columns = db_columns('xchan');
if(in_array('xchan_created',$columns)) {
return true;
}
return false;
}
}

View file

@ -19,7 +19,7 @@ use Zotlabs\Daemon\Run;
define ( 'STD_VERSION', '20.11.15' );
define ( 'ZOT_REVISION', '6.0' );
define ( 'DB_UPDATE_VERSION', 1243 );
define ( 'DB_UPDATE_VERSION', 1244 );
define ( 'PLATFORM_NAME', 'zap' );
define ( 'PLATFORM_ARCHITECTURE', 'zap' );

View file

@ -21,6 +21,7 @@ function xchan_store_lowlevel($arr) {
'xchan_connpage' => ((array_key_exists('xchan_connpage',$arr)) ? $arr['xchan_connpage'] : ''),
'xchan_name' => ((array_key_exists('xchan_name',$arr)) ? $arr['xchan_name'] : ''),
'xchan_network' => ((array_key_exists('xchan_network',$arr)) ? $arr['xchan_network'] : ''),
'xchan_created' => ((array_key_exists('xchan_created',$arr)) ? datetime_convert('UTC','UTC',$arr['xchan_created']) : datetime_convert()),
'xchan_updated' => ((array_key_exists('xchan_updated',$arr)) ? datetime_convert('UTC','UTC',$arr['xchan_updated']) : datetime_convert()),
'xchan_photo_date' => ((array_key_exists('xchan_photo_date',$arr)) ? datetime_convert('UTC','UTC',$arr['xchan_photo_date']) : NULL_DATE),
'xchan_name_date' => ((array_key_exists('xchan_name_date',$arr)) ? datetime_convert('UTC','UTC',$arr['xchan_name_date']) : NULL_DATE),

View file

@ -1301,6 +1301,7 @@ CREATE TABLE IF NOT EXISTS `xchan` (
`xchan_connpage` char(191) NOT NULL DEFAULT '',
`xchan_name` char(191) NOT NULL DEFAULT '',
`xchan_network` char(191) NOT NULL DEFAULT '',
`xchan_created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`xchan_updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`xchan_photo_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`xchan_name_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
@ -1324,6 +1325,7 @@ CREATE TABLE IF NOT EXISTS `xchan` (
KEY `xchan_censored` (`xchan_censored`),
KEY `xchan_selfcensored` (`xchan_selfcensored`),
KEY `xchan_system` (`xchan_system`),
KEY `xchan_created` (`xchan_created`),
KEY `xchan_updated` (`xchan_updated`),
KEY `xchan_type` (`xchan_type`),
KEY `xchan_deleted` (`xchan_deleted`)

View file

@ -1284,6 +1284,7 @@ CREATE TABLE "xchan" (
"xchan_connpage" text NOT NULL DEFAULT '',
"xchan_name" text NOT NULL DEFAULT '',
"xchan_network" text NOT NULL DEFAULT '',
"xchan_created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
"xchan_updated" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
"xchan_photo_date" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
"xchan_name_date" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
@ -1301,6 +1302,7 @@ create index "xchan_addr" on xchan ("xchan_addr");
create index "xchan_name" on xchan ("xchan_name");
create index "xchan_network" on xchan ("xchan_network");
create index "xchan_url" on xchan ("xchan_url");
create index "xchan_created" on xchan ("xchan_created");
create index "xchan_updated" on xchan ("xchan_updated");
create index "xchan_connurl" on xchan ("xchan_connurl");
create index "xchan_follow" on xchan ("xchan_follow");