From b3e76dc151d40e1c18008c9b274d3246c5797aa3 Mon Sep 17 00:00:00 2001 From: Matt Tuchfarber Date: Fri, 30 Apr 2021 13:34:58 -0400 Subject: [PATCH] fix: Facebook share button on course certificates. Facebook requires a callback when using the `.ui()` method now. I don't know when this changed, but the share button is currently broken on course certificates. Facebook documentation of the `.ui()` method: https://developers.facebook.com/docs/javascript/reference/FB.ui/ --- lms/static/js/utils/facebook.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lms/static/js/utils/facebook.js b/lms/static/js/utils/facebook.js index 7abc6e87bc..1350e3c993 100644 --- a/lms/static/js/utils/facebook.js +++ b/lms/static/js/utils/facebook.js @@ -21,13 +21,18 @@ var FaceBook = (function() { }(document, 'script', 'facebook-jssdk')); }, share: function(feed_data) { - FB.ui({ - method: 'feed', - name: feed_data.share_text, - link: feed_data.share_link, - picture: feed_data.picture_link, - description: feed_data.description - }); + FB.ui( // eslint-disable-line no-undef + { + method: 'feed', + name: feed_data.share_text, + link: feed_data.share_link, + picture: feed_data.picture_link, + description: feed_data.description + }, + // The Facebook API now requires a callback. Since we weren't doing anything after posting before, + // I'm leaving this as an empty function. + function(response) {} // eslint-disable-line no-unused-vars + ); } }; }());