File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
framework/core/js/src/forum/components Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -17,16 +17,28 @@ export default class PostPreview extends Component {
17
17
view ( ) {
18
18
const post = this . attrs . post ;
19
19
const user = post . user ( ) ;
20
- const content = post . contentType ( ) === 'comment' && post . contentPlain ( ) ;
21
- const excerpt = content ? highlight ( content , this . attrs . highlight , 300 ) : '' ;
22
20
23
21
return (
24
22
< Link className = "PostPreview" href = { app . route . post ( post ) } onclick = { this . attrs . onclick } >
25
23
< span className = "PostPreview-content" >
26
24
{ avatar ( user ) }
27
- { username ( user ) } < span className = "PostPreview-excerpt" > { excerpt } </ span >
25
+ { username ( user ) } < span className = "PostPreview-excerpt" > { this . excerpt ( ) } </ span >
28
26
</ span >
29
27
</ Link >
30
28
) ;
31
29
}
30
+
31
+ /**
32
+ * @returns {string|undefined|null }
33
+ */
34
+ content ( ) {
35
+ return this . attrs . post . contentType ( ) === 'comment' && this . attrs . post . contentPlain ( ) ;
36
+ }
37
+
38
+ /**
39
+ * @returns {string }
40
+ */
41
+ excerpt ( ) {
42
+ return this . content ( ) ? highlight ( this . content ( ) , this . attrs . highlight , 300 ) : '' ;
43
+ }
32
44
}
You can’t perform that action at this time.
0 commit comments