Restrict uploads

Thanks it works

Now can we get this component to restrict to subscriber groups :stuck_out_tongue:

Only way I can do it myself is making Trust Level 3 impossible to get to by increasing the number of days, etc. And then manually adding people when they subscribe. Which is most likely the route I will take unless I can modify this by group.

2개의 좋아요

Restrict Uploads is now blocking the ability to upload at all on new post or replies.

1개의 좋아요

That’s right, sorry.

It looks like this._super() doesn’t actually report whether the user is allowed to upload images in core. I had reused it from the old component, and I already noticed yesterday that it caused issues with the placeholder logic as well.

I don’t have time to dig deeper into this right now.

One thing I noticed while testing today: using "*" in api.addComposerUploadHandler(["*"] breaks the regex used for matching upload handlers.

1개의 좋아요

I think this seems like it should be a part of core. Just my humble opinion but a way of controlling uploads by trust level, group or even individual users would be very useful.

2개의 좋아요

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

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

4개의 좋아요

I created a pull request which switches the component from trust level-based to group-based restrictions:
https://github.com/tshenry/discourse-restrict-uploads/pull/6

9개의 좋아요

@tshenry 컴포넌트를 그룹 기반으로 작동하도록 변경하는 데 관심이 있으신가요?

테마의 그룹 설정에 대한 코어의 변경 사항을 반영하기 위해 이제 변경 사항을 조정해야 할 가능성이 높습니다. 하지만 원치 않으시는 경우, 업데이트에 시간을 들이지 않아도 됩니다.

1개의 좋아요

@Moin 그룹 설정 변경 사항에 대해 언급하신 것으로 추정되는 부분에 대해 PR에 댓글을 남겼습니다. 이 작업에 계속 관심이 있으시다면 업데이트를 푸시해 주십시오. 현재 테스트 사이트에 PR 브랜치를 설정해 두었으므로, 이 작업을 진행하는 데 도움을 드릴 수 있을 것입니다.

2개의 좋아요

@Moin 님의 이 컴포넌트에 대한 훌륭한 업데이트가 병합되었습니다 :tada: Moin 님, 감사합니다!

@Arkshine 님과 @Moin 님이 올해 가져온 모든 개선 사항을 반영하도록 이 주제의 원포스터(OP)를 곧 업데이트하겠습니다.

4개의 좋아요