jedfoster / SassMeister

The Sass playground
http://sassmeister.com
199 stars 25 forks source link

Fork option is not available when a gist belongs to you #65

Closed lolmaus closed 10 years ago

lolmaus commented 10 years ago

It is very common that one would like to save a gist, then modify it and save as a new one.

But after saving the initial gist, SassMeister does not provide the Fork option.

This leaves you no option but to open another SassMeister instance, Reset it and then copy Sass and HTML from the first instance to the new one. Very inconvenient.

jedfoster commented 10 years ago

As far as I can find, the GitHub API doesn't actually allow forking your own gists. The gist.github.com UI certainly doesn't allow it, and the API docs don't say anything about performing that action.

Further, Octokit.rb returns:

#<Sawyer::Resource:0x007fd3aacb9e38
 @_agent=<Sawyer::Agent https://api.github.com/>,
 @_fields=#<Set: {:message}>,
 @_metaclass=#<Class:#<Sawyer::Resource:0x007fd3aacb9e38>>,
 @_rels=#<Sawyer::Relation::Map: [:documentation]>,
 @attrs={:message=>"Not Found"}>

for @github.fork_gist(id) when gist id belongs to current authenticated user. So I think it's safe to say this is a forbidden action.

Got around this by simply using the "create" method with the current data from the app. Not ideal, but it works.

lolmaus commented 10 years ago

Yay, thank you.