mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-25 07:36:37 +00:00
* Dont hide reply box on other actions. Fixes #1968 * Removing unecessary check.
This commit is contained in:
parent
68f0b654d4
commit
bb8e4f26ee
|
@ -195,7 +195,6 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
): void {
|
||||
if (!deepEqual(this.props, nextProps)) {
|
||||
this.setState({
|
||||
showReply: false,
|
||||
showEdit: false,
|
||||
showRemoveDialog: false,
|
||||
showBanDialog: false,
|
||||
|
|
|
@ -699,7 +699,7 @@ export class Community extends Component<
|
|||
|
||||
async handleEditComment(form: EditComment) {
|
||||
const editCommentRes = await HttpService.client.editComment(form);
|
||||
this.findAndUpdateComment(editCommentRes);
|
||||
this.findAndUpdateCommentEdit(editCommentRes);
|
||||
|
||||
return editCommentRes;
|
||||
}
|
||||
|
@ -889,7 +889,7 @@ export class Community extends Component<
|
|||
}
|
||||
}
|
||||
|
||||
findAndUpdateComment(res: RequestState<CommentResponse>) {
|
||||
findAndUpdateCommentEdit(res: RequestState<CommentResponse>) {
|
||||
this.setState(s => {
|
||||
if (s.commentsRes.state === "success" && res.state === "success") {
|
||||
s.commentsRes.data.comments = editComment(
|
||||
|
@ -902,6 +902,18 @@ export class Community extends Component<
|
|||
});
|
||||
}
|
||||
|
||||
findAndUpdateComment(res: RequestState<CommentResponse>) {
|
||||
this.setState(s => {
|
||||
if (s.commentsRes.state === "success" && res.state === "success") {
|
||||
s.commentsRes.data.comments = editComment(
|
||||
res.data.comment_view,
|
||||
s.commentsRes.data.comments,
|
||||
);
|
||||
}
|
||||
return s;
|
||||
});
|
||||
}
|
||||
|
||||
createAndUpdateComments(res: RequestState<CommentResponse>) {
|
||||
this.setState(s => {
|
||||
if (s.commentsRes.state === "success" && res.state === "success") {
|
||||
|
|
|
@ -931,7 +931,7 @@ export class Home extends Component<any, HomeState> {
|
|||
|
||||
async handleEditComment(form: EditComment) {
|
||||
const editCommentRes = await HttpService.client.editComment(form);
|
||||
this.findAndUpdateComment(editCommentRes);
|
||||
this.findAndUpdateCommentEdit(editCommentRes);
|
||||
|
||||
return editCommentRes;
|
||||
}
|
||||
|
@ -1097,7 +1097,7 @@ export class Home extends Component<any, HomeState> {
|
|||
}
|
||||
}
|
||||
|
||||
findAndUpdateComment(res: RequestState<CommentResponse>) {
|
||||
findAndUpdateCommentEdit(res: RequestState<CommentResponse>) {
|
||||
this.setState(s => {
|
||||
if (s.commentsRes.state === "success" && res.state === "success") {
|
||||
s.commentsRes.data.comments = editComment(
|
||||
|
@ -1110,6 +1110,18 @@ export class Home extends Component<any, HomeState> {
|
|||
});
|
||||
}
|
||||
|
||||
findAndUpdateComment(res: RequestState<CommentResponse>) {
|
||||
this.setState(s => {
|
||||
if (s.commentsRes.state === "success" && res.state === "success") {
|
||||
s.commentsRes.data.comments = editComment(
|
||||
res.data.comment_view,
|
||||
s.commentsRes.data.comments,
|
||||
);
|
||||
}
|
||||
return s;
|
||||
});
|
||||
}
|
||||
|
||||
createAndUpdateComments(res: RequestState<CommentResponse>) {
|
||||
this.setState(s => {
|
||||
if (s.commentsRes.state === "success" && res.state === "success") {
|
||||
|
|
|
@ -845,7 +845,7 @@ export class Profile extends Component<
|
|||
|
||||
async handleEditComment(form: EditComment) {
|
||||
const editCommentRes = await HttpService.client.editComment(form);
|
||||
this.findAndUpdateComment(editCommentRes);
|
||||
this.findAndUpdateCommentEdit(editCommentRes);
|
||||
|
||||
return editCommentRes;
|
||||
}
|
||||
|
@ -1009,7 +1009,7 @@ export class Profile extends Component<
|
|||
}
|
||||
}
|
||||
|
||||
findAndUpdateComment(res: RequestState<CommentResponse>) {
|
||||
findAndUpdateCommentEdit(res: RequestState<CommentResponse>) {
|
||||
this.setState(s => {
|
||||
if (s.personRes.state === "success" && res.state === "success") {
|
||||
s.personRes.data.comments = editComment(
|
||||
|
@ -1022,6 +1022,18 @@ export class Profile extends Component<
|
|||
});
|
||||
}
|
||||
|
||||
findAndUpdateComment(res: RequestState<CommentResponse>) {
|
||||
this.setState(s => {
|
||||
if (s.personRes.state === "success" && res.state === "success") {
|
||||
s.personRes.data.comments = editComment(
|
||||
res.data.comment_view,
|
||||
s.personRes.data.comments,
|
||||
);
|
||||
}
|
||||
return s;
|
||||
});
|
||||
}
|
||||
|
||||
createAndUpdateComments(res: RequestState<CommentResponse>) {
|
||||
this.setState(s => {
|
||||
if (s.personRes.state === "success" && res.state === "success") {
|
||||
|
|
|
@ -822,7 +822,7 @@ export class Post extends Component<any, PostState> {
|
|||
|
||||
async handleEditComment(form: EditComment) {
|
||||
const editCommentRes = await HttpService.client.editComment(form);
|
||||
this.findAndUpdateComment(editCommentRes);
|
||||
this.findAndUpdateCommentEdit(editCommentRes);
|
||||
|
||||
return editCommentRes;
|
||||
}
|
||||
|
@ -1059,7 +1059,7 @@ export class Post extends Component<any, PostState> {
|
|||
});
|
||||
}
|
||||
|
||||
findAndUpdateComment(res: RequestState<CommentResponse>) {
|
||||
findAndUpdateCommentEdit(res: RequestState<CommentResponse>) {
|
||||
this.setState(s => {
|
||||
if (s.commentsRes.state === "success" && res.state === "success") {
|
||||
s.commentsRes.data.comments = editComment(
|
||||
|
@ -1072,6 +1072,19 @@ export class Post extends Component<any, PostState> {
|
|||
});
|
||||
}
|
||||
|
||||
// No need to set finished on a comment vote, save, etc
|
||||
findAndUpdateComment(res: RequestState<CommentResponse>) {
|
||||
this.setState(s => {
|
||||
if (s.commentsRes.state === "success" && res.state === "success") {
|
||||
s.commentsRes.data.comments = editComment(
|
||||
res.data.comment_view,
|
||||
s.commentsRes.data.comments,
|
||||
);
|
||||
}
|
||||
return s;
|
||||
});
|
||||
}
|
||||
|
||||
findAndUpdateCommentReply(res: RequestState<CommentReplyResponse>) {
|
||||
this.setState(s => {
|
||||
if (s.commentsRes.state === "success" && res.state === "success") {
|
||||
|
|
Loading…
Reference in a new issue