busy icon indicating copy to clipboard operation
busy copied to clipboard

Pin / unpin a post on your profile

Open bonustrack opened this issue 7 years ago • 3 comments

This is a feature we can implement with the database @Sekhmet is working on. We must use custom_json for it.

We can imagine having these custom_json operations possible:

["pinPost", {
  "permlink": <permlink>,
}]
["unPinPost", {
  "permlink": <permlink>,
}]

A bit similar than what was spec for communities feature here: https://github.com/steemit/hivemind/blob/master/docs/communities.md#pinunpin-a-post

We would then store pinned post into a table "pins" and display 1 pin on top of the user blog. (Facebook limit to 1 pin also)

Should we allow user A to pin a post from user B?

bonustrack avatar May 25 '18 07:05 bonustrack

I could be missing the full picture but using a customjson transaction for pin/unpin operations may be an overkill.

Every account has a json_metadata attached, why don't you use it for storing pinned posts? Since there is always one pinned post, storing it at here makes sense.

Pinning a post

Add a pinned_post: <permlink> to account's JSON metadata.

https://steemd.com/tx/a04cb8a4d2f1ca9f978f1612c1be300957bed9b8

Unpin

(Just remove the pinned_post key.)

https://steemd.com/tx/e4e72f84ddc74e5618f7b137d418239640a19f32

I favor this instead of CustomJSONs because it doesn't need any off-chain indexer or any additional call to a database.


For reference, I have used this script to create these transactions:

from steem import Steem
from steem.account import Account

s = Steem(keys=["active_key"])
account_metadata = Account('emrebeyler', steemd_instance=s)["json_metadata"]
account_metadata["profile"]["pinned_post"] = "emrebeyler/hotdog-a-custom-json-indexer-to-the-mongodb"

s.update_account_profile(account_metadata, account="emrebeyler")

emre avatar May 25 '18 10:05 emre

@emre we are building a database where we will store custom_json operation so we can query them. I prefer that we use custom_json because it doesn't require for the user to type his active key every time, pin a post would be as easy as voting for a post.

bonustrack avatar May 25 '18 10:05 bonustrack

I prefer that we use custom_json because it doesn't require for the user to type his active key every time, pin a post would be as easy as voting for a post.

Ah I see, if the database is already there/or planned, having this functionality at the posting key level makes sense.

emre avatar May 25 '18 10:05 emre