scratch-api icon indicating copy to clipboard operation
scratch-api copied to clipboard

You should be able to get the username of the person who set a variable

Open csf30816 opened this issue 6 years ago • 5 comments

using cloud.on('set',... you should be able to get the username of the person who set a variable, but I do not see that feature in your API. You should consider adding it :)

csf30816 avatar Nov 06 '17 23:11 csf30816

via callback?

skistaddy avatar Nov 07 '17 14:11 skistaddy

As far as I'm aware, the only way to get to username is by making another request to the cloud monitor page, which is not a reliable way to get the username. Unless something has changed, I do not feel that such an implementation belongs in this library.

trumank avatar Nov 07 '17 20:11 trumank

@trumank You could add a method that allows you to fetch the username via the cloud logs after the event is received and pass it into the callback. That way it doesn't run by default and can easily be used.

YodaLightsabr avatar Mar 25 '21 23:03 YodaLightsabr

@trumank You could add a method that allows you to fetch the username via the cloud logs after the event is received and pass it into the callback. That way it doesn't run by default and can easily be used.

How would you pass it into the callback at a different time than the rest of the data?

CubeyTheCube avatar Mar 26 '21 19:03 CubeyTheCube

Personally I would leave this to the end developer to implement a way to do this but if I were to implement it internally I would make it an option in the constructor to attempt to get values after they are set, before firing the event.

That said, I think it's pretty fragile like trumank said. It also risks getting rate limited depending on how often cloud variables are set.

If the values are set rarely then I can see that this could be really useful, but again I think as far as a project like this which seems to be a pretty "bare minimum" library, I would leave this to the developer to implement.

edqx avatar Apr 04 '21 22:04 edqx