From 346bd9dc4f69296c51550f0da1b7e40a632051a7 Mon Sep 17 00:00:00 2001 From: Baptiste Lemoine Date: Wed, 22 Jan 2020 16:58:38 +0100 Subject: [PATCH] :zap: mock for poll 1, fix new comment --- src/app/config/mocks/mock-comments.ts | 12 ++++++++++-- src/app/config/mocks/mock1.ts | 11 ++++++++++- .../voting-comment/voting-comment.component.html | 8 ++++++-- src/app/services/config.service.ts | 5 ++++- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/app/config/mocks/mock-comments.ts b/src/app/config/mocks/mock-comments.ts index 17c73beb..ba82f8fd 100644 --- a/src/app/config/mocks/mock-comments.ts +++ b/src/app/config/mocks/mock-comments.ts @@ -1,13 +1,21 @@ export const mockComments = [ { pseudo: "Bulbizarre", - date: "23 décembre 2019", + "date": { + "date": "2020-01-22 16:00:22.000000", + "timezone_type": 3, + "timezone": "Europe/Paris" + }, text: "Pokem ipsum dolor sit amet Electric Cottonee Scratch Leech Life Ice Berry Ducklett. Leaf Green Durant Zoroark\n" + " Skitty Rock Luxio Surskit. Glacier Badge", }, { pseudo: "Marylin", - date: "5 Janvier 2020", + "date": { + "date": "2020-01-22 16:00:22.000000", + "timezone_type": 3, + "timezone": "Europe/Paris" + }, text: "j'ai vu de la lumière o_o", }, ]; diff --git a/src/app/config/mocks/mock1.ts b/src/app/config/mocks/mock1.ts index bfedb4bb..10786af9 100644 --- a/src/app/config/mocks/mock1.ts +++ b/src/app/config/mocks/mock1.ts @@ -104,6 +104,15 @@ export const mockPoll1 = { "url": null } ], - "comments": [], + "comments": [{ + "id": 4, + "text": "wouah trop bien framadate HOUHOUUUU!", + "pseudo": "tk_TEST", + "date": { + "date": "2020-01-22 16:00:22.000000", + "timezone_type": 3, + "timezone": "Europe/Paris" + } + },], "comments_count": 0 }; diff --git a/src/app/pages/voting/voting-comment/voting-comment.component.html b/src/app/pages/voting/voting-comment/voting-comment.component.html index 904d63b6..b4eb6f5b 100644 --- a/src/app/pages/voting/voting-comment/voting-comment.component.html +++ b/src/app/pages/voting/voting-comment/voting-comment.component.html @@ -1,6 +1,10 @@
- {{comment.pseudo}} , le - {{comment.date.date | date:'medium'}} + + {{comment.pseudo}} + , le + + {{comment.date.date | date:'medium'}} +

{{comment.text}} diff --git a/src/app/services/config.service.ts b/src/app/services/config.service.ts index 023e5036..44e7316d 100644 --- a/src/app/services/config.service.ts +++ b/src/app/services/config.service.ts @@ -363,6 +363,7 @@ export class ConfigService extends PollConfig { if (!comment && this.myComment) { comment = { name: this.myName, + pseudo: this.myName, email: this.myEmail, date: new Date(), text: this.myComment, @@ -380,10 +381,12 @@ export class ConfigService extends PollConfig { }); // empty comment after success this.myComment = ''; + comment.date = { + date: comment.date + }; this.currentPoll.comments.push(comment); }, (e) => { this.handleError(e); - this.currentPoll.comments.push(comment); } ); }