From 290524e40aa1a6722c77b1bc48703436964c8b81 Mon Sep 17 00:00:00 2001 From: keshav sethi Date: Tue, 28 Jan 2020 23:53:25 +0530 Subject: [PATCH 1/4] added status --- app/views/comments/_comments.html.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/comments/_comments.html.erb b/app/views/comments/_comments.html.erb index b8debb93d3..e6ba851fd2 100644 --- a/app/views/comments/_comments.html.erb +++ b/app/views/comments/_comments.html.erb @@ -34,11 +34,13 @@ <%= distance_of_time_in_words(comment.created_at, Time.current, { include_seconds: false, scope: 'datetime.time_ago_in_words' }) %> <% if comment.status == 4 && current_user &. can_moderate? %> + Status:<%= comment.status %> <%= translation('dashboard.moderate.approve') %> <%= translation('dashboard.moderate.spam') %> <% elsif current_user &. can_moderate? %> + Status:<%= comment.status %> - + <% else %> From 306a10bb5c7f07782ff308d0975603147052fc7a Mon Sep 17 00:00:00 2001 From: keshav sethi Date: Sun, 2 Feb 2020 20:15:48 +0530 Subject: [PATCH 2/4] status message is added --- app/models/comment.rb | 12 ++++++++++++ app/views/comments/_comments.html.erb | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/models/comment.rb b/app/models/comment.rb index a695e90c2f..654f2b7c88 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -91,6 +91,18 @@ def parent aid.zero? ? node : answer&.node end + def status_value + if status == 0 + 'Banned' + elsif status == 1 + 'Normal' + elsif status == 4 + 'Moderated' + else + 'Not Defined' + end + end + def mentioned_users usernames = comment.scan(Callouts.const_get(:FINDER)) User.where(username: usernames.map { |m| m[1] }).distinct diff --git a/app/views/comments/_comments.html.erb b/app/views/comments/_comments.html.erb index e6ba851fd2..ab822c17aa 100644 --- a/app/views/comments/_comments.html.erb +++ b/app/views/comments/_comments.html.erb @@ -34,11 +34,11 @@ <%= distance_of_time_in_words(comment.created_at, Time.current, { include_seconds: false, scope: 'datetime.time_ago_in_words' }) %> <% if comment.status == 4 && current_user &. can_moderate? %> - Status:<%= comment.status %> + Status: <%= comment.status_value %> <%= translation('dashboard.moderate.approve') %> <%= translation('dashboard.moderate.spam') %> <% elsif current_user &. can_moderate? %> - Status:<%= comment.status %> + Status: <%= comment.status_value %> From 45d0246bdff89f3c696f19595a507f0c54f95b7c Mon Sep 17 00:00:00 2001 From: keshav sethi Date: Mon, 3 Feb 2020 22:40:34 +0530 Subject: [PATCH 3/4] space added --- app/models/comment.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/comment.rb b/app/models/comment.rb index 654f2b7c88..3556b88457 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -99,10 +99,10 @@ def status_value elsif status == 4 'Moderated' else - 'Not Defined' + 'Not Defined' end end - + def mentioned_users usernames = comment.scan(Callouts.const_get(:FINDER)) User.where(username: usernames.map { |m| m[1] }).distinct From 3bbf31c61360287dbfeb04057038188160ec0e1e Mon Sep 17 00:00:00 2001 From: keshav sethi Date: Mon, 10 Feb 2020 09:46:13 +0530 Subject: [PATCH 4/4] space added --- app/views/comments/_comments.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/comments/_comments.html.erb b/app/views/comments/_comments.html.erb index ab822c17aa..8ccddb44d8 100644 --- a/app/views/comments/_comments.html.erb +++ b/app/views/comments/_comments.html.erb @@ -40,7 +40,7 @@ <% elsif current_user &. can_moderate? %> Status: <%= comment.status_value %> - + <% else %>