Forum Academy Marketplace Showcase Pricing Features

Sorting Social Wall by Date

I am trying to create a Facebook style timeline, but I’m running into an issue sorting the repeating group of posts according to when each post is posted / reposted. As of current I am sorting the timeline based on each post’s creation date, but that won’t work since a newly shared post may display in the middle of the timeline.

Each post has a “shared by” field with a list of users. However, I’m stuck because I can’t create a “shared date” field since this date will be different for multiple users.

I would prefer not to create a new post every time the share button is clicked (like the microblogging app), since each post has a comment thread below it.

Any suggestions?

Thanks in advance.

Since each sharer will have a different date, it’s essentially another post. What you can do is keep a reference to the initial post on the “shared” post so you can still access the comment thread.

Then again, I haven’t looked into how something like this is typically implemented; so there could be better options I’m not aware of. I’m also interested in knowing what’s the best way to go about this.

try…

  • create a new object/thing, say ‘post-share’, with two fields [post, user]
  • add a list of post-shares as a field to the post object (instead of list of users)
  • each time a post is shared, add a post-share to the list
  • display timeline of posts as unique elements retrieved from post-shares, sorting by creation date of post-shares
  • you can do much more with this architecture e.g. display list of post-shares below each below

hope that makes sense as a possible base to build from.

@wahome thanks for the suggestion. This seems to work, except now my database is so cluttered it doesn’t make any sense… i.e. (when current user’s post-share contains current cell’s post-share’s post delete current user’s post-share). It begins to get nonsensical.

It is a better architecture, if you can understand what’s going on, that is.

If a user follows 100 other users who each decide to share a given post, how do I stop that user from having to scroll through 100 identical posts? :unique elements won’t work since each post-share is technically unique.

If you save the original post as a reference in reposts as suggested above, you can always check against that field to make sure the feed only contains it once. It’s not trivial but doable.

Sounds reasonable. I assume I need to use Filter: Advanced. Mind explaining this a bit more?

Since Bubble’s language is mostly declarative, let’s try another approach to your problem:
Describe what you would like the feed to look like before a share, after one re-post, and then after several re-posts.
As you do, you’ll notice you have to be very specific about what is being displayed. Clearly stating your goal in detail will make it easy to implement it, if possible (some things might not be achievable).

Here are some examples:
When no post was re-posted, the user should see a list of all posts created by their friends, in descending order by time.

When a post was re-posted, the user should see said post once in the list, with all the friends’ names show re-posted in shown below (names are shown in descending order of re-posting date). Within the list, the post that was re-posted several times should be sorted according to the last repost date.
When the user clicks the post, they should be taken to the original (perhaps the latest repost instead?) and their comments should be added to this original post (or the latest, as your design requires).

Depending on your situation, you might have to be even more detailed than I was above.

Describing your design intent this way should make it relatively easy to implement in Bubble, or will indicate features we need to add to the language to allow it :smile:

2 Likes

Thank you for the further explanation.

@wahome suggested sorting by creation date of repost. This is easily done if I’m only searching for one repeating group of reposts.

However, once I merge one search with another, sorting by creation date references the post’s creation date. What am I doing wrong here?

@georgeciobanu

When structuring this wall to show posts by referencing them through reposts the timeline load time takes 5-20 seconds.

Type of content is “Post”
My data source is Search for repost’s post merged with another search for repost’s post: unique elements sorted by creation date.

I assume this data source is proper, so how do I speed up load times? If I change to a simple “search for posts created by current page user” then they load faster, but the functionality I need is gone.

What do you suggest?

I think you might be better looking for posts (which are unique) and then finding the latest date from a list of embedded reposts.

Can I not embed a repeating group (comments) within a repeating group (posts)? When I try, infinite scroll doesn’t work. If I delete the comments, it does.

edit: Its actually not the repeating group that messes up infinite scrolling. The repeating group is inside a group that is collapsed when hidden. Uncheck that box and infinite scrolling on the main posts works again. Is this a bug?

How were you able to get the posts reposted in the repeating group? @csblack