File tree Expand file tree Collapse file tree 3 files changed +4
-17
lines changed
Expand file tree Collapse file tree 3 files changed +4
-17
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ module.exports = app => {
44 const mongoose = app . mongoose ;
55 const Schema = mongoose . Schema ;
66 const ObjectId = Schema . ObjectId ;
7- const config = app . config ;
87
98 const TopicSchema = new Schema ( {
109 title : { type : String } ,
@@ -29,17 +28,5 @@ module.exports = app => {
2928 TopicSchema . index ( { top : - 1 , last_reply_at : - 1 } ) ;
3029 TopicSchema . index ( { author_id : 1 , create_at : - 1 } ) ;
3130
32- TopicSchema . virtual ( 'tabName' ) . get ( function ( ) {
33- const tab = this . tab ;
34- const pair = config . tabs . find ( function ( _pair ) {
35- return _pair [ 0 ] === tab ;
36- } ) ;
37-
38- if ( pair ) {
39- return pair [ 1 ] ;
40- }
41- return '' ;
42- } ) ;
43-
4431 return mongoose . model ( 'Topic' , TopicSchema ) ;
4532} ;
Original file line number Diff line number Diff line change 22< span class ='put_top '> 置顶</ span >
33< % } else if (topic.good) { %>
44< span class ='put_good '> 精华</ span >
5- < % } else if (typeof tab !== 'undefined' && tab === 'all' && topic .tabName) { %>
6- < span class ="topiclist-tab "> < %= topic .tabName %> </ span >
5+ < % } else if (typeof tab !== 'undefined' && tab === 'all' && helper .tabName(topic.tab) ) { %>
6+ < span class ="topiclist-tab "> < %= helper .tabName(topic.tab) %> </ span >
77< % } %>
Original file line number Diff line number Diff line change 6262 < span >
6363 < %= topic.visit_count %> 次浏览
6464 </ span >
65- < % if (topic.create_at != topic.update_at) { %>
65+ < % if (topic.create_at.toString() !== topic.update_at.toString() ) { %>
6666 < span >
6767 最后一次编辑是 < %= helper.ago(topic.update_at) %>
6868 </ span >
6969 < % } %>
7070 < % if (topic.tab) { %>
71- < span > 来自 < %= topic .tabName %> </ span >
71+ < span > 来自 < %= helper .tabName(topic.tab) %> </ span >
7272 < %}%>
7373
7474 < % if (current_user) { %>
You can’t perform that action at this time.
0 commit comments