Skip to content

Commit 37d2f16

Browse files
committed
使用七牛 gravatar.qiniudn.com 镜像
1 parent c61fca5 commit 37d2f16

3 files changed

Lines changed: 29 additions & 9 deletions

File tree

models/user.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ var UserSchema = new Schema({
3737
});
3838

3939
UserSchema.virtual('avatar_url').get(function () {
40-
return this.profile_image_url || this.avatar || config.site_static_host + '/public/images/user_icon&48.png';
40+
var url = this.profile_image_url || this.avatar || config.site_static_host + '/public/images/user_icon&48.png';
41+
return url.replace('http://www.gravatar.com/', 'http://gravatar.qiniudn.com/');
4142
});
4243

4344
mongoose.model('User', UserSchema);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"private": true,
66
"customHost": ["cnodejs.org", "club.cnodejs.org"],
77
"dependencies": {
8-
"express": "2.5.1",
8+
"express": "2.5.11",
99
"ejs": "0.8.4",
1010
"eventproxy": "0.2.5",
1111
"mongoose": "2.7.3",

test/controllers/topic.js

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1+
/*!
2+
* nodeclub - test/controllers/topic.js
3+
* Copyright(c) 2013 fengmk2 <fengmk2@gmail.com>
4+
* MIT Licensed
5+
*/
6+
7+
"use strict";
8+
9+
/**
10+
* Module dependencies.
11+
*/
12+
113
var should = require('should');
14+
var request = require('supertest');
215
var app = require('../../app');
316

417
describe('controllers/topic.js', function () {
@@ -10,14 +23,20 @@ describe('controllers/topic.js', function () {
1023
app.close();
1124
});
1225

13-
describe('index', function () {
26+
describe('/topic', function () {
1427
it('should ok', function (done) {
15-
app.request().get('/topic/inexist').end(function (res) {
16-
res.should.status(200);
17-
var body = res.body.toString();
18-
body.should.include('此话题不存在或已被删除。');
19-
done();
20-
});
28+
request(app)
29+
.get('/topic/inexist')
30+
.expect(200)
31+
.expect(//, done);
32+
});
33+
});
34+
35+
describe('/user/$name/replies', function () {
36+
it('should GET /user/lzghades/replies?page=1 %27%27%29%29%28%27%27%29%27%28 status 200', function (done) {
37+
request(app)
38+
.get('/user/lzghades/replies?page=1 %27%27%29%29%28%27%27%29%27%28 ')
39+
.expect(200, done);
2140
});
2241
});
2342
});

0 commit comments

Comments
 (0)