mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
debugging
This commit is contained in:
parent
33356b94d1
commit
42887d41c4
1 changed files with 11 additions and 1 deletions
|
@ -145,15 +145,22 @@
|
||||||
|
|
||||||
var stories = {}, pingPong = false;
|
var stories = {}, pingPong = false;
|
||||||
var DEBUG = true; //fixme
|
var DEBUG = true; //fixme
|
||||||
|
function debug() {
|
||||||
|
if (!DEBUG) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
print([].map.call(arguments, JSON.stringify));
|
||||||
|
}
|
||||||
|
|
||||||
function expire(id) {
|
function expire(id) {
|
||||||
request({
|
request({
|
||||||
uri: location.metaverseServerUrl + '/api/v1/user_stories/' + id,
|
uri: location.metaverseServerUrl + '/api/v1/user_stories/' + id,
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body: {expired: true}
|
body: {expired: true}
|
||||||
}, function (error, response) {
|
}, function (error, response) {
|
||||||
|
debug('expired story', id, 'error:', error, 'response:', response);
|
||||||
if (error || (response.status !== 'success')) {
|
if (error || (response.status !== 'success')) {
|
||||||
print("ERROR expiring story: ", error || response.status);
|
print("ERROR expiring story: ", error || response.status);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -170,9 +177,11 @@
|
||||||
'per_page=' + count
|
'per_page=' + count
|
||||||
];
|
];
|
||||||
var url = location.metaverseServerUrl + '/api/v1/user_stories?' + options.join('&');
|
var url = location.metaverseServerUrl + '/api/v1/user_stories?' + options.join('&');
|
||||||
|
url = 'https://highfidelity.com/api/v1/user_stories?include_actions=announcement'; //fixme remove
|
||||||
request({
|
request({
|
||||||
uri: url
|
uri: url
|
||||||
}, function (error, data) {
|
}, function (error, data) {
|
||||||
|
debug(url, error, data);
|
||||||
if (error || (data.status !== 'success')) {
|
if (error || (data.status !== 'success')) {
|
||||||
print("Error: unable to get", url, error || data.status);
|
print("Error: unable to get", url, error || data.status);
|
||||||
return;
|
return;
|
||||||
|
@ -181,6 +190,7 @@
|
||||||
pingPong = !pingPong;
|
pingPong = !pingPong;
|
||||||
data.user_stories.forEach(function (story) {
|
data.user_stories.forEach(function (story) {
|
||||||
var stored = stories[story.id], storedOrNew = stored || story;
|
var stored = stories[story.id], storedOrNew = stored || story;
|
||||||
|
debug('story exists:', !!stored, storedOrNew);
|
||||||
if ((storedOrNew.username === Account.username) && (storyOrNew.place_name !== location.placename)) {
|
if ((storedOrNew.username === Account.username) && (storyOrNew.place_name !== location.placename)) {
|
||||||
expire(story.id);
|
expire(story.id);
|
||||||
return; // before marking
|
return; // before marking
|
||||||
|
|
Loading…
Reference in a new issue