This repository has been archived by the owner on Feb 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from OkunaOrg/feature/missing-actions
Feature/post-comment-actions
- Loading branch information
Showing
15 changed files
with
357 additions
and
20 deletions.
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
components/actions/post-comment-more-actions/OkPostCommentMoreActions.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<template> | ||
<div class="ok-has-background-primary is-semi-rounded"> | ||
<div | ||
class="box ok-has-background-primary-highlight is-paddingless"> | ||
<ok-delete-post-comment-tile :post="post" :post-comment="postComment" @onPostCommentDeleted="onPostCommentDeleted" v-if="canDeletePostComment"></ok-delete-post-comment-tile> | ||
<ok-report-post-comment-tile :post="post" :post-comment="postComment" :on-post-comment-reported="onPostCommentReported"></ok-report-post-comment-tile> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
|
||
<script lang="ts"> | ||
import { Component, Prop, Vue } from "nuxt-property-decorator" | ||
import { IPost } from "~/models/posts/post/IPost"; | ||
import { BehaviorSubject } from "~/node_modules/rxjs"; | ||
import { IUser } from "~/models/auth/user/IUser"; | ||
import { TYPES } from "~/services/inversify-types"; | ||
import { IUserService } from "~/services/user/IUserService"; | ||
import { okunaContainer } from "~/services/inversify"; | ||
import { IPostComment } from '~/models/posts/post-comment/IPostComment'; | ||
import OkDeletePostCommentTile from '~/components/tiles/action/OkDeletePostCommentTile.vue'; | ||
import OkReportPostCommentTile from '~/components/tiles/action/OkReportPostCommentTile.vue'; | ||
@Component({ | ||
name: "OkPostCommentMoreActions", | ||
components: { | ||
OkReportPostCommentTile, | ||
OkDeletePostCommentTile | ||
}, | ||
subscriptions: function () { | ||
return { | ||
loggedInUser: this["userService"].loggedInUser | ||
} | ||
} | ||
}) | ||
export default class OkPostCommentMoreActions extends Vue { | ||
@Prop({ | ||
type: Object, | ||
required: false | ||
}) readonly post: IPost; | ||
@Prop({ | ||
type: Object, | ||
required: false | ||
}) readonly postComment: IPostComment; | ||
@Prop({ | ||
type: Function, | ||
required: false | ||
}) readonly onPostCommentReported: (postComment: IPostComment, post: IPost) => void; | ||
$observables!: { | ||
loggedInUser: BehaviorSubject<IUser | undefined> | ||
}; | ||
private userService: IUserService = okunaContainer.get<IUserService>(TYPES.UserService); | ||
onPostCommentDeleted(postComment: IPostComment, post: IPost) { | ||
this.$emit("onPostCommentDeleted", postComment, post); | ||
} | ||
get canDeletePostComment() { | ||
return this.$observables.loggedInUser.value.canDeletePostComment(this.postComment, this.post); | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.