Skip to content

Commit 8b248ad

Browse files
committed
Merge branch 'hotfix/lf-41' into live
* hotfix/lf-41: fix LF-41 can delete comment - methods now return api call promise Former-commit-id: aa861ae
2 parents 83df556 + 3405845 commit 8b248ad

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/angular-app/bellows/core/offline/lexicon-comments.service.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as angular from 'angular';
22

3-
import { ApiService } from '../api/api.service';
4-
import { JsonRpcCallback } from '../api/json-rpc.service';
5-
import { CommentsOfflineCacheService } from './comments-offline-cache.service';
3+
import {ApiService} from '../api/api.service';
4+
import {JsonRpcCallback, JsonRpcResult} from '../api/json-rpc.service';
5+
import {CommentsOfflineCacheService} from './comments-offline-cache.service';
66

77
class Comment {
88
id: string;
@@ -124,7 +124,7 @@ export class LexiconCommentService {
124124
return 0;
125125
}
126126

127-
removeCommentFromLists(commentId: string, replyId: string): void {
127+
removeCommentFromLists = (commentId: string, replyId: string): void => {
128128
if (replyId) {
129129
// just delete the replyId but don't delete the entire comment
130130
LexiconCommentService.deleteCommentInList(commentId, replyId, this.comments.items.all);
@@ -149,35 +149,35 @@ export class LexiconCommentService {
149149
arr.push.apply(arr, this.$filter('filter')(comments, filter.byStatus));
150150
}
151151

152-
update(commentData: any, callback: JsonRpcCallback): void {
153-
this.api.call('lex_comment_update', [commentData], callback);
152+
update(commentData: any, callback: JsonRpcCallback): angular.IPromise<JsonRpcResult> {
153+
return this.api.call('lex_comment_update', [commentData], callback);
154154
}
155155

156-
updateReply(commentId: string, reply: string, callback: JsonRpcCallback): void {
156+
updateReply(commentId: string, reply: string, callback: JsonRpcCallback): angular.IPromise<JsonRpcResult> {
157157
const comment = this.getCurrentEntryComment(commentId);
158158
comment.replies.push(reply);
159-
this.api.call('lex_commentReply_update', [commentId, reply], callback);
159+
return this.api.call('lex_commentReply_update', [commentId, reply], callback);
160160
}
161161

162-
remove(commentId: string, callback: JsonRpcCallback): void {
163-
this.api.call('lex_comment_delete', [commentId], callback);
162+
remove(commentId: string, callback: JsonRpcCallback): angular.IPromise<JsonRpcResult> {
163+
return this.api.call('lex_comment_delete', [commentId], callback);
164164
}
165165

166-
deleteReply(commentId: string, replyId: string, callback: JsonRpcCallback): void {
167-
this.api.call('lex_commentReply_delete', [commentId, replyId], callback);
166+
deleteReply(commentId: string, replyId: string, callback: JsonRpcCallback): angular.IPromise<JsonRpcResult> {
167+
return this.api.call('lex_commentReply_delete', [commentId, replyId], callback);
168168
}
169169

170-
plusOne(commentId: string, callback: JsonRpcCallback): void {
170+
plusOne(commentId: string, callback: JsonRpcCallback): angular.IPromise<JsonRpcResult> {
171171
const comment = this.getCurrentEntryComment(commentId);
172172
comment.score++;
173173
this.comments.counts.userPlusOne[commentId] = 1;
174-
this.api.call('lex_comment_plusOne', [commentId], callback);
174+
return this.api.call('lex_comment_plusOne', [commentId], callback);
175175
}
176176

177-
updateStatus(commentId: string, status: string, callback: JsonRpcCallback): void {
177+
updateStatus(commentId: string, status: string, callback: JsonRpcCallback): angular.IPromise<JsonRpcResult> {
178178
const comment = this.getCurrentEntryComment(commentId);
179179
comment.status = status;
180-
this.api.call('lex_comment_updateStatus', [commentId, status], callback);
180+
return this.api.call('lex_comment_updateStatus', [commentId, status], callback);
181181
}
182182

183183
private static deleteCommentInList(commentId: string, replyId: string, commentsList: any): void {

0 commit comments

Comments
 (0)