diff --git a/r2/r2/templates/link.html b/r2/r2/templates/link.html
index f5e292a8d..dddf10fda 100644
--- a/r2/r2/templates/link.html
+++ b/r2/r2/templates/link.html
@@ -158,7 +158,8 @@ ${parent.thing_css_class(what)} ${"over18" if thing.over_18 else ""}
<%def name="subreddit()" buffered="True">
${plain_link(thing.subreddit.name, thing.subreddit_path, sr_path = False,
- cname = False, _class = "subreddit hover")}
+ cname = False, _class = "subreddit hover",
+ target='_blank' if thing.newwindow else '')}
diff --git a/r2/r2/templates/modaction.html b/r2/r2/templates/modaction.html
index 46e132650..7ccd53f84 100755
--- a/r2/r2/templates/modaction.html
+++ b/r2/r2/templates/modaction.html
@@ -40,7 +40,8 @@
${thing.button} |
${thing.text}
%if hasattr(thing, 'target_text'):
- ${plain_link(thing.target_text, thing.target_path, title=thing.target_title, sr_path=False, cname=False, _class="subreddit hover")}
+ ${plain_link(thing.target_text, thing.target_path, title=thing.target_title, sr_path=False, cname=False, _class="subreddit hover",
+ target='_blank' if c.user.pref_newwindow else '')}
%elif hasattr(thing, 'target_wrapped_user'):
${thing.target_wrapped_user}
%endif
diff --git a/r2/r2/templates/usertext.html b/r2/r2/templates/usertext.html
index 0bf22bf3d..273be4729 100644
--- a/r2/r2/templates/usertext.html
+++ b/r2/r2/templates/usertext.html
@@ -50,7 +50,7 @@
% if not thing.expunged:
${unsafe(safemarkdown(thing.text, nofollow = thing.nofollow,
- target = thing.target))}
+ target = '_blank' if c.user.pref_newwindow else thing.target))}
% else:
${_("[removed]")}
% endif
diff --git a/r2/r2/templates/wrappeduser.html b/r2/r2/templates/wrappeduser.html
index 1d9fb5288..63ac0246a 100644
--- a/r2/r2/templates/wrappeduser.html
+++ b/r2/r2/templates/wrappeduser.html
@@ -49,7 +49,7 @@
%>
${plain_link(thing.name + thing.karma, "/user/%s" % thing.name,
_class = ' '.join(classes),
- _sr_path = False, target=target, title=thing.author_title)}
+ _sr_path = False, target='_blank' if c.user.pref_newwindow else target, title=thing.author_title)}
%if thing.flair_position == 'right':
${flair(thing, enabled=thing.force_show_flair)}
%endif
|