Skip to content

Commit

Permalink
facebook publish: turn off RSVPing since FB disabled it
Browse files Browse the repository at this point in the history
for #817
  • Loading branch information
snarfed committed Apr 25, 2018
1 parent ffa39e8 commit 71e549c
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 69 deletions.
2 changes: 1 addition & 1 deletion models.py
Expand Up @@ -41,7 +41,7 @@ def get_type(obj):
return 'repost'
elif type == 'issue':
return 'post'
elif verb in gr_source.RSVP_TO_EVENT:
elif verb in gr_source.RSVP_VERB_TO_COLLECTION:
return 'rsvp'
elif (type == 'comment' or obj.get('inReplyTo') or
obj.get('context', {}).get('inReplyTo')):
Expand Down
14 changes: 9 additions & 5 deletions publish.py
Expand Up @@ -40,6 +40,7 @@
from google.appengine.ext import ndb
from granary import microformats2
from granary import source as gr_source
from granary.source import RSVP_VERB_TO_COLLECTION
from oauth_dropins import facebook as oauth_facebook
from oauth_dropins import flickr as oauth_flickr
from oauth_dropins import github as oauth_github
Expand Down Expand Up @@ -380,14 +381,17 @@ def attempt_single_item(self, item):
if not self.authorize():
return gr_source.creation_result(abort=True)

# RIP Facebook comments/likes. https://github.com/snarfed/bridgy/issues/350
# RIP Facebook.
# https://github.com/snarfed/bridgy/issues/817
# https://github.com/snarfed/bridgy/issues/350
verb = obj.get('verb')
if (isinstance(self.source, FacebookPage) and
(obj_type == 'comment' or obj.get('verb') == 'like')):
(obj_type == 'comment' or verb == 'like' or verb in RSVP_VERB_TO_COLLECTION)):
return gr_source.creation_result(
abort=True,
error_plain='Facebook comments and likes are no longer supported. :(',
error_html='<a href="https://github.com/snarfed/bridgy/issues/350">'
'Facebook comments and likes are no longer supported.</a> :(')
error_plain='Facebook RSVPs, comments, and likes are not supported. :(',
error_html='<a href="https://brid.gy/about#facebook-publish">'
'Facebook RSVPs, comments, and likes are not supported.</a> :(')

if self.PREVIEW:
result = self.source.gr_source.preview_create(
Expand Down
93 changes: 33 additions & 60 deletions templates/about.html
Expand Up @@ -10,7 +10,7 @@
<li class="answer">
<p>Bridgy pulls comments, likes, and reshares on social networks back to your
web site. You can also use it to post to social networks - or comment, like,
reshare, or even RSVP - from your own web site.
or reshare - from your own web site.
</p>

<p>A picture is worth a thousand words, so here's a screenshot of comments,
Expand Down Expand Up @@ -97,7 +97,7 @@
<li><a href="#webmentions">Can I do this automatically, whenever
I post something new on my web site?</a></li>
<li><a href="#reply">How do I reply to a tweet from my web site?</a></li>
<li><a href="#like">How do I like, retweet, or RSVP from my web site?</a></li>
<li><a href="#like">How do I like or retweet from my web site?</a></li>
<li><a href="#picture">How do I post a picture?</a></li>
<li><a href="#video">How do I post a video?</a></li>
<li><a href="#person-tag">How do I tag someone in a post?</a></li>
Expand All @@ -106,8 +106,7 @@
<li><a href="#github-issue-comment">How do I create a GitHub issue or comment?</a></li>
<li><a href="#github-reaction">How do I post an emoji reaction on a GitHub issue or PR?</a></li>
<li><a href="#github-star">How do I star a GitHub repo?</a></li>
<li><a href="#facebook-publish">What happened to publishing Facebook
comments and likes?</li>
<li><a href="#facebook-publish">What happened to Facebook?</li>
<li><a href="#omit-link">Can I disable the link back to my post?</a></li>
<li><a href="#ignore-formatting">Can I disable the plain text whitespace and
formatting?</a></li>
Expand Down Expand Up @@ -160,7 +159,7 @@
fetch and parse them.
</p>
<p>
Bridgy can also publish posts, comments, likes, and RSVPs from your web
Bridgy can also publish posts, comments, likes, and retweets from your web
site <em>to</em> social networks. When you ask Bridgy to publish a post, it
analyzes its microformats data and publishes it using the social network APIs.
</p>
Expand Down Expand Up @@ -790,8 +789,7 @@ <h3 id="publish">Publishing</h3>
<p>It's not just for posts or tweets, either! You can use Bridgy to publish
<a href="#reply">replies</a>,
<a href="#repost">retweets</a>,
<a href="#like">likes</a>,
<a href="#like">RSVPs</a>, and even
<a href="#like">likes</a>, and even
<a href="#person-tag">tag people</a> in photos!
<a href="#publish-types">Here's the full list.</a>
</li>
Expand All @@ -810,7 +808,6 @@ <h3 id="publish">Publishing</h3>
<a href="http://microformats.org/wiki/rel-in-reply-to"><code>in-reply-to</code></a>,
<a href="https://indieweb.org/like"><code>u-like-of</code></a>,
<a href="https://indieweb.org/like"><code>u-repost-of</code></a>,
<a href="https://indieweb.org/rsvp"><code>p-rsvp</code></a>,
<a href="https://indieweb.org/photo"><code>u-photo</code></a>,
<a href="https://indieweb.org/tag"><code>u-category</code></a> (for
<a href="https://indieweb.org/person-tag">tagging</a>), and
Expand Down Expand Up @@ -847,12 +844,7 @@ <h3 id="publish">Publishing</h3>
may include <a href="#location">location</a> and
<a href="#picture">up to four photos</a> or
<a href="#video">one video</a>.</li>
<li>Facebook posts and RSVPs, <a href="#facebook-publish">but not comments or
likes</a>. Posts support both users and pages, and may include a
<a href="#picture">photo</a>, <a href="#video">video</a>, and/or
<a href="#person-tag">people tags</a>. RSVPs support
<em>yes, no,</em> and <em>maybe</em>,
<a href="https://github.com/snarfed/bridgy/issues/717#issuecomment-272750964">but not <em>interested</em></a>.
<li>Facebook posts, <a href="#facebook-publish">until August 2018</a>. Posts support both users and pages, and may include a <a href="#picture">photo</a>, <a href="#video">video</a>, and/or <a href="#person-tag">people tags</a>. <a href="#facebook-publish">Not comments, likes, or RSVPs.</a>
</li>
<li>Flickr photos, videos, comments, and favorites. Photos may include
<a href="#location">location</a>,
Expand Down Expand Up @@ -939,18 +931,14 @@ <h3 id="publish">Publishing</h3>
</p>
</li>

<li id="like" class="question">How do I like, retweet, or RSVP from my web
site?</li>
<li id="like" class="question">How do I like or retweet from my web site?</li>
<li class="answer">
<p>
Liking, retweeting, and RSVPing are almost exactly the
<p>Liking and retweeting are almost exactly the
<a href="#reply">same as replying</a>. The only difference is that you use
<code><a href="https://indieweb.org/like">u-like-of</a></code>
for a like (or favorite),
for a like (or favorite) or
<code><a href="https://indieweb.org/repost">u-repost-of</a></code> for a
retweet,
or <code><a href="https://indieweb.org/rsvp">p-rsvp</a></code> for an
RSVP.
retweet.

<pre>
&lt;a class="<span class='keyword'>u-like-of</span>" href="<a href='https://www.flickr.com/photos/40721178@N00/24476817906/'>https://www.flickr.com/photos/40721178@N00/24476817906/</a>"&gt;&lt;/a&gt;
Expand All @@ -959,21 +947,7 @@ <h3 id="publish">Publishing</h3>
<pre>
&lt;a class="<span class='keyword'>u-repost-of</span>" href="<a href='https://twitter.com/schnarfed/status/448205453911015425'>https://twitter.com/schnarfed/status/448205453911015425</a>"&gt;&lt;/a&gt;
</pre>

<pre>
&lt;data class="<span class='keyword'>p-rsvp</span>" value="<span class='keyword'>yes</span>"&gt;<span class='value'>I'm in!</span>&lt;/data&gt;
&lt;a class="<span class='keyword'>u-in-reply-to</span>" href="<a href='https://www.facebook.com/events/1409507205977978/'>https://www.facebook.com/events/1409507205977978/</a>"&gt;&lt;/a&gt;
</pre>
</p>

<p>Here's an example screencast of RSVPing to a Facebook event:</p>

<p style="text-align: center">
<iframe src="//www.youtube.com/embed/otq0rcidmyI"
width="420" height="315" class="shadow" frameborder="0" allowfullscreen>
</iframe>
</p>

</li>

<li id="picture" class="question">How do I post a picture?</li>
Expand Down Expand Up @@ -1089,27 +1063,27 @@ <h3 id="publish">Publishing</h3>
</pre>
</li>

<li id="facebook-publish" class="question">What happened to publishing Facebook
comments and likes?</li>
<li id="facebook-publish" class="question">What happened to Facebook?</li>
<li class="answer">
<p>
Bridgy Publish supported Facebook likes and comments for almost a
year, <a href="https://snarfed.org/2014-03-25_bridgy-publish">from its
launch</a> on March 24
2014 <a href="https://github.com/snarfed/bridgy/commit/0e44fe28c1df5026b2b237d2c094a0a0ed9c8c00">until
February 14 2015</a>.
<p>Bridgy Publish supported Facebook posts and RSVPs for over four years, <a href="https://snarfed.org/2014-03-25_bridgy-publish">starting with its launch</a> on March 24, 2014.
</p>

<p>After the <a href="https://www.theverge.com/2018/4/10/17165130/facebook-cambridge-analytica-scandal">Cambridge Analytica scandal</a> broke, Facebook started limiting its API in a number of ways. Notably, <a href="https://developers.facebook.com/blog/post/2018/04/24/new-facebook-platform-product-changes-policy-updates/">it disabled RSVPing on April 24, 2018, and will disable posting on August 1, 2018,</a> which will effectively kill Bridgy Publish for Facebook. RIP, we'll miss you!
</p>

<p>Bridgy Publish also supported Facebook likes and comments for
almost a year, <a href="https://github.com/snarfed/bridgy/commit/0e44fe28c1df5026b2b237d2c094a0a0ed9c8c00">up to February 14, 2015</a>.
<a href="https://developers.facebook.com/docs/apps/changelog#v2_0_graph_api">Facebook's
v2.x API</a>
<a href="https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_graph_api">makes
<a href="https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_graph_api">made
it much harder</a> to map backward from a Facebook post's URL to its API object
id, and even when you can, the API usually won't let you read the post or like
or comment on it. You need
the <a href="https://developers.facebook.com/docs/facebook-login/permissions/#reference-read_stream"><code>read_stream</code>
permission</a>, which Facebook only gives out in very rare circumstances.</p>

<p><a href="https://github.com/snarfed/bridgy/issues/350">Lots more gory details
here.</a> <a href="https://snarfed.org/2015-02-14_13259">RIP Facebook liking and
commenting</a>, we'll miss you!</p>
permission</a>, which Facebook only gave out in very rare circumstances.
<a href="https://github.com/snarfed/bridgy/issues/350">Lots more gory details here.</a>
</p>
</li>

<li id="omit-link" class="question">Can I disable the link back to my post?</li>
<li class="answer">
Expand All @@ -1124,7 +1098,7 @@ <h3 id="publish">Publishing</h3>
equivalent to sending a webmention with the query parameter <code>bridgy_omit_link=maybe</code>
or including an element like <code>&lt;data class="p-bridgy-omit-link" value="maybe" /&gt;</code>
in the post body.</p>
<p>Please note that if you omit the link and want Bridgy to report back responses to your posts,
<p>Please note that if you omit the link and want Bridgy to report back responses to your posts,
it needs <a href="#link">additional markup</a> to find the corresponding post on your website.</p>
</li>

Expand Down Expand Up @@ -1173,16 +1147,15 @@ <h3 id="publish">Publishing</h3>

<li id="response" class="question">How does Bridgy respond to webmentions?</li>
<li class="answer">

<p>Bridgy handles webmentions synchronously, so it knows the result when it
responds. A <code>POST</code> to
<code>https://brid.gy/publish/webmention</code> will return
<code>201 Created</code> on success with a JSON response containing at least
a <code>url</code> field that points to the silo object that it operated on. The
same URL is included in the <code>Location</code> HTTP header. For
Twitter likes and Facebook event RSVPs, this is the tweet, post, or event.
If a new object was created, e.g. a Facebook post or Twitter tweet, @-reply, or
retweet, there will also be an <code>id</code> field with the silo id of that
object.
responds. A <code>POST</code> to <code>https://brid.gy/publish/webmention</code>
will return <code>201 Created</code> on success with a JSON response containing
at least a <code>url</code> field that points to the silo object that it
operated on. The same URL is included in the <code>Location</code> HTTP header.
For Twitter likes, this is the tweet. If a new object was created, e.g. a
Facebook post or Twitter tweet, @-reply, or retweet, there will also be
an <code>id</code> field with the silo id of that object.
</p>
<p>For example, this request for an original post:
</p>
Expand Down
15 changes: 12 additions & 3 deletions test/test_publish.py
Expand Up @@ -1169,12 +1169,18 @@ def test_missing_backlink(self):
self.mox.ReplayAll()
self.assert_error("Couldn't find link to http://localhost/publish/fake")

def test_facebook_comment_and_like_disabled(self):
def test_facebook_comment_like_rsvp_disabled(self):
self.source = facebook.FacebookPage(id='789', features=['publish'],
domains=['mr.x'])
self.source.domain_urls = ['http://mr.x/']
self.source.put()

self.expect_requests_get('http://mr.x/rsvp', """
<article class="h-entry">
<a class="u-in-reply-to" href="http://fa.ke/event"></a>
<data class="p-rsvp" value="yes"></data>
<a href="http://localhost/publish/facebook"></a>
</article>""")
self.expect_requests_get('http://mr.x/like', """
<article class="h-entry">
<a class="u-like-of" href="http://facebook.com/789/posts/456">liked this</a>
Expand All @@ -1187,12 +1193,15 @@ def test_facebook_comment_and_like_disabled(self):
</article>""")
self.mox.ReplayAll()

self.assert_error('Facebook comments and likes are no longer supported',
self.assert_error('Facebook RSVPs, comments, and likes are not supported',
source='http://mr.x/rsvp',
target='https://brid.gy/publish/facebook')
self.assert_error('Facebook RSVPs, comments, and likes are not supported',
source='http://mr.x/like',
target='https://brid.gy/publish/facebook')
self.assertEquals('failed', Publish.query().get().status)

self.assert_error('Facebook comments and likes are no longer supported',
self.assert_error('Facebook RSVPs, comments, and likes are not supported',
source='http://mr.x/comment',
target='https://brid.gy/publish/facebook',
preview=True)
Expand Down

0 comments on commit 71e549c

Please sign in to comment.