Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pinned posts do not appear in the collection's post list #824

Open
algernon opened this issue Nov 8, 2023 · 2 comments
Open

Pinned posts do not appear in the collection's post list #824

algernon opened this issue Nov 8, 2023 · 2 comments

Comments

@algernon
Copy link

algernon commented Nov 8, 2023

Describe the bug

When a post is pinned to a collection, it does not appear in the collection's post list.

Steps to reproduce (if necessary)

Steps to reproduce the behavior:

  1. Create a new post.
  2. Pin it to a collection.
  3. Hit the /api/collections/{collection}/posts endpoint.
  4. Observe that the pinned posts is not included in .data.posts.

Expected behavior

Ideally, pinned posts would either be included in the listing by default, or a "pinned=true" query parameter or similar would let me ask WriteFreely to include them.

If this line in the source had its last argument as true instead of false, that'd solve my immediate problem.

Application configuration

Version or last commit: 3e7d236

@thebaer
Copy link
Member

thebaer commented Dec 19, 2023

Thanks for reporting this. Can you share a bit more about your use case, so I can understand why you might want pinned posts at that endpoint? Right now, it's designed to only provide a feed of posts.

@algernon
Copy link
Author

My use case was that I wanted to have a WriteFreely blog where the content is externally managed: as in, have a directory full of markdown files, which a script would sync to my WriteFreely instance, add them to the relevant collections, pin them if necessary, and so on. Part of this sync was deleting obsolete posts. I originally wanted to implement this by listing posts in the main collection (I only used one), but ran into this problem, that pinned posts weren't listed there, so I couldn't delete obsolete ones (I did not wish to keep track of post IDs already posted: everything that's not in the source repo should be considered obsolete, and to be deleted).

I eventually switched to /api/me/posts, which did list the pinned ones too, and worked in my case (I had a single user, with a single collection). It would have been a lot more annoying if I had multiple users - still doable, but more annoying.

This particular case would be nicely supported if /api/collections/{collection}/posts would take a pinned=true query parameter, because then the use case would work for collections that have posts from multiple users, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants