mirror of
https://github.com/astuto/astuto.git
synced 2025-12-16 03:37:56 +01:00
Post follow and updates notifications V1 (#111)
* It is now possible to follow a post in order to receive updates about it * Notifications are now sent when updates are published * Post status changes are now tracked * Update sidebar now shows the post status history * Mark a comment as a post update using the comment form * ... more ...
This commit is contained in:
committed by
GitHub
parent
ce7be1b30c
commit
dad382d2b1
@@ -1,6 +1,8 @@
|
||||
import * as React from 'react';
|
||||
import Gravatar from 'react-gravatar';
|
||||
|
||||
import NewCommentUpdateSection from './NewCommentUpdateSection';
|
||||
|
||||
import Button from '../shared/Button';
|
||||
import Spinner from '../shared/Spinner';
|
||||
import { DangerText } from '../shared/CustomTexts';
|
||||
@@ -8,24 +10,34 @@ import { DangerText } from '../shared/CustomTexts';
|
||||
interface Props {
|
||||
body: string;
|
||||
parentId: number;
|
||||
postUpdateFlagValue: boolean;
|
||||
isSubmitting: boolean;
|
||||
error: string;
|
||||
handleChange(e: React.FormEvent): void;
|
||||
handleSubmit(body: string, parentId: number): void;
|
||||
handlePostUpdateFlag(): void;
|
||||
handleSubmit(
|
||||
body: string,
|
||||
parentId: number,
|
||||
isPostUpdate: boolean
|
||||
): void;
|
||||
|
||||
isLoggedIn: boolean;
|
||||
isPowerUser: boolean;
|
||||
userEmail: string;
|
||||
}
|
||||
|
||||
const NewComment = ({
|
||||
body,
|
||||
parentId,
|
||||
postUpdateFlagValue,
|
||||
isSubmitting,
|
||||
error,
|
||||
handleChange,
|
||||
handlePostUpdateFlag,
|
||||
handleSubmit,
|
||||
|
||||
isLoggedIn,
|
||||
isPowerUser,
|
||||
userEmail,
|
||||
}: Props) => (
|
||||
<React.Fragment>
|
||||
@@ -33,18 +45,29 @@ const NewComment = ({
|
||||
{
|
||||
isLoggedIn ?
|
||||
<React.Fragment>
|
||||
<Gravatar email={userEmail} size={36} className="currentUserAvatar" />
|
||||
<textarea
|
||||
value={body}
|
||||
onChange={handleChange}
|
||||
placeholder="Leave a comment"
|
||||
className="newCommentBody"
|
||||
/>
|
||||
<Button
|
||||
onClick={() => handleSubmit(body, parentId)}
|
||||
className="submitCommentButton">
|
||||
{ isSubmitting ? <Spinner color="light" /> : 'Submit' }
|
||||
</Button>
|
||||
<div className="commentBodyForm">
|
||||
<Gravatar email={userEmail} size={48} className="currentUserAvatar" />
|
||||
<textarea
|
||||
value={body}
|
||||
onChange={handleChange}
|
||||
placeholder="Leave a comment"
|
||||
className="newCommentBody"
|
||||
/>
|
||||
<Button
|
||||
onClick={() => handleSubmit(body, parentId, postUpdateFlagValue)}
|
||||
className="submitCommentButton">
|
||||
{ isSubmitting ? <Spinner color="light" /> : 'Submit' }
|
||||
</Button>
|
||||
</div>
|
||||
{
|
||||
isPowerUser && parentId == null ?
|
||||
<NewCommentUpdateSection
|
||||
postUpdateFlagValue={postUpdateFlagValue}
|
||||
handlePostUpdateFlag={handlePostUpdateFlag}
|
||||
/>
|
||||
:
|
||||
null
|
||||
}
|
||||
</React.Fragment>
|
||||
:
|
||||
<a href="/users/sign_in" className="loginInfo">You need to log in to post comments.</a>
|
||||
|
||||
Reference in New Issue
Block a user