Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • PostsFederationService
    • PostsService

Index

Constructors

constructor

  • Returns PostsService

Methods

adminDelete

  • adminDelete(username: string, postId: string): Promise<boolean>
  • Allows an admin to delete a post. Also removes the reference to the post. for the author if they are a local user.

    internal

    Parameters

    • username: string

      Username of user deleting post.

    • postId: string

      The ID of the post.

    Returns Promise<boolean>

    True on success.

approve

  • approve(username: string, postId: string): Promise<boolean>

create

  • create(username: string, host: string, post: CreatePostProps): Promise<Post>
  • Creates a post at a specified host.

    internal

    Parameters

    • username: string

      Local user making the post.

    • host: string

      The host server the post is made on.

    • post: CreatePostProps

      The post being made.

    Returns Promise<Post>

    The created post.

delete

  • delete(username: string, host: string, id: string): Promise<void>
  • Deletes a post at a specified host.

    internal

    Parameters

    • username: string

      User deleting the post.

    • host: string

      The host server the post is on.

    • id: string

      The id of the post on the federated network.

    Returns Promise<void>

getByCommunity

  • getByCommunity(username: string, host: string, community: string): Promise<Post[]>
  • Gets all the posts in a community.

    Parameters

    • username: string

      The username of the user getting the post.

    • host: string

      The host from which to get the posts.

    • community: string

      ID of the community to obtain the posts from.

    Returns Promise<Post[]>

    All posts in the community.

getById

  • getById(username: string, host: string, id: string): Promise<Post>
  • Gets a post by its ID.

    Parameters

    • username: string

      The username of the user getting the post.

    • host: string

      The host from which to get the post.

    • id: string

      The ID of the post to get.

    Returns Promise<Post>

    The obtained Post.

getUnfilteredPosts

  • getUnfilteredPosts(community: string): Promise<Post[]>
  • Fetches the unfiltered version of the posts for community admins. Unfiltered posts won't hide the contents of their title and body.

    internal

    Parameters

    • community: string

      The community to fetch posts from.

    Returns Promise<Post[]>

    Unfiltered posts.

isAdmin

  • isAdmin(username: string, post: null | Post): Promise<boolean>
  • Checks if the username belongs to an admin of the community the post was created on.

    internal

    Parameters

    • username: string

      User to check.

    • post: null | Post

      Post to check.

    Returns Promise<boolean>

    True if the user is an admin of the post's community.

report

  • report(id: string): Promise<boolean>

update

  • update(username: string, host: string, post: UpdatePostProps): Promise<Post>
  • Updates a post by its ID.

    Parameters

    • username: string

      The username of the user deleting the post.

    • host: string

      The host on which to update the post.

    • post: UpdatePostProps

    Returns Promise<Post>

    The updated Post.

Generated using TypeDoc