Page MenuHomeMusing Studio

Fetch user posts if authenticated
Closed, ResolvedPublic

Description

Moved from writeas-cli#13

Overview
Users should be able to see a list of anonymous posts owned by their account.

Background
Since account posts aren't stored locally, users will need to be able to fetch a list of posts on their account, so they can access the IDs of published posts to update or delete them with the CLI.

Dependencies
User authentication (T191).

TODO: Add a method to the go-writeas library to retrieve an authenticated user's posts. (issue: writeas/go-writeas#5)

Implementation

  • When running writeas list, show these remote posts if a user is authenticated

The posts list should also be a little more useful by including post title / content, potentially behind a new CLI flag. Some ideas:

bxp4el2zng8h9    A Post Title
uy9f77u0v7o7d    This is the starting text of my post, truncated somewhere...

We could potentially include unsynced posts in the list, like on the web.

bxp4el2zng8h9    A Post Title
uy9f77u0v7o7d    This is the starting text of my post, truncated somewhere...
UNSYNCED
13nbyi9j3hu1z    Older Post

Event Timeline

matt triaged this task as High priority.May 29 2019, 3:26 PM
matt created this task.

@robjloranger We should leverage the changes made by abhinav in PR #19 to implement this. Most of the work will probably be in moving things around to fit our new structure where everything is broken up.

I totally missed this comment, I've got it all done. Except nice formatting and concatenating the content.

Do you want me to help get that merged instead?

I was also going to add a flag like detail, d to include more output like the excerpt and collection.

so the current implementation I have gets the local posts and then the remote.

what about a prefix, like L/R or full local/remote

local   bxp4el2zng8h9    A Post Title
remote  uy9f77u0v7o7d    Another post title

I think I like the full local / remote word for now; it's clear and saves me from looking up what letters mean in the user guide.

Nice! That's great.

And this works when unauthenticated as well?

created a mock for the detailed output which i think would be good behind the flag d, detail M5

@matt by unsynced posts, do you mean unclaimed? i.e. https://developers.write.as/docs/api/#claim-posts

Yep, that's correct.

https://github.com/writeas/writeas-cli/pull/29

i think local posts are the unclaimed posts for the user at the cli. it that correct?

I'm not sure how to claim a post written anonymously from the web.

We can reopen if needed, I didn't think the commit could close this until we merged in master ๐Ÿ˜Š

current status as or PR, also supports -md

pinged the wrong matt on the PR for this. Also should be open until that is merged.

As for terminology, I would say we should have "synced" vs "unsynced" for our release, just so we don't confuse people. Maybe the title then is "Status" instead of "Location"

what about using unclaimed for the local unsynced posts in this list?

A more verbose example of what I mean:

if using unclaimed works, how does this help sound?

last one, I promise. next time I'll use the mocks.

I like this one because it makes it clear which posts are not attached to an account and some account posts can still be anonymous, or unsynced.

The 2.0 release felt incomplete without this, so I re-added it, just in simpler form.