on 404, only redirect to front page if this is a user stream

This commit is contained in:
Hannes Mannerheim 2014-11-27 13:20:00 +01:00
parent 76ea483a2a
commit 62a0357577
2 changed files with 6 additions and 3 deletions

View File

@ -717,7 +717,7 @@ class QvitterAction extends ApiAction
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lib/load-image.min.js"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/dom-functions.js?v=42"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/misc-functions.js?v=41"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/ajax-functions.js?v=40"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/ajax-functions.js?v=41"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/lan.js?v=41"></script>
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/qvitter.js?v=43"></script>
</body>

View File

@ -93,11 +93,14 @@ function getFromAPI(stream, actionOnSuccess) {
type: "GET",
dataType: 'json',
statusCode: {
400:function() {
401:function() {
location.reload(); // we may have been logged out in another tab, reload page
},
404:function() {
window.location.replace(window.siteInstanceURL); // redirect to frontpage, probably when trying to access non-existing users
// redirect to frontpage when trying to access non-existing users
if(stream.indexOf('statuses/user_timeline.json?screen_name=') > -1) {
window.location.replace(window.siteInstanceURL);
}
}
},
success: function(data) {