Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/reddit/reddit
Browse files Browse the repository at this point in the history
  • Loading branch information
Deimos committed Oct 30, 2014
2 parents 73375b0 + 51e19e0 commit bbbad36
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
6 changes: 5 additions & 1 deletion r2/r2/controllers/api.py
Expand Up @@ -1615,9 +1615,10 @@ def POST_editusertext(self, form, jquery, item, text):
return

removed_mentions = None
original_text = item.body
if isinstance(item, Comment):
kind = 'comment'
removed_mentions = set(extract_user_mentions(item.body)) - \
removed_mentions = set(extract_user_mentions(original_text)) - \
set(extract_user_mentions(text))
item.body = text
elif isinstance(item, Link):
Expand Down Expand Up @@ -1648,6 +1649,9 @@ def POST_editusertext(self, form, jquery, item, text):

amqp.add_item('usertext_edited', item._fullname)

hooks.get_hook("thing.edit").call(
thing=item, original_text=original_text)

# new mentions are subject to more constraints, handled in butler_q
if removed_mentions:
queries.unnotify(item, list(Account._names_to_ids(
Expand Down
15 changes: 11 additions & 4 deletions r2/r2/public/static/js/ui.js
Expand Up @@ -10,9 +10,7 @@ r.ui.init = function() {
}

// mobile suggest infobar
var smallScreen = window.matchMedia
? matchMedia('(max-device-width: 700px)').matches
: $(window).width() < 700,
var smallScreen = r.ui.isSmallScreen(),
onFrontPage = $.url().attr('path') == '/'
if (smallScreen && onFrontPage && r.config.renderstyle != 'compact') {
var infobar = $('<div class="infobar mellow">')
Expand All @@ -32,7 +30,9 @@ r.ui.init = function() {
$(el).data('SubredditSubmitText', new r.ui.SubredditSubmitText({el: el}))
})

if (r.config.new_window) {
/* Open links in new tabs if they have the preference set or are logged out
* and on a "large" screen. */
if (r.config.new_window && (r.config.logged || !smallScreen)) {
$(document.body).on('click', 'a.may-blank, .may-blank-within a', function() {
if (!this.target) {
this.target = '_blank'
Expand All @@ -48,6 +48,13 @@ r.ui.init = function() {
r.ui.initTimings()
}

r.ui.isSmallScreen = function() {
return window.matchMedia
// 736px is the width of the iPhone 6+.
? matchMedia('(max-device-width: 736px)').matches
: $(window).width() < 736;
}

r.ui.TimeTextScrollListener = r.ScrollUpdater.extend({
initialize: function(options) {
this.timeText = options.timeText
Expand Down

0 comments on commit bbbad36

Please sign in to comment.