# Restrict uploads

**URL:** https://meta.discourse.org/t/restrict-uploads/112688
**Category:** Theme component
**Created:** [March 27, 2019, 11:03am UTC](https://meta.discourse.org/t/restrict-uploads/112688 "2019-03-27T11:03:40Z")
**Posts on this page:** 1
**Showing post:** 30

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [January 25, 2026, 3:18pm UTC](https://meta.discourse.org/t/restrict-uploads/112688/30 "2026-01-25T15:18:08Z")

</div>

I believe you need to use the subclass method to overwrite this computed descriptor correctly.

```js
import discourseComputed from "discourse-common/utils/decorators";

api.modifyClass("service:composer", 
  (SuperClass) => class extends SuperClass {
    @discourseComputed
    allowUpload() {
      return super.allowUpload && canUpload;
    }
  }
);

```

EDIT:

Made a PR:

[https://github.com/tshenry/discourse-restrict-uploads/pull/4](https://github.com/tshenry/discourse-restrict-uploads/pull/4)

---

_[View the full topic](https://meta.discourse.org/t/restrict-uploads/112688)._
