Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #741: Add a origin help comment to issue (for GitHub users) #991

Merged
merged 4 commits into from
Apr 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions webcompat/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
PROXY_REPORT = 'github-proxy-report'
SCHEMES = ('http://', 'https://')
BAD_SCHEMES = ('http:/', 'https:/', 'http:', 'https:')
GITHUB_HELP = u'_From [webcompat.com](https://webcompat.com/) with ❤️_'

problem_choices = [
(u'detection_bug', u'Desktop site instead of mobile site'),
Expand Down Expand Up @@ -208,11 +209,14 @@ def build_formdata(form_object):

**Steps to Reproduce**
{description}

'''.format(**formdata)
# Add the image, if there was one.
if form_object.get('image_upload') is not None:
body += '\n\n![Screenshot of the site issue]({image_url})'.format(
image_url=form_object.get('image_upload').get('url'))
# Append "from webcompat.com" message to bottom (for GitHub issue viewers)
body += u'\n\n{0}'.format(GITHUB_HELP)
result = {}
result['title'] = summary
result['body'] = body
Expand Down
10 changes: 9 additions & 1 deletion webcompat/static/js/lib/issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,21 @@ issues.BodyView = Backbone.View.extend({
render: function() {
this.$el.html(this.template(this.model.toJSON()));
// hide metadata
$('.js-Issue-markdown')
var issueDesc = $('.js-Issue-markdown');
issueDesc
.contents()
.filter(function() {
//find the bare html comment-ish text nodes
return this.nodeType === 3 && this.nodeValue.match(/<!--/);
//and hide them
}).wrap('<p class="is-hidden"></p>');

// this is probably really slow, but it's the safest way to not hide user data
issueDesc
.find('p:last-of-type em:contains(From webcompat.com)')
.parent()
.addClass('is-hidden');

this.QrView.setElement('.wc-QrCode').render();
return this;
}
Expand Down