render longpost

This commit is contained in:
Morgan McMillian 2020-12-22 14:55:05 -08:00
parent ac39977be7
commit 112df2abe2
2 changed files with 17 additions and 6 deletions

View file

@ -14,10 +14,10 @@ A nut obsessed saber-toothed client for pnut.io
- [x] Menu (about, refresh, logout) - [x] Menu (about, refresh, logout)
- [x] Keyboard shortcuts - [x] Keyboard shortcuts
- [x] Avatars - [x] Avatars
- [x] Post actions (reply, bookmark, repost, quote, copy, delete) - [x] Post actions (reply, bookmark, repost, quote, copy)
- [ ] Loading indicator
- [ ] Load newer posts - [ ] Load newer posts
- [ ] Load older posts - [ ] Load older posts
- [ ] Loading indicator
- [ ] Render post media - [ ] Render post media
- [ ] Settings page - [ ] Settings page
- [ ] App icon and package metadata - [ ] App icon and package metadata

View file

@ -245,11 +245,11 @@ class Timeline(Gtk.Box):
if self.stream == 'unified': if self.stream == 'unified':
posts, meta = pnutpy.api.users_post_streams_unified(include_raw=1) posts, meta = pnutpy.api.users_post_streams_unified(include_raw=1)
elif self.stream == 'mentions': elif self.stream == 'mentions':
posts, meta = pnutpy.api.users_mentioned_posts('me') posts, meta = pnutpy.api.users_mentioned_posts('me', include_raw=1)
elif self.stream == 'bookmarks': elif self.stream == 'bookmarks':
posts, meta = pnutpy.api.users_bookmarked_posts('me') posts, meta = pnutpy.api.users_bookmarked_posts('me', include_raw=1)
else: else:
posts, meta = pnutpy.api.posts_streams_global() posts, meta = pnutpy.api.posts_streams_global(include_raw=1)
for item in posts: for item in posts:
if 'is_deleted' in item: if 'is_deleted' in item:
@ -358,7 +358,18 @@ class PostItem(Gtk.ListBoxRow):
if 'raw' in post: if 'raw' in post:
for raw in post.raw: for raw in post.raw:
logging.debug(raw.type) # TODO: hide this under toggle?
if raw.type == "nl.chimpnut.blog.post":
longpost = raw.value
if 'title' in longpost:
lp_title = Gtk.Label(wrap=True)
lp_title.set_markup(f"<b>{longpost.title}</b>")
self.c_box.pack_start(lp_title, False, False, 10)
lp_body = Gtk.Label(wrap=True)
lp_body.set_text(longpost.body)
self.c_box.pack_start(lp_body, False, False, 10)
# TODO: open full photo in seperate window
if raw.type == "io.pnut.core.oembed": if raw.type == "io.pnut.core.oembed":
oembed = raw.value oembed = raw.value
if oembed.type == "photo": if oembed.type == "photo":