Last active
August 29, 2015 13:56
-
-
Save barisusakli/8994811 to your computer and use it in GitHub Desktop.
Change absolute user image urls to relative
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.getSortedSetRange('users:joindate', 0, -1, function(err, uids) { | |
function updateUploadedPicture(uid, next) { | |
User.getUserFields(uid, ['picture', 'uploadedpicture'], function(err, userData) { | |
var newPicture = userData.uploadedPicture.replace('http://coinunity.sk', ''); | |
if(userData.uploadedPicture === userData.picture) { | |
User.setUserField(uid, 'picture', newPicture); | |
} | |
User.setUserField(uid, 'uploadedPicture', newPicture, next); | |
}); | |
} | |
async.each(uids, updateUploadedPicture, next); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment