Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
can share self posts directly from post object
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhetadelta committed Aug 14, 2024
1 parent 7ec52d8 commit d457b11
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cohost/models/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@ def edit(self, headline: str, blocks: list = [], cws: list = [],
adult=adult,
draft=draft
)

def share(self, headline: str, blocks: list = [], cws: list = [],
tags: list = [], adult: bool = False, draft=False):
from cohost.models.project import EditableProject
if not isinstance(self.project, EditableProject):
raise AttributeError("Post isn't attached to an EditableProject -\
do you have Post permissions for this project?")
return self.project.post(
headline=headline,
blocks=blocks,
cws=cws,
tags=tags,
adult=adult,
draft=draft,
shareOfPostId=self.postId
)

@property
def postId(self):
Expand Down

0 comments on commit d457b11

Please sign in to comment.