File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -349,6 +349,7 @@ protected function canUpload() {
349
349
$ permissionCategory = CategoryModel::permissionCategory (Gdn::controller ()->data ('Category ' ));
350
350
$ discussionsUploads = CategoryModel::checkPermission ($ permissionCategory , 'Vanilla.Discussions.Uploads ' );
351
351
$ commentsUploads = CategoryModel::checkPermission ($ permissionCategory , 'Vanilla.Comments.Uploads ' );
352
+ $ categoryType = val ('DisplayAs ' , Gdn::controller ()->data ('Category ' ));
352
353
// User has both permissions
353
354
if ($ commentsUploads && $ discussionsUploads ) {
354
355
$ this ->canUpload = true ;
@@ -358,7 +359,7 @@ protected function canUpload() {
358
359
case 'NewDiscussion ' :
359
360
// Always true. User can change a category before posting discussion.
360
361
// Check upload permissions on the client
361
- $ this ->canUpload = true ;
362
+ $ this ->canUpload = $ categoryType == " Discussions " ? $ discussionsUploads : true ;
362
363
break ;
363
364
case 'EditDiscussion ' :
364
365
$ this ->canUpload = $ discussionsUploads ;
@@ -375,6 +376,7 @@ protected function canUpload() {
375
376
// a category is not selected, check permission on the client
376
377
switch ($ actionType ) {
377
378
case 'NewDiscussion ' :
379
+ // Check upload permissions on the client
378
380
$ this ->canUpload = true ;
379
381
break ;
380
382
default :
You can’t perform that action at this time.
0 commit comments