Coursemology/coursemology.org — pull request #185 by fonglh (2014-08-26 14:03:14+00:00)
Title: Issue 179 enhance permission request flow

Use Facebook Javascript SDK to request for publish_actions permission when 'Share to Facebook' button is clicked in the achievement notification popup. FB object has been initialized by other parts of the application.

Keep track of the number of times user clicks on 'Share' when permission has not been granted. Do not show 'Share' button when counter reaches 3. The counter resets on a subsequent successful post. This leads to an edge case where a user who grants permission on the 3rd request and revokes it before the next 'Share' will not be shown the Share button again.

While this pull request will enable the feature for newly created achievements, existing achievements do not have a Facebook object ID and cannot be posted. This will be addressed with a run once script to create Facebook objects for all existing achievements. Newly created achievements get object IDs as the achievement code was updated in PR #167