Skip to content

Node.js based forum software built for the modern web

removed graph/picture, closes #72

Baris Soner Usakli62ef925fd3b2
diff --git a/public/src/modules/composer.js b/public/src/modules/composer.js
index 52e192a843..7ee61144f7 100644
--- a/public/src/modules/composer.js
+++ b/public/src/modules/composer.js
@@ -39,7 +39,7 @@ define(['taskbar'], function(taskbar) {
composer.taskbar.push('composer', uuid, {
title: (!threadData.cid ? (threadData.title || '') : 'New Topic'),
- icon: '/graph/users/' + threadData.username + '/picture'
+ icon: threadData.picture
});
composer.posts[uuid] = {
diff --git a/public/templates/category.tpl b/public/templates/category.tpl
index 3b192e00c2..e565e06735 100644
--- a/public/templates/category.tpl
+++ b/public/templates/category.tpl
@@ -29,7 +29,7 @@
<div class="span12 topic-row img-polaroid">
<div class="latest-post visible-desktop">
<div class="pull-right">
- <img style="width: 48px; height: 48px; /*temporary*/" src="../../graph/users/{topics.teaser_username}/picture" />
+ <img style="width: 48px; height: 48px; /*temporary*/" src="{topics.teaser_userpicture}" />
<p><strong>{topics.teaser_username}</strong>: {topics.teaser_text}</p>
<span>posted {topics.teaser_timestamp} ago</span>
</div>
@@ -73,7 +73,7 @@
</div>
<div class="block-content">
<!-- BEGIN active_users -->
- <a href="/users/{active_users.userslug}"><img title="{active_users.username}" src="../../graph/users/{active_users.username}/picture" class="img-polaroid" /></a>
+ <a href="/users/{active_users.userslug}"><img title="{active_users.username}" src="{active_users.picture}" class="img-polaroid" /></a>
<!-- END active_users -->
</div>
</div>
@@ -83,7 +83,7 @@
</div>
<div class="block-content">
<!-- BEGIN moderators -->
- <a href="/users/{moderators.userslug}"><img title="{moderators.username}" src="../../graph/users/{active_users.username}/picture" class="img-polaroid" /></a>
+ <a href="/users/{moderators.userslug}"><img title="{moderators.username}" src="{moderators.picture}" class="img-polaroid" /></a>
<!-- END moderators -->
</div>
</div>
diff --git a/public/templates/recent.tpl b/public/templates/recent.tpl
index aa4bb57255..2b3416a9dd 100644
--- a/public/templates/recent.tpl
+++ b/public/templates/recent.tpl
@@ -27,7 +27,7 @@
<div class="span12 topic-row img-polaroid">
<div class="latest-post visible-desktop">
<div class="pull-right">
- <img style="width: 48px; height: 48px; /*temporary*/" src="graph/users/{topics.teaser_username}/picture" />
+ <img style="width: 48px; height: 48px; /*temporary*/" src="{topics.teaser_userpicture}" />
<p><strong>{topics.teaser_username}</strong>: {topics.teaser_text}</p>
<span>posted {topics.teaser_timestamp} ago</span>
</div>
diff --git a/src/categories.js b/src/categories.js
index 1d2575bfe1..a1b3dd30a7 100644
--- a/src/categories.js
+++ b/src/categories.js
@@ -58,7 +58,7 @@ var RDB = require('./redis.js'),
}
function getActiveUsers(next) {
- user.getMultipleUserFields(active_users, ['username', 'userslug'], function(users) {
+ user.getMultipleUserFields(active_users, ['username', 'userslug', 'picture'], function(users) {
next(null, users);
});
}
@@ -180,6 +180,7 @@ var RDB = require('./redis.js'),
topicData.badgeclass = (topicInfo.hasread && current_user != 0) ? '' : 'badge-important';
topicData.teaser_text = topicInfo.teaserInfo.text,
topicData.teaser_username = topicInfo.teaserInfo.username;
+ topicData.teaser_userpicture = topicInfo.teaserInfo.picture;
topicData.teaser_timestamp = utils.relativeTime(topicInfo.teaserInfo.timestamp);
if (isTopicVisible(topicData, topicInfo))
diff --git a/src/topics.js b/src/topics.js
index 6235c1df52..f4a88349ca 100644
--- a/src/topics.js
+++ b/src/topics.js
@@ -305,7 +305,7 @@ marked.setOptions({
posts.getPostFields(pid, ['content', 'uid', 'timestamp'], function(postData) {
- user.getUserField(postData.uid, 'username', function(username) {
+ user.getUserFields(postData.uid, ['username', 'picture'], function(userData) {
var stripped = postData.content,
timestamp = postData.timestamp;
@@ -314,7 +314,8 @@ marked.setOptions({
callback({
"text": stripped,
- "username": username,
+ "username": userData.username,
+ "picture": userData.picture,
"timestamp" : timestamp
});
});
diff --git a/src/webserver.js b/src/webserver.js
index ab8a71bf2f..c9b3a34c38 100644
--- a/src/webserver.js
+++ b/src/webserver.js
@@ -258,27 +258,6 @@ var express = require('express'),
});
});
-
- //START TODO: MOVE TO GRAPH.JS
-
- app.get('/graph/users/:username/picture', function(req, res) {
- user.get_uid_by_username(req.params.username, function(uid) {
- if (uid == null) {
- res.json({
- status: 0
- });
- return;
- }
- user.getUserField(uid, 'picture', function(picture) {
- if (picture == null) res.redirect('http://www.gravatar.com/avatar/a938b82215dfc96c4cabeb6906e5f953&default=identicon');
- res.redirect(picture);
- });
- });
-
- });
-
- //END TODO: MOVE TO GRAPH.JS
-
app.get('/test', function(req, res) {
console.log('derp');
@@ -381,6 +360,7 @@ var express = require('express'),
break;
case 'category' :
categories.getCategoryById(req.params.id, uid, function(data) {
+ console.log(data);
res.json(data);
}, req.params.id, uid);
break;
diff --git a/src/websockets.js b/src/websockets.js
index e663d7cca6..6f9cb127b5 100644
--- a/src/websockets.js
+++ b/src/websockets.js
@@ -417,11 +417,12 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }),
});
});
} else if (parseInt(data.cid) > 0) {
- user.getUserField(uid, 'username', function(username) {
+ user.getUserFields(uid, ['username', 'picture'], function(userData) {
socket.emit('api:composer.push', {
tid: 0,
cid: data.cid,
- username: username,
+ username: userData.username,
+ picture: userData.picture,
title: undefined
});
});