Add review request metadata for social media sites and chat services.

Review Request #8420 — Created Sept. 20, 2016 and submitted

Information

Review Board
release-3.0.x
53e6642...

Reviewers

Services like Facebook, Twitter, Slack, and others can make use of
metadata stored on a page in order to provide more useful defaults for
posts. Slack in particular benefits from this metadata, showing
informative details on a link entered in the chat so that users can get
a preview without first clicking the link.

This adds some metadata to the review request, diff viewer, and file
attachment pages, using both the Facebook OpenGraph and Twitter Card
metadata formats. Slack and other services will recognize these as well.

This metadata consists of a page title for the post/preview, a
description (based on the review request description), an optional image
(first image file attachment on the review request, if any), and
branch/repository information.

Combined with the upcoming Slack integration, this should prove to be a
far better link sharing experience for many of our users.

Tested the review request, diff viewer, and file attachment pages on
Facebook (through their previewer tool) and Slack. Twitter's own tool was
not working, but this seems due to an issue in talking to the dev server.

Viewed the source of each page and checked the output.

Tested with and without file attachments, repositories, and branches.


Description From Last Updated

Can you say what type the elements are?

daviddavid

Don't we need to do some kind of escaping to make sure that nothing in here has " or >?

daviddavid

Col: 80 E501 line too long (81 > 79 characters)

reviewbotreviewbot
chipx86
david
  1. 
      
  2. reviewboard/reviews/views.py (Diff revision 1)
     
     
    Show all issues

    Can you say what type the elements are?

    1. Sure. I left it out because it overflowed the line.

  3. reviewboard/templates/reviews/reviewable_base.html (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    Don't we need to do some kind of escaping to make sure that nothing in here has " or >?

    1. Nope, < becomes &lt; and " becomes ^quot; like normal. This is no different than any other usage we have.

  4. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/ui/base.py
        reviewboard/reviews/ui/image.py
        reviewboard/reviews/context.py
    
    Ignored Files:
        reviewboard/templates/reviews/reviewable_base.html
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/ui/base.py
        reviewboard/reviews/ui/image.py
        reviewboard/reviews/context.py
    
    Ignored Files:
        reviewboard/templates/reviews/reviewable_base.html
    
    
  2. reviewboard/reviews/views.py (Diff revision 2)
     
     
    Show all issues
    Col: 80
     E501 line too long (81 > 79 characters)
    
  3. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-3.0.x (2e2d127)