Giter Site home page Giter Site logo

Comments (5)

esjee avatar esjee commented on June 3, 2024

The endpoint expects an id and a type to be provided. Where type is one of user, group or nobody. The id is, of course, the id of the user or the id of the group.

To support this functionality in this gem, we introduce something like

def assign_to(type, user_or_group_id=nil)

report = Hackerone::Report.first
esjee = Hackerone::User.find 'esjee'
report.assign_to(esjee.id, 'user')

However, I'm doubting whether that's a perfect solution. Perhaps masking the details of how the API works is nicer, and we could do something like

def remove_assignee    #  assign_to 'nobody'
def assign(user_or_group_name)

report = Hackerone::Report.first
report.remove_assignee
report.assign_to 'esjee'
report.assign_to 'developers'

But maybe I'm just overthinking this. 😄

Do you have any thoughts on this? Do you plan to use this functionality, and if so, how would you like to use it?

from hackerone-client.

oreoshake avatar oreoshake commented on June 3, 2024

@esjee Woah, I didn't realize h1 had the option to assign issues to a group or even how that is managed.

report.assign_to(esjee.id, 'user')

What happens if you do something like report.assign_to(some_group.id, 'user')? Would the API reject that? It seems like supplying the type would only be useful as a sanity check, but the param is required so I'm assuming it matters greatly.

report.assign_to 'esjee'

Would this do a lookup to see if esjee is a group or a user? Same goes for developers. Assuming the assignment blows up if you supply the wrong type, I think this API is better even if it does cost an extra API call (although I'd prefer that the actual API treated the type as optional).

from hackerone-client.

esjee avatar esjee commented on June 3, 2024

What happens if you do something like report.assign_to(some_group.id, 'user')? Would the API reject that?

Well, that depends. It'll try to assign to a user with the id of the group. If you happen to have a user in your team that is lucky enough to have the same id as the group, then the API assumes you want to assign to that person. If no such user can be found, the request fails.

So yes, it matters greatly. 😕

Would this do a lookup to see if esjee is a group or a user? Same goes for developers. Assuming the assignment blows up if you supply the wrong type, I think this API is better even if it does cost an extra API call (although I'd prefer that the actual API treated the type as optional).

Cool! I'll try to implement this behavior.

from hackerone-client.

oreoshake avatar oreoshake commented on June 3, 2024

If you happen to have a user in your team that is lucky enough to have the same id as the group

Ah, I guess I was assuming a user ID couldn't be a group ID but I'm not sure where I'd get that feeling.

from hackerone-client.

oreoshake avatar oreoshake commented on June 3, 2024

Fixed in #16

from hackerone-client.

Related Issues (15)

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.