@@ -3,21 +3,19 @@ import { and } from "@ember/object/computed";
33import { service } from "@ember/service" ;
44import discourseComputed from "discourse-common/utils/decorators" ;
55
6- export default EmberObject . extend ( {
7- topicThumbnailsService : service ( "topic-thumbnails" ) ,
6+ export default class TopicListThumbnail extends EmberObject {
7+ @ service ( "topic-thumbnails" ) topicThumbnailsService ;
88
9- shouldDisplay : and (
10- "topicThumbnailsService.shouldDisplay" ,
11- "enabledForOutlet"
12- ) ,
9+ responsiveRatios = [ 1 , 1.5 , 2 ] ;
10+
11+ @ and ( "topicThumbnailsService.shouldDisplay" , "enabledForOutlet" )
12+ shouldDisplay ;
1313
1414 // Make sure to update about.json thumbnail sizes if you change these variables
1515 @discourseComputed ( "topicThumbnailsService.displayList" )
1616 displayWidth ( displayList ) {
1717 return displayList ? settings . list_thumbnail_size : 400 ;
18- } ,
19-
20- responsiveRatios : [ 1 , 1.5 , 2 ] ,
18+ }
2119
2220 @discourseComputed (
2321 "location" ,
@@ -50,12 +48,12 @@ export default EmberObject.extend({
5048 return true ;
5149 }
5250 return false ;
53- } ,
51+ }
5452
5553 @discourseComputed ( "topic.thumbnails" )
5654 hasThumbnail ( thumbnails ) {
5755 return ! ! thumbnails ;
58- } ,
56+ }
5957
6058 @discourseComputed ( "topic.thumbnails" , "displayWidth" )
6159 srcSet ( thumbnails , displayWidth ) {
@@ -74,25 +72,27 @@ export default EmberObject.extend({
7472 }
7573
7674 return srcSetArray . join ( "," ) ;
77- } ,
75+ }
7876
7977 @discourseComputed ( "topic.thumbnails" )
8078 original ( thumbnails ) {
8179 return thumbnails [ 0 ] ;
82- } ,
80+ }
8381
8482 @discourseComputed ( "original" )
8583 width ( original ) {
8684 return original . width ;
87- } ,
85+ }
86+
8887 @discourseComputed ( "original" )
8988 isLandscape ( original ) {
9089 return original . width >= original . height ;
91- } ,
90+ }
91+
9292 @discourseComputed ( "original" )
9393 height ( original ) {
9494 return original . height ;
95- } ,
95+ }
9696
9797 @discourseComputed ( "topic.thumbnails" )
9898 fallbackSrc ( thumbnails ) {
@@ -108,12 +108,12 @@ export default EmberObject.extend({
108108 }
109109
110110 return this . original . url ;
111- } ,
111+ }
112112
113113 @discourseComputed ( "topic" )
114114 url ( topic ) {
115115 return topic . linked_post_number
116116 ? topic . urlForPostNumber ( topic . linked_post_number )
117117 : topic . get ( "lastUnreadUrl" ) ;
118- } ,
119- } ) ;
118+ }
119+ }
0 commit comments