add item.uuid to relevant places

This commit is contained in:
zotlabs 2018-11-15 16:34:09 -08:00
parent 8d2f4d9dfd
commit 39d914c9df
11 changed files with 44 additions and 32 deletions

View File

@ -40,26 +40,17 @@ class NativeWiki {
function create_wiki($channel, $observer_hash, $wiki, $acl) { function create_wiki($channel, $observer_hash, $wiki, $acl) {
// Generate unique resource_id using the same method as item_message_id() $resource_id = new_uuid();
do { $uuid = new_uuid();
$dups = false;
$resource_id = random_string();
$r = q("SELECT mid FROM item WHERE resource_id = '%s' AND resource_type = '%s' AND uid = %d LIMIT 1",
dbesc($resource_id),
dbesc(NWIKI_ITEM_RESOURCE_TYPE),
intval($channel['channel_id'])
);
if($r)
$dups = true;
} while($dups == true);
$ac = $acl->get(); $ac = $acl->get();
$mid = item_message_id(); $mid = z_root() . '/item/' . $uuid;
$arr = array(); // Initialize the array of parameters for the post $arr = array(); // Initialize the array of parameters for the post
$item_hidden = ((intval($wiki['postVisible']) === 0) ? 1 : 0); $item_hidden = ((intval($wiki['postVisible']) === 0) ? 1 : 0);
$wiki_url = z_root() . '/wiki/' . $channel['channel_address'] . '/' . $wiki['urlName']; $wiki_url = z_root() . '/wiki/' . $channel['channel_address'] . '/' . $wiki['urlName'];
$arr['aid'] = $channel['channel_account_id']; $arr['aid'] = $channel['channel_account_id'];
$arr['uuid'] = $uuid;
$arr['uid'] = $channel['channel_id']; $arr['uid'] = $channel['channel_id'];
$arr['mid'] = $mid; $arr['mid'] = $mid;
$arr['parent_mid'] = $mid; $arr['parent_mid'] = $mid;

View File

@ -133,9 +133,11 @@ class Impel extends \Zotlabs\Web\Controller {
$arr['author_xchan'] = (($j['author_xchan']) ? $j['author_xchan'] : get_observer_hash()); $arr['author_xchan'] = (($j['author_xchan']) ? $j['author_xchan'] : get_observer_hash());
$arr['mimetype'] = (($j['mimetype']) ? $j['mimetype'] : 'text/bbcode'); $arr['mimetype'] = (($j['mimetype']) ? $j['mimetype'] : 'text/bbcode');
if(! $j['mid']) if(! $j['mid']) {
$j['mid'] = item_message_id(); $j['uuid'] = item_message_id();
$j['mid'] = z_root() . '/item/' . $j['uuid'];
}
$arr['uuid'] = $j['uuid'];
$arr['mid'] = $arr['parent_mid'] = $j['mid']; $arr['mid'] = $arr['parent_mid'] = $j['mid'];

View File

@ -70,7 +70,8 @@ class Mood extends Controller {
$poster = App::get_observer(); $poster = App::get_observer();
$mid = item_message_id(); $uuid = item_message_id();
$mid = z_root() . '/item/' . $uuid;
$action = sprintf( t('%1$s is %2$s','mood'), '[zrl=' . $poster['xchan_url'] . ']' . $poster['xchan_name'] . '[/zrl]' , $verbs[$verb]); $action = sprintf( t('%1$s is %2$s','mood'), '[zrl=' . $poster['xchan_url'] . ']' . $poster['xchan_name'] . '[/zrl]' , $verbs[$verb]);
@ -78,6 +79,7 @@ class Mood extends Controller {
$arr['aid'] = get_account_id(); $arr['aid'] = get_account_id();
$arr['uid'] = $uid; $arr['uid'] = $uid;
$arr['uuid'] = $uuid;
$arr['mid'] = $mid; $arr['mid'] = $mid;
$arr['parent_mid'] = (($parent_mid) ? $parent_mid : $mid); $arr['parent_mid'] = (($parent_mid) ? $parent_mid : $mid);
$arr['author_xchan'] = $poster['xchan_hash']; $arr['author_xchan'] = $poster['xchan_hash'];

View File

@ -106,8 +106,9 @@ class Subthread extends \Zotlabs\Web\Controller {
$mid = item_message_id(); $uuid = item_message_id();
$mid = z_root() . '/item/' . $uuid;
$post_type = (($item['resource_type'] === 'photo') ? t('photo') : t('status')); $post_type = (($item['resource_type'] === 'photo') ? t('photo') : t('status'));
$links = array(array('rel' => 'alternate','type' => 'text/html', 'href' => $item['plink'])); $links = array(array('rel' => 'alternate','type' => 'text/html', 'href' => $item['plink']));
@ -145,6 +146,7 @@ class Subthread extends \Zotlabs\Web\Controller {
$arr = array(); $arr = array();
$arr['uuid'] = $uuid;
$arr['mid'] = $mid; $arr['mid'] = $mid;
$arr['aid'] = $owner_aid; $arr['aid'] = $owner_aid;
$arr['uid'] = $owner_uid; $arr['uid'] = $owner_uid;

View File

@ -16,7 +16,8 @@ function profile_activity($changed, $value) {
return; return;
$arr = array(); $arr = array();
$arr['mid'] = $arr['parent_mid'] = item_message_id(); $arr['uuid'] = item_message_id();
$arr['mid'] = $arr['parent_mid'] = z_root() . '/item/' . $arr['uuid'];
$arr['uid'] = local_channel(); $arr['uid'] = local_channel();
$arr['aid'] = $self['channel_account_id']; $arr['aid'] = $self['channel_account_id'];
$arr['owner_xchan'] = $arr['author_xchan'] = $self['xchan_hash']; $arr['owner_xchan'] = $arr['author_xchan'] = $self['xchan_hash'];

View File

@ -1759,16 +1759,18 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid,
$arr_allow_cid = check_list_permissions($channel_id, $arr_allow_cid, 'view_storage'); $arr_allow_cid = check_list_permissions($channel_id, $arr_allow_cid, 'view_storage');
} }
$mid = item_message_id(); $uuid = item_message_id();
$mid = z_root() . '/item/' . $uuid;
$objtype = ACTIVITY_OBJ_FILE; $objtype = ACTIVITY_OBJ_FILE;
$arr = array(); $arr = array();
$arr['aid'] = get_account_id(); $arr['aid'] = get_account_id();
$arr['uid'] = $channel_id; $arr['uid'] = $channel_id;
$arr['item_wall'] = 1; $arr['uuid'] = $uuid;
$arr['item_origin'] = 1; $arr['item_wall'] = 1;
$arr['item_unseen'] = 1; $arr['item_origin'] = 1;
$arr['item_unseen'] = 1;
$arr['author_xchan'] = $poster['xchan_hash']; $arr['author_xchan'] = $poster['xchan_hash'];
$arr['owner_xchan'] = $poster['xchan_hash']; $arr['owner_xchan'] = $poster['xchan_hash'];
$arr['title'] = ''; $arr['title'] = '';
@ -1813,8 +1815,10 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid,
$private = (($u_arr_allow_cid[0] || $u_arr_allow_gid[0] || $u_arr_deny_cid[0] || $u_arr_deny_gid[0]) ? 1 : 0); $private = (($u_arr_allow_cid[0] || $u_arr_allow_gid[0] || $u_arr_deny_cid[0] || $u_arr_deny_gid[0]) ? 1 : 0);
$u_mid = item_message_id(); $uuid = item_message_id();
$u_mid = z_root() . '/item/' . $uuid;
$arr['uuid'] = $uuid;
$arr['mid'] = $u_mid; $arr['mid'] = $u_mid;
$arr['parent_mid'] = $u_mid; $arr['parent_mid'] = $u_mid;
$arr['allow_cid'] = perms2str($u_arr_allow_cid); $arr['allow_cid'] = perms2str($u_arr_allow_cid);

View File

@ -1125,11 +1125,14 @@ function event_store_item($arr, $event) {
} }
} }
if(! $arr['mid']) if(! $arr['mid']) {
$arr['mid'] = item_message_id(); $arr['uuid'] = item_message_id();
$arr['mid'] = z_root() . '/item/' . $arr['uuid'];
}
$item_arr['aid'] = $z[0]['channel_account_id']; $item_arr['aid'] = $z[0]['channel_account_id'];
$item_arr['uid'] = $arr['uid']; $item_arr['uid'] = $arr['uid'];
$item_arr['uuid'] = $arr['uuid'];
$item_arr['author_xchan'] = $arr['event_xchan']; $item_arr['author_xchan'] = $arr['event_xchan'];
$item_arr['mid'] = $arr['mid']; $item_arr['mid'] = $arr['mid'];
$item_arr['parent_mid'] = $arr['mid']; $item_arr['parent_mid'] = $arr['mid'];

View File

@ -351,7 +351,8 @@ function store_doc_file($s) {
$x = item_store_update($item); $x = item_store_update($item);
} }
else { else {
$item['mid'] = $item['parent_mid'] = item_message_id(); $item['uuid'] = $item_message_id();
$item['mid'] = $item['parent_mid'] = z_root() . '/item/' . $item['uuid'];
$x = item_store($item); $x = item_store($item);
} }

View File

@ -1520,7 +1520,8 @@ function import_webpage_element($element, $channel, $type) {
} }
else { // otherwise, generate the creation times and unique id else { // otherwise, generate the creation times and unique id
$arr['created'] = datetime_convert('UTC', 'UTC'); $arr['created'] = datetime_convert('UTC', 'UTC');
$arr['mid'] = $arr['parent_mid'] = item_message_id(); $arr['uuid'] = item_message_id();
$arr['mid'] = $arr['parent_mid'] = z_root() . '/item/' . $arr['uuid'];
} }
// Update the edited time whether or not the element already exists // Update the edited time whether or not the element already exists
$arr['edited'] = datetime_convert('UTC', 'UTC'); $arr['edited'] = datetime_convert('UTC', 'UTC');

View File

@ -4765,7 +4765,8 @@ function item_create_edit_activity($post) {
$new_item['id'] = 0; $new_item['id'] = 0;
$new_item['parent'] = 0; $new_item['parent'] = 0;
$new_item['mid'] = item_message_id(); $new_item['uuid'] = item_message_id();
$new_item['mid'] = z_root() . '/item/' . $new_item['uuid'];
$new_item['body'] = sprintf( t('[Edited %s]'), (($update_item['item_thread_top']) ? t('Post','edit_activity') : t('Comment','edit_activity'))); $new_item['body'] = sprintf( t('[Edited %s]'), (($update_item['item_thread_top']) ? t('Post','edit_activity') : t('Comment','edit_activity')));

View File

@ -441,11 +441,13 @@ function photo_upload($channel, $observer, $args) {
} }
} }
else { else {
$mid = item_message_id(); $uuid = item_message_id();
$mid = z_root() . '/item/' . $uuid;
$arr = [ $arr = [
'aid' => $account_id, 'aid' => $account_id,
'uid' => $channel_id, 'uid' => $channel_id,
'uuid' => $uuid,
'mid' => $mid, 'mid' => $mid,
'parent_mid' => $mid, 'parent_mid' => $mid,
'item_hidden' => $item_hidden, 'item_hidden' => $item_hidden,
@ -827,12 +829,14 @@ function photos_create_item($channel, $creator_hash, $photo, $visible = false) {
$item_hidden = (($visible) ? 0 : 1 ); $item_hidden = (($visible) ? 0 : 1 );
$mid = item_message_id(); $uuid = item_message_id();
$mid = z_root() . '/item/' . $uuid;
$arr = array(); $arr = array();
$arr['aid'] = $channel['channel_account_id']; $arr['aid'] = $channel['channel_account_id'];
$arr['uid'] = $channel['channel_id']; $arr['uid'] = $channel['channel_id'];
$arr['uuid'] = $uuid;
$arr['mid'] = $mid; $arr['mid'] = $mid;
$arr['parent_mid'] = $mid; $arr['parent_mid'] = $mid;
$arr['item_wall'] = 1; $arr['item_wall'] = 1;