New item field "Post-type" and new table "permissionset" (#5408)
* "post-type" replaces "bookmark" and "type" * Removed some more type * Added index to permission set * The permission set is now stored * The permission set is now removed upon expiry * Post update now stores the permission set * New file * Permissions are now sorted * Changed documentation
This commit is contained in:
parent
0b38f1c58b
commit
5af9596dde
29 changed files with 222 additions and 145 deletions
34
mod/item.php
34
mod/item.php
|
@ -90,6 +90,7 @@ function item_post(App $a) {
|
|||
|
||||
$objecttype = null;
|
||||
$profile_uid = defaults($_REQUEST, 'profile_uid', local_user());
|
||||
$posttype = defaults($_REQUEST, 'post_type', Item::PT_ARTICLE);
|
||||
|
||||
if ($thr_parent || $thr_parent_uri) {
|
||||
if ($thr_parent) {
|
||||
|
@ -124,10 +125,6 @@ function item_post(App $a) {
|
|||
$parent_contact = Contact::getDetailsByURL($parent_item["author-link"]);
|
||||
|
||||
$objecttype = ACTIVITY_OBJ_COMMENT;
|
||||
|
||||
if (!x($_REQUEST, 'type')) {
|
||||
$_REQUEST['type'] = 'net-comment';
|
||||
}
|
||||
}
|
||||
|
||||
if ($parent) {
|
||||
|
@ -138,6 +135,7 @@ function item_post(App $a) {
|
|||
$app = strip_tags(defaults($_REQUEST, 'source', ''));
|
||||
$extid = strip_tags(defaults($_REQUEST, 'extid', ''));
|
||||
$object = defaults($_REQUEST, 'object', '');
|
||||
$wall = intval(defaults($_REQUEST, 'wall', 1));
|
||||
|
||||
// Ensure that the user id in a thread always stay the same
|
||||
if (!is_null($parent_user) && in_array($parent_user, [local_user(), 0])) {
|
||||
|
@ -259,6 +257,8 @@ function item_post(App $a) {
|
|||
$str_contact_deny = $parent_item['deny_cid'];
|
||||
$str_group_deny = $parent_item['deny_gid'];
|
||||
$private = $parent_item['private'];
|
||||
|
||||
$wall = $parent_item['wall'];
|
||||
}
|
||||
|
||||
$pubmail_enabled = defaults($_REQUEST, 'pubmail_enable', false) && !$private;
|
||||
|
@ -329,16 +329,6 @@ function item_post(App $a) {
|
|||
$contact_record = dba::selectFirst('contact', [], ['uid' => $profile_uid, 'self' => true]);
|
||||
}
|
||||
|
||||
$post_type = notags(trim($_REQUEST['type']));
|
||||
|
||||
if ($post_type === 'net-comment' && $parent_item !== null) {
|
||||
if ($parent_item['wall'] == 1) {
|
||||
$post_type = 'wall-comment';
|
||||
} else {
|
||||
$post_type = 'remote-comment';
|
||||
}
|
||||
}
|
||||
|
||||
// Look for any tags and linkify them
|
||||
$str_tags = '';
|
||||
$inform = '';
|
||||
|
@ -429,6 +419,7 @@ function item_post(App $a) {
|
|||
$contact_id = $private_id;
|
||||
$contact_record = $forum_contact;
|
||||
$_REQUEST['origin'] = false;
|
||||
$wall = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -507,11 +498,11 @@ function item_post(App $a) {
|
|||
|
||||
// embedded bookmark or attachment in post? set bookmark flag
|
||||
|
||||
$bookmark = 0;
|
||||
$data = BBCode::getAttachmentData($body);
|
||||
if (preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", $body, $match, PREG_SET_ORDER) || isset($data["type"])) {
|
||||
if ((preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", $body, $match, PREG_SET_ORDER) || isset($data["type"]))
|
||||
&& ($posttype != Item::PT_PERSONAL_NOTE)) {
|
||||
$posttype = Item::PT_PAGE;
|
||||
$objecttype = ACTIVITY_OBJ_BOOKMARK;
|
||||
$bookmark = 1;
|
||||
}
|
||||
|
||||
$body = bb_translate_video($body);
|
||||
|
@ -556,12 +547,6 @@ function item_post(App $a) {
|
|||
}
|
||||
}
|
||||
|
||||
$wall = 0;
|
||||
|
||||
if (($post_type === 'wall' || $post_type === 'wall-comment') && !count($forum_contact)) {
|
||||
$wall = 1;
|
||||
}
|
||||
|
||||
if (!strlen($verb)) {
|
||||
$verb = ACTIVITY_POST;
|
||||
}
|
||||
|
@ -588,7 +573,6 @@ function item_post(App $a) {
|
|||
|
||||
$datarray = [];
|
||||
$datarray['uid'] = $profile_uid;
|
||||
$datarray['type'] = $post_type;
|
||||
$datarray['wall'] = $wall;
|
||||
$datarray['gravity'] = $gravity;
|
||||
$datarray['network'] = $network;
|
||||
|
@ -618,6 +602,7 @@ function item_post(App $a) {
|
|||
$datarray['file'] = $categories;
|
||||
$datarray['inform'] = $inform;
|
||||
$datarray['verb'] = $verb;
|
||||
$datarray['post-type'] = $posttype;
|
||||
$datarray['object-type'] = $objecttype;
|
||||
$datarray['allow_cid'] = $str_contact_allow;
|
||||
$datarray['allow_gid'] = $str_group_allow;
|
||||
|
@ -626,7 +611,6 @@ function item_post(App $a) {
|
|||
$datarray['private'] = $private;
|
||||
$datarray['pubmail'] = $pubmail_enabled;
|
||||
$datarray['attach'] = $attachments;
|
||||
$datarray['bookmark'] = intval($bookmark);
|
||||
|
||||
// This is not a bug. The item store function changes 'parent-uri' to 'thr-parent' and fetches 'parent-uri' new. (We should change this)
|
||||
$datarray['parent-uri'] = $thr_parent_uri;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue