7bf5fab1fa2fa07cc012c0570781aea23343ae05 | bcca862eaaeeb4e5a739a9107f8ae073ef6a37b3 | ||
---|---|---|---|
45 | reported = 0, num_comments = 0, | 45 | reported = 0, num_comments = 0, |
46 | moderator_banned = False, | 46 | moderator_banned = False, |
47 | banned_before_moderator = False, | 47 | banned_before_moderator = False, |
48 | media_object = None, | ||
49 | has_thumbnail = False, | ||
48 | ip = '0.0.0.0') | 50 | ip = '0.0.0.0') |
49 | 51 | ||
50 | def __init__(self, *a, **kw): | 52 | def __init__(self, *a, **kw): |
... | ... | ||
201 | wrapped.show_spam, | 203 | wrapped.show_spam, |
202 | wrapped.show_reports, | 204 | wrapped.show_reports, |
203 | wrapped.can_ban, | 205 | wrapped.can_ban, |
206 | wrapped.thumbnail, | ||
204 | wrapped.moderator_banned)) | 207 | wrapped.moderator_banned)) |
205 | s = ''.join(s) | 208 | s = ''.join(s) |
206 | return s | 209 | return s |
... | ... | ||
216 | @classmethod | 219 | @classmethod |
217 | def add_props(cls, user, wrapped): | 220 | def add_props(cls, user, wrapped): |
218 | from r2.lib.count import incr_counts | 221 | from r2.lib.count import incr_counts |
222 | from r2.lib.media import thumbnail_url | ||
223 | |||
219 | saved = Link._saved(user, wrapped) if user else {} | 224 | saved = Link._saved(user, wrapped) if user else {} |
220 | hidden = Link._hidden(user, wrapped) if user else {} | 225 | hidden = Link._hidden(user, wrapped) if user else {} |
221 | #clicked = Link._clicked(user, wrapped) if user else {} | 226 | #clicked = Link._clicked(user, wrapped) if user else {} |
... | ... | ||
223 | 228 | ||
224 | for item in wrapped: | 229 | for item in wrapped: |
225 | 230 | ||
231 | show_media = (c.user.pref_media == 'on' or | ||
232 | (c.user.pref_media == 'subreddit' and | ||
233 | item.subreddit.show_media)) | ||
234 | |||
235 | if not show_media: | ||
236 | item.thumbnail = "" | ||
237 | elif item.has_thumbnail: | ||
238 | item.thumbnail = thumbnail_url(item) | ||
239 | else: | ||
240 | item.thumbnail = g.default_thumb | ||
241 | |||
226 | item.score = max(0, item.score) | 242 | item.score = max(0, item.score) |
227 | 243 | ||
228 | item.domain = (domain(item.url) if not item.is_self | 244 | item.domain = (domain(item.url) if not item.is_self |