Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 76ae690

Browse files
committed
fixed edit views working again
1 parent bfa1347 commit 76ae690

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

lib/handlers/bin.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,11 @@ module.exports = Observable.extend({
205205
next();
206206
},
207207
getBinPreview: function(req, res, next) {
208+
209+
if (features('flagged', req.bin)) {
210+
return next(410);
211+
}
212+
208213
// if we're loading a username/last(-:n)? and no 'n' is present
209214
// it breaks quiet, leaving it as undefined, here we manually
210215
// check for it and modify the req.params to reflect the url.
@@ -956,19 +961,17 @@ module.exports = Observable.extend({
956961
};
957962
return self.createRevision(req, res, next);
958963
}
959-
var hardFlag = undefsafe(result, 'metadata.flagged');
960-
var flag = features('flagged', result);
964+
var flag = undefsafe(result, 'metadata.flagged');
961965
if (flag) {
962966
var ip = req.headers['x-real-ip'] || req.ip;
963967
if (username === result.metadata.name && ip !== flag) {
964968
// log ip if hard flag
965-
if (hardFlag) {
966-
models.user.updateOwnershipData(
967-
username,
968-
{ flagged: ip, },
969-
function() {}
970-
);
971-
}
969+
models.user.updateOwnershipData(
970+
username,
971+
{ flagged: ip, },
972+
function() {}
973+
);
974+
972975
// continue to next()
973976
} else if (username !== result.metadata.name && ip !== flag) {
974977
metrics.increment('bin.404-banned-user');

views/410.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
<img id="dave" src="{{static}}/images/dave.min.svg?{{version}}" alt="Dave, the JS Bin bot">
1010
<div class="wrapper">
1111
<h1>410: This bin has gone</h1>
12-
<p>This bin has gone and there's no alternative that I'll redirect you to. It's quite possible this bin has been blocked from appearing due to abuse content, so really, I'm just doing you a&nbsp;favour.</p>
12+
<p>This bin has gone and there's no alternative that I'll redirect you to. It's quite possible this bin has been blocked from appearing either due to the owner being anonymous, or the content flagged for abuse.</p>
13+
14+
<p>In some cases you will still be able to view the <a href="{{request.url}}/edit">editable</a> content in the browser.</p>
1315
</div>
1416
</body>
1517
</html>

0 commit comments

Comments
 (0)