Code Monkey home page Code Monkey logo

Comments (3)

tbarbugli avatar tbarbugli commented on July 23, 2024

Hiding the upload box based on permissions is very prone to error, I suggest we at least expose a prop function like uploadEnabled that accepts (user, channel) and returns a boolean.

from stream-chat-react.

codekiln avatar codekiln commented on July 23, 2024

Any user that updates the permissions of a channel will also need the UI to reflect those changes. If the process of fetching permissions and reflecting them in the UI is already challenging as you say, why would it make sense to shift that burden to component users, who are less familiar with the possible difficulties?

Eventually I hacked together a way of fetching the permissions and changing the UI for users who do not have the permission to:

  • upload files with maxFileUploads={0} on regular users, and then writing some custom CSS to hide the add file button if it was disabled
  • ban, mute, flag by changing the messageActions prop for the MessageList
  • I'm still seeking an easy way to get slash commands to not show up if the user shouldn't have permission for the action underpinning a slash command

Rather than have each implementor figure out a workaround, wouldn't it make sense to fetch permissions in channel initialization and build parity into the component kit?

from stream-chat-react.

vishalnarkhede avatar vishalnarkhede commented on July 23, 2024

Hey @codekiln ,

Thank you for bringing this up. I will discuss with team and add the things mentioned by you in our list of upcoming enhancements :)

from stream-chat-react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.