@banta/sdk 4.6.0 → 4.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/banta-sdk.umd.js +104 -94
- package/bundles/banta-sdk.umd.js.map +1 -1
- package/bundles/banta-sdk.umd.min.js +1 -1
- package/bundles/banta-sdk.umd.min.js.map +1 -1
- package/esm2015/lib/comments/banta-comments/banta-comments.component.js +5 -4
- package/esm2015/lib/comments/comment-view/comment-view.component.js +13 -4
- package/fesm2015/banta-sdk.js +16 -6
- package/fesm2015/banta-sdk.js.map +1 -1
- package/package.json +1 -1
package/bundles/banta-sdk.umd.js
CHANGED
|
@@ -8934,9 +8934,18 @@
|
|
|
8934
8934
|
};
|
|
8935
8935
|
CommentViewComponent.prototype.sortMessages = function () {
|
|
8936
8936
|
var _this = this;
|
|
8937
|
-
|
|
8938
|
-
|
|
8939
|
-
|
|
8937
|
+
if (!this.source)
|
|
8938
|
+
return;
|
|
8939
|
+
var sorter;
|
|
8940
|
+
if (this.source.sortOrder === common$1.CommentsOrder.LIKES)
|
|
8941
|
+
sorter = function (a, b) { return b.likes - a.likes; };
|
|
8942
|
+
else if (this.source.sortOrder === common$1.CommentsOrder.NEWEST)
|
|
8943
|
+
sorter = function (a, b) { return (b.sentAt - a.sentAt) * (_this.newestLast ? -1 : 1); };
|
|
8944
|
+
else if (this.source.sortOrder === common$1.CommentsOrder.OLDEST)
|
|
8945
|
+
sorter = function (a, b) { return (a.sentAt - b.sentAt) * (_this.newestLast ? -1 : 1); };
|
|
8946
|
+
this.messages.sort(sorter);
|
|
8947
|
+
this.olderMessages.sort(sorter);
|
|
8948
|
+
this.newMessages.sort(sorter);
|
|
8940
8949
|
};
|
|
8941
8950
|
CommentViewComponent.prototype.messageReceived = function (message) {
|
|
8942
8951
|
var _this = this;
|
|
@@ -9086,25 +9095,25 @@
|
|
|
9086
9095
|
];
|
|
9087
9096
|
this.sendMessage = function (message) { return __awaiter(_this, void 0, void 0, function () {
|
|
9088
9097
|
var _a, intercept, e_1;
|
|
9089
|
-
return __generator(this, function (
|
|
9090
|
-
switch (
|
|
9098
|
+
return __generator(this, function (_e) {
|
|
9099
|
+
switch (_e.label) {
|
|
9091
9100
|
case 0:
|
|
9092
|
-
|
|
9101
|
+
_e.trys.push([0, 4, , 5]);
|
|
9093
9102
|
return [4 /*yield*/, ((_a = this.shouldInterceptMessageSend) === null || _a === void 0 ? void 0 : _a.call(this, message, this.source))];
|
|
9094
9103
|
case 1:
|
|
9095
|
-
intercept =
|
|
9104
|
+
intercept = _e.sent();
|
|
9096
9105
|
if (!!intercept) return [3 /*break*/, 3];
|
|
9097
9106
|
return [4 /*yield*/, this.source.send(message)];
|
|
9098
9107
|
case 2:
|
|
9099
|
-
|
|
9100
|
-
|
|
9108
|
+
_e.sent();
|
|
9109
|
+
_e.label = 3;
|
|
9101
9110
|
case 3:
|
|
9102
9111
|
if (this.source.sortOrder !== common$1.CommentsOrder.NEWEST) {
|
|
9103
9112
|
this.sortOrder = common$1.CommentsOrder.NEWEST;
|
|
9104
9113
|
}
|
|
9105
9114
|
return [2 /*return*/, true];
|
|
9106
9115
|
case 4:
|
|
9107
|
-
e_1 =
|
|
9116
|
+
e_1 = _e.sent();
|
|
9108
9117
|
this.handleBackendException(e_1, 'Could not send: ');
|
|
9109
9118
|
return [3 /*break*/, 5];
|
|
9110
9119
|
case 5: return [2 /*return*/];
|
|
@@ -9113,21 +9122,21 @@
|
|
|
9113
9122
|
}); };
|
|
9114
9123
|
this.sendReply = function (message) { return __awaiter(_this, void 0, void 0, function () {
|
|
9115
9124
|
var _b, intercept, e_2;
|
|
9116
|
-
return __generator(this, function (
|
|
9117
|
-
switch (
|
|
9125
|
+
return __generator(this, function (_e) {
|
|
9126
|
+
switch (_e.label) {
|
|
9118
9127
|
case 0:
|
|
9119
|
-
|
|
9128
|
+
_e.trys.push([0, 4, , 5]);
|
|
9120
9129
|
return [4 /*yield*/, ((_b = this.shouldInterceptMessageSend) === null || _b === void 0 ? void 0 : _b.call(this, message, this.selectedMessageThread))];
|
|
9121
9130
|
case 1:
|
|
9122
|
-
intercept =
|
|
9131
|
+
intercept = _e.sent();
|
|
9123
9132
|
if (!!intercept) return [3 /*break*/, 3];
|
|
9124
9133
|
return [4 /*yield*/, this.selectedMessageThread.send(message)];
|
|
9125
9134
|
case 2:
|
|
9126
|
-
|
|
9127
|
-
|
|
9135
|
+
_e.sent();
|
|
9136
|
+
_e.label = 3;
|
|
9128
9137
|
case 3: return [2 /*return*/, true];
|
|
9129
9138
|
case 4:
|
|
9130
|
-
e_2 =
|
|
9139
|
+
e_2 = _e.sent();
|
|
9131
9140
|
this.handleBackendException(e_2, 'Could not send reply: ');
|
|
9132
9141
|
return [3 /*break*/, 5];
|
|
9133
9142
|
case 5: return [2 /*return*/];
|
|
@@ -9174,9 +9183,9 @@
|
|
|
9174
9183
|
var queryString = window.location.search.substring(1);
|
|
9175
9184
|
var query = queryString.split('&')
|
|
9176
9185
|
.map(function (s) { return s.split('='); })
|
|
9177
|
-
.reduce(function (o,
|
|
9178
|
-
var
|
|
9179
|
-
return (o[k] = v, o);
|
|
9186
|
+
.reduce(function (o, _e) {
|
|
9187
|
+
var _f = __read(_e, 2), k = _f[0], v = _f[1];
|
|
9188
|
+
return (o[decodeURIComponent(k)] = decodeURIComponent(v), o);
|
|
9180
9189
|
}, {});
|
|
9181
9190
|
var commentID = query['comment'];
|
|
9182
9191
|
if (commentID) {
|
|
@@ -9225,19 +9234,19 @@
|
|
|
9225
9234
|
BantaCommentsComponent.prototype.setSourceFromTopicID = function (topicID) {
|
|
9226
9235
|
return __awaiter(this, void 0, void 0, function () {
|
|
9227
9236
|
var _this = this;
|
|
9228
|
-
return __generator(this, function (
|
|
9237
|
+
return __generator(this, function (_e) {
|
|
9229
9238
|
if (typeof window === 'undefined')
|
|
9230
9239
|
return [2 /*return*/];
|
|
9231
9240
|
setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
9232
|
-
var
|
|
9233
|
-
return __generator(this, function (
|
|
9234
|
-
switch (
|
|
9241
|
+
var _e;
|
|
9242
|
+
return __generator(this, function (_f) {
|
|
9243
|
+
switch (_f.label) {
|
|
9235
9244
|
case 0:
|
|
9236
9245
|
console.log("[banta-comments] Subscribing to topic source '" + topicID + "'");
|
|
9237
|
-
|
|
9246
|
+
_e = this;
|
|
9238
9247
|
return [4 /*yield*/, this.backend.getSourceForTopic(topicID, { sortOrder: this.sortOrder })];
|
|
9239
9248
|
case 1:
|
|
9240
|
-
|
|
9249
|
+
_e.source = _f.sent();
|
|
9241
9250
|
this._sourceIsOwned = true;
|
|
9242
9251
|
return [2 /*return*/];
|
|
9243
9252
|
}
|
|
@@ -9268,25 +9277,25 @@
|
|
|
9268
9277
|
BantaCommentsComponent.prototype.startLoading = function () {
|
|
9269
9278
|
return __awaiter(this, void 0, void 0, function () {
|
|
9270
9279
|
var _this = this;
|
|
9271
|
-
return __generator(this, function (
|
|
9272
|
-
switch (
|
|
9280
|
+
return __generator(this, function (_e) {
|
|
9281
|
+
switch (_e.label) {
|
|
9273
9282
|
case 0:
|
|
9274
9283
|
this.loadingStartedAt = this.messageChangedAt = Date.now();
|
|
9275
9284
|
if (this.updateLoading())
|
|
9276
9285
|
return [2 /*return*/];
|
|
9277
9286
|
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(function () { return resolve(); }, 100); })];
|
|
9278
9287
|
case 1:
|
|
9279
|
-
|
|
9288
|
+
_e.sent();
|
|
9280
9289
|
if (this.updateLoading())
|
|
9281
9290
|
return [2 /*return*/];
|
|
9282
9291
|
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(function () { return resolve(); }, 250); })];
|
|
9283
9292
|
case 2:
|
|
9284
|
-
|
|
9293
|
+
_e.sent();
|
|
9285
9294
|
if (this.updateLoading())
|
|
9286
9295
|
return [2 /*return*/];
|
|
9287
9296
|
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(function () { return resolve(); }, 500); })];
|
|
9288
9297
|
case 3:
|
|
9289
|
-
|
|
9298
|
+
_e.sent();
|
|
9290
9299
|
if (this.updateLoading())
|
|
9291
9300
|
return [2 /*return*/];
|
|
9292
9301
|
console.log("[Banta] Loading is taking a long time! Showing loading screen.");
|
|
@@ -9474,26 +9483,26 @@
|
|
|
9474
9483
|
}, 1000);
|
|
9475
9484
|
};
|
|
9476
9485
|
BantaCommentsComponent.prototype.navigateToSharedComment = function (id) {
|
|
9477
|
-
var _a, _b, _c;
|
|
9486
|
+
var _a, _b, _c, _d;
|
|
9478
9487
|
return __awaiter(this, void 0, void 0, function () {
|
|
9479
9488
|
var source, message, e_3, parentMessage, thread;
|
|
9480
|
-
return __generator(this, function (
|
|
9481
|
-
switch (
|
|
9489
|
+
return __generator(this, function (_e) {
|
|
9490
|
+
switch (_e.label) {
|
|
9482
9491
|
case 0:
|
|
9483
9492
|
source = this.source;
|
|
9484
9493
|
return [4 /*yield*/, source.ready];
|
|
9485
9494
|
case 1:
|
|
9486
|
-
|
|
9495
|
+
_e.sent();
|
|
9487
9496
|
console.log("Navigating to shared comment with ID '" + id + "'...");
|
|
9488
|
-
|
|
9497
|
+
_e.label = 2;
|
|
9489
9498
|
case 2:
|
|
9490
|
-
|
|
9499
|
+
_e.trys.push([2, 4, , 5]);
|
|
9491
9500
|
return [4 /*yield*/, this.source.get(id)];
|
|
9492
9501
|
case 3:
|
|
9493
|
-
message =
|
|
9502
|
+
message = _e.sent();
|
|
9494
9503
|
return [3 /*break*/, 5];
|
|
9495
9504
|
case 4:
|
|
9496
|
-
e_3 =
|
|
9505
|
+
e_3 = _e.sent();
|
|
9497
9506
|
console.error("Failed to find comment from URL: " + e_3.message);
|
|
9498
9507
|
return [2 /*return*/];
|
|
9499
9508
|
case 5:
|
|
@@ -9501,31 +9510,32 @@
|
|
|
9501
9510
|
if (!message.parentMessageId) return [3 /*break*/, 11];
|
|
9502
9511
|
return [4 /*yield*/, this.source.get(message.parentMessageId)];
|
|
9503
9512
|
case 6:
|
|
9504
|
-
parentMessage =
|
|
9513
|
+
parentMessage = _e.sent();
|
|
9505
9514
|
(_b = parentMessage.transientState) !== null && _b !== void 0 ? _b : (parentMessage.transientState = {});
|
|
9506
9515
|
return [4 /*yield*/, this.selectMessage(parentMessage)];
|
|
9507
9516
|
case 7:
|
|
9508
|
-
thread =
|
|
9517
|
+
thread = _e.sent();
|
|
9509
9518
|
// Need to re-retrieve the message within the new chat source to affect its
|
|
9510
9519
|
// transient state.
|
|
9511
9520
|
return [4 /*yield*/, thread.ready];
|
|
9512
9521
|
case 8:
|
|
9513
9522
|
// Need to re-retrieve the message within the new chat source to affect its
|
|
9514
9523
|
// transient state.
|
|
9515
|
-
|
|
9524
|
+
_e.sent();
|
|
9516
9525
|
return [4 /*yield*/, thread.get(message.id)];
|
|
9517
9526
|
case 9:
|
|
9518
|
-
message =
|
|
9527
|
+
message = _e.sent();
|
|
9519
9528
|
(_c = message.transientState) !== null && _c !== void 0 ? _c : (message.transientState = {});
|
|
9520
9529
|
message.transientState.highlighted = true;
|
|
9521
9530
|
console.dir(message);
|
|
9522
9531
|
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(function () { return resolve(); }, 500); })];
|
|
9523
9532
|
case 10:
|
|
9524
|
-
|
|
9533
|
+
_e.sent();
|
|
9525
9534
|
return [3 /*break*/, 12];
|
|
9526
9535
|
case 11:
|
|
9527
|
-
|
|
9528
|
-
|
|
9536
|
+
(_d = message.transientState) !== null && _d !== void 0 ? _d : (message.transientState = {});
|
|
9537
|
+
message.transientState.highlighted = true;
|
|
9538
|
+
_e.label = 12;
|
|
9529
9539
|
case 12:
|
|
9530
9540
|
this.scrollToComment(id);
|
|
9531
9541
|
return [2 /*return*/];
|
|
@@ -9564,31 +9574,31 @@
|
|
|
9564
9574
|
BantaCommentsComponent.prototype.likeMessage = function (source, message) {
|
|
9565
9575
|
return __awaiter(this, void 0, void 0, function () {
|
|
9566
9576
|
var e_4;
|
|
9567
|
-
return __generator(this, function (
|
|
9568
|
-
switch (
|
|
9577
|
+
return __generator(this, function (_e) {
|
|
9578
|
+
switch (_e.label) {
|
|
9569
9579
|
case 0:
|
|
9570
9580
|
if (!!this.user) return [3 /*break*/, 2];
|
|
9571
9581
|
return [4 /*yield*/, this.showSignIn()];
|
|
9572
9582
|
case 1:
|
|
9573
|
-
|
|
9583
|
+
_e.sent();
|
|
9574
9584
|
return [2 /*return*/];
|
|
9575
9585
|
case 2:
|
|
9576
9586
|
this._upvoted.next(message);
|
|
9577
9587
|
message.transientState.liking = true;
|
|
9578
|
-
|
|
9588
|
+
_e.label = 3;
|
|
9579
9589
|
case 3:
|
|
9580
|
-
|
|
9590
|
+
_e.trys.push([3, 5, 6, 8]);
|
|
9581
9591
|
return [4 /*yield*/, source.likeMessage(message.id)];
|
|
9582
9592
|
case 4:
|
|
9583
|
-
|
|
9593
|
+
_e.sent();
|
|
9584
9594
|
return [3 /*break*/, 8];
|
|
9585
9595
|
case 5:
|
|
9586
|
-
e_4 =
|
|
9596
|
+
e_4 = _e.sent();
|
|
9587
9597
|
this.handleBackendExceptionAsAlert(e_4, 'Could not like this message: ');
|
|
9588
9598
|
return [3 /*break*/, 8];
|
|
9589
9599
|
case 6: return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(function () { return resolve(); }, 250); })];
|
|
9590
9600
|
case 7:
|
|
9591
|
-
|
|
9601
|
+
_e.sent();
|
|
9592
9602
|
message.transientState.liking = false;
|
|
9593
9603
|
return [7 /*endfinally*/];
|
|
9594
9604
|
case 8: return [2 /*return*/];
|
|
@@ -9600,33 +9610,33 @@
|
|
|
9600
9610
|
var _a;
|
|
9601
9611
|
return __awaiter(this, void 0, void 0, function () {
|
|
9602
9612
|
var e_5;
|
|
9603
|
-
return __generator(this, function (
|
|
9604
|
-
switch (
|
|
9613
|
+
return __generator(this, function (_e) {
|
|
9614
|
+
switch (_e.label) {
|
|
9605
9615
|
case 0:
|
|
9606
9616
|
if (!!this.user) return [3 /*break*/, 2];
|
|
9607
9617
|
return [4 /*yield*/, this.showSignIn()];
|
|
9608
9618
|
case 1:
|
|
9609
|
-
|
|
9619
|
+
_e.sent();
|
|
9610
9620
|
return [2 /*return*/];
|
|
9611
9621
|
case 2:
|
|
9612
9622
|
this._upvoted.next(message);
|
|
9613
9623
|
message.transientState.liking = true;
|
|
9614
9624
|
if ((_a = message.userState) === null || _a === void 0 ? void 0 : _a.liked)
|
|
9615
9625
|
message.likes = (message.likes || 0) - 1;
|
|
9616
|
-
|
|
9626
|
+
_e.label = 3;
|
|
9617
9627
|
case 3:
|
|
9618
|
-
|
|
9628
|
+
_e.trys.push([3, 5, , 6]);
|
|
9619
9629
|
return [4 /*yield*/, source.unlikeMessage(message.id)];
|
|
9620
9630
|
case 4:
|
|
9621
|
-
|
|
9631
|
+
_e.sent();
|
|
9622
9632
|
return [3 /*break*/, 6];
|
|
9623
9633
|
case 5:
|
|
9624
|
-
e_5 =
|
|
9634
|
+
e_5 = _e.sent();
|
|
9625
9635
|
this.handleBackendExceptionAsAlert(e_5, 'Failed to unlike this message: ');
|
|
9626
9636
|
return [3 /*break*/, 6];
|
|
9627
9637
|
case 6: return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(function () { return resolve(); }, 250); })];
|
|
9628
9638
|
case 7:
|
|
9629
|
-
|
|
9639
|
+
_e.sent();
|
|
9630
9640
|
message.transientState.liking = false;
|
|
9631
9641
|
return [2 /*return*/];
|
|
9632
9642
|
}
|
|
@@ -9635,7 +9645,7 @@
|
|
|
9635
9645
|
};
|
|
9636
9646
|
BantaCommentsComponent.prototype.reportMessage = function (message) {
|
|
9637
9647
|
return __awaiter(this, void 0, void 0, function () {
|
|
9638
|
-
return __generator(this, function (
|
|
9648
|
+
return __generator(this, function (_e) {
|
|
9639
9649
|
this._reported.next(message);
|
|
9640
9650
|
return [2 /*return*/];
|
|
9641
9651
|
});
|
|
@@ -9645,7 +9655,7 @@
|
|
|
9645
9655
|
return __awaiter(this, void 0, void 0, function () {
|
|
9646
9656
|
var message;
|
|
9647
9657
|
var _this = this;
|
|
9648
|
-
return __generator(this, function (
|
|
9658
|
+
return __generator(this, function (_e) {
|
|
9649
9659
|
message = this.selectedMessage;
|
|
9650
9660
|
this._selected.next(null);
|
|
9651
9661
|
this.selectedMessage = null;
|
|
@@ -9664,8 +9674,8 @@
|
|
|
9664
9674
|
return __awaiter(this, void 0, void 0, function () {
|
|
9665
9675
|
var selectedMessageThread;
|
|
9666
9676
|
var _this = this;
|
|
9667
|
-
return __generator(this, function (
|
|
9668
|
-
switch (
|
|
9677
|
+
return __generator(this, function (_e) {
|
|
9678
|
+
switch (_e.label) {
|
|
9669
9679
|
case 0:
|
|
9670
9680
|
if (this.selectedMessage === message) {
|
|
9671
9681
|
this.unselectMessage();
|
|
@@ -9675,10 +9685,10 @@
|
|
|
9675
9685
|
this.selectedMessage = message;
|
|
9676
9686
|
return [4 /*yield*/, this.backend.getSourceForThread(this.topicID, message.id)];
|
|
9677
9687
|
case 1:
|
|
9678
|
-
selectedMessageThread =
|
|
9688
|
+
selectedMessageThread = _e.sent();
|
|
9679
9689
|
setTimeout(function () { return _this.selectedMessageVisible = true; });
|
|
9680
9690
|
setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
9681
|
-
return __generator(this, function (
|
|
9691
|
+
return __generator(this, function (_e) {
|
|
9682
9692
|
this.selectedMessageThread = selectedMessageThread;
|
|
9683
9693
|
return [2 /*return*/];
|
|
9684
9694
|
});
|
|
@@ -9690,7 +9700,7 @@
|
|
|
9690
9700
|
};
|
|
9691
9701
|
BantaCommentsComponent.prototype.showSignIn = function () {
|
|
9692
9702
|
return __awaiter(this, void 0, void 0, function () {
|
|
9693
|
-
return __generator(this, function (
|
|
9703
|
+
return __generator(this, function (_e) {
|
|
9694
9704
|
this._signInSelected.next();
|
|
9695
9705
|
return [2 /*return*/];
|
|
9696
9706
|
});
|
|
@@ -9698,7 +9708,7 @@
|
|
|
9698
9708
|
};
|
|
9699
9709
|
BantaCommentsComponent.prototype.showEditAvatar = function () {
|
|
9700
9710
|
return __awaiter(this, void 0, void 0, function () {
|
|
9701
|
-
return __generator(this, function (
|
|
9711
|
+
return __generator(this, function (_e) {
|
|
9702
9712
|
this._editAvatarSelected.next();
|
|
9703
9713
|
return [2 /*return*/];
|
|
9704
9714
|
});
|
|
@@ -9706,7 +9716,7 @@
|
|
|
9706
9716
|
};
|
|
9707
9717
|
BantaCommentsComponent.prototype.selectMessageUser = function (message) {
|
|
9708
9718
|
return __awaiter(this, void 0, void 0, function () {
|
|
9709
|
-
return __generator(this, function (
|
|
9719
|
+
return __generator(this, function (_e) {
|
|
9710
9720
|
this._userSelected.next(message);
|
|
9711
9721
|
return [2 /*return*/];
|
|
9712
9722
|
});
|
|
@@ -9714,7 +9724,7 @@
|
|
|
9714
9724
|
};
|
|
9715
9725
|
BantaCommentsComponent.prototype.selectUsername = function (user) {
|
|
9716
9726
|
return __awaiter(this, void 0, void 0, function () {
|
|
9717
|
-
return __generator(this, function (
|
|
9727
|
+
return __generator(this, function (_e) {
|
|
9718
9728
|
this._usernameSelected.next(user);
|
|
9719
9729
|
return [2 /*return*/];
|
|
9720
9730
|
});
|
|
@@ -9722,7 +9732,7 @@
|
|
|
9722
9732
|
};
|
|
9723
9733
|
BantaCommentsComponent.prototype.selectAvatar = function (user) {
|
|
9724
9734
|
return __awaiter(this, void 0, void 0, function () {
|
|
9725
|
-
return __generator(this, function (
|
|
9735
|
+
return __generator(this, function (_e) {
|
|
9726
9736
|
this._avatarSelected.next(user);
|
|
9727
9737
|
return [2 /*return*/];
|
|
9728
9738
|
});
|
|
@@ -9730,7 +9740,7 @@
|
|
|
9730
9740
|
};
|
|
9731
9741
|
BantaCommentsComponent.prototype.shareMessage = function (message) {
|
|
9732
9742
|
return __awaiter(this, void 0, void 0, function () {
|
|
9733
|
-
return __generator(this, function (
|
|
9743
|
+
return __generator(this, function (_e) {
|
|
9734
9744
|
this._shared.next(message);
|
|
9735
9745
|
return [2 /*return*/];
|
|
9736
9746
|
});
|
|
@@ -9740,28 +9750,28 @@
|
|
|
9740
9750
|
var _a;
|
|
9741
9751
|
return __awaiter(this, void 0, void 0, function () {
|
|
9742
9752
|
var e_6;
|
|
9743
|
-
return __generator(this, function (
|
|
9744
|
-
switch (
|
|
9753
|
+
return __generator(this, function (_e) {
|
|
9754
|
+
switch (_e.label) {
|
|
9745
9755
|
case 0:
|
|
9746
9756
|
if (!!this.user) return [3 /*break*/, 2];
|
|
9747
9757
|
return [4 /*yield*/, this.showSignIn()];
|
|
9748
9758
|
case 1:
|
|
9749
|
-
|
|
9759
|
+
_e.sent();
|
|
9750
9760
|
return [2 /*return*/];
|
|
9751
9761
|
case 2:
|
|
9752
9762
|
if (!confirm("Are you sure you want to delete this comment? You cannot undo this action."))
|
|
9753
9763
|
return [2 /*return*/];
|
|
9754
|
-
|
|
9764
|
+
_e.label = 3;
|
|
9755
9765
|
case 3:
|
|
9756
|
-
|
|
9766
|
+
_e.trys.push([3, 5, , 6]);
|
|
9757
9767
|
return [4 /*yield*/, this.source.deleteMessage(message.id)];
|
|
9758
9768
|
case 4:
|
|
9759
|
-
|
|
9769
|
+
_e.sent();
|
|
9760
9770
|
if (((_a = this.selectedMessage) === null || _a === void 0 ? void 0 : _a.id) === message.id)
|
|
9761
9771
|
this.unselectMessage();
|
|
9762
9772
|
return [3 /*break*/, 6];
|
|
9763
9773
|
case 5:
|
|
9764
|
-
e_6 =
|
|
9774
|
+
e_6 = _e.sent();
|
|
9765
9775
|
this.handleBackendExceptionAsAlert(e_6, "Could not delete message: ");
|
|
9766
9776
|
return [3 /*break*/, 6];
|
|
9767
9777
|
case 6: return [2 /*return*/];
|
|
@@ -9772,22 +9782,22 @@
|
|
|
9772
9782
|
BantaCommentsComponent.prototype.editMessage = function (source, message, newText) {
|
|
9773
9783
|
return __awaiter(this, void 0, void 0, function () {
|
|
9774
9784
|
var e_7;
|
|
9775
|
-
return __generator(this, function (
|
|
9776
|
-
switch (
|
|
9785
|
+
return __generator(this, function (_e) {
|
|
9786
|
+
switch (_e.label) {
|
|
9777
9787
|
case 0:
|
|
9778
9788
|
if (!!this.user) return [3 /*break*/, 2];
|
|
9779
9789
|
return [4 /*yield*/, this.showSignIn()];
|
|
9780
9790
|
case 1:
|
|
9781
|
-
|
|
9791
|
+
_e.sent();
|
|
9782
9792
|
return [2 /*return*/];
|
|
9783
9793
|
case 2:
|
|
9784
|
-
|
|
9794
|
+
_e.trys.push([2, 4, , 5]);
|
|
9785
9795
|
return [4 /*yield*/, source.editMessage(message.id, newText)];
|
|
9786
9796
|
case 3:
|
|
9787
|
-
|
|
9797
|
+
_e.sent();
|
|
9788
9798
|
return [3 /*break*/, 5];
|
|
9789
9799
|
case 4:
|
|
9790
|
-
e_7 =
|
|
9800
|
+
e_7 = _e.sent();
|
|
9791
9801
|
this.handleBackendExceptionAsAlert(e_7, 'Could not edit this message: ');
|
|
9792
9802
|
return [2 /*return*/];
|
|
9793
9803
|
case 5:
|
|
@@ -9800,7 +9810,7 @@
|
|
|
9800
9810
|
};
|
|
9801
9811
|
BantaCommentsComponent.prototype.startEditing = function (message) {
|
|
9802
9812
|
return __awaiter(this, void 0, void 0, function () {
|
|
9803
|
-
return __generator(this, function (
|
|
9813
|
+
return __generator(this, function (_e) {
|
|
9804
9814
|
this.selectedMessage.transientState.editing = false;
|
|
9805
9815
|
message.transientState.editing = true;
|
|
9806
9816
|
return [2 /*return*/];
|
|
@@ -9810,23 +9820,23 @@
|
|
|
9810
9820
|
BantaCommentsComponent.prototype.saveEdit = function (message, text) {
|
|
9811
9821
|
return __awaiter(this, void 0, void 0, function () {
|
|
9812
9822
|
var e_8;
|
|
9813
|
-
return __generator(this, function (
|
|
9814
|
-
switch (
|
|
9823
|
+
return __generator(this, function (_e) {
|
|
9824
|
+
switch (_e.label) {
|
|
9815
9825
|
case 0:
|
|
9816
9826
|
if (!!this.user) return [3 /*break*/, 2];
|
|
9817
9827
|
return [4 /*yield*/, this.showSignIn()];
|
|
9818
9828
|
case 1:
|
|
9819
|
-
|
|
9829
|
+
_e.sent();
|
|
9820
9830
|
return [2 /*return*/];
|
|
9821
9831
|
case 2:
|
|
9822
|
-
|
|
9832
|
+
_e.trys.push([2, 4, , 5]);
|
|
9823
9833
|
return [4 /*yield*/, this.source.editMessage(message.id, text)];
|
|
9824
9834
|
case 3:
|
|
9825
|
-
|
|
9835
|
+
_e.sent();
|
|
9826
9836
|
message.transientState.editing = false;
|
|
9827
9837
|
return [3 /*break*/, 5];
|
|
9828
9838
|
case 4:
|
|
9829
|
-
e_8 =
|
|
9839
|
+
e_8 = _e.sent();
|
|
9830
9840
|
this.handleBackendExceptionAsAlert(e_8, "Could not edit message: ");
|
|
9831
9841
|
return [3 /*break*/, 5];
|
|
9832
9842
|
case 5: return [2 /*return*/];
|