Skip to content

Commit bb2e713

Browse files
committed
Check meta permissions for "Existing attachments" panel
1 parent 90b6632 commit bb2e713

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

htsrv/async.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,18 +1204,22 @@
12041204
if( $link_owner_class == 'Comment' )
12051205
{
12061206
$edited_Item = $LinkOwner->get_Item();
1207-
$item_ID = $edited_Item->ID;
12081207
}
12091208
else
12101209
{
1211-
$item_ID = $LinkOwner->link_Object->ID;
1210+
$edited_Item = $LinkOwner->Item;
12121211
}
1212+
$item_ID = $edited_Item->ID;
12131213

12141214
// Get list of comment IDs under Item or related to Comment:
12151215
$comments_SQL = new SQL( 'Get all the comments of an Item' );
12161216
$comments_SQL->SELECT( 'comment_ID' );
12171217
$comments_SQL->FROM( 'T_comments' );
12181218
$comments_SQL->WHERE( 'comment_item_ID = '.$DB->quote( $item_ID ) );
1219+
if( ! $edited_Item->can_meta_comment() )
1220+
{ // If current User doesn't have an access to meta comments:
1221+
$comments_SQL->WHERE( 'comment_type != "meta"' );
1222+
}
12191223
$comment_IDs = $DB->get_col( $comments_SQL );
12201224

12211225
$links_SQL = new SQL( 'Get all the links belonging to comments of an Item' );
@@ -1241,11 +1245,9 @@
12411245
else
12421246
{
12431247
global $Blog;
1244-
1248+
12451249
if( empty( $Blog ) )
12461250
{
1247-
$ItemCache = & get_ItemCache();
1248-
$edited_Item = & $ItemCache->get_by_ID( $item_ID );
12491251
$Blog = $edited_Item->get_Blog();
12501252
}
12511253

0 commit comments

Comments
 (0)