From 3e60e57b754739d74f9823eddddf1ea3667291a4 Mon Sep 17 00:00:00 2001 From: Umputun Date: Mon, 11 Jun 2018 09:24:32 -0500 Subject: [PATCH] set verified status retroactively --- README.md | 4 ++++ app/rest/api/admin.go | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a7810333..3c55a92e 100644 --- a/README.md +++ b/README.md @@ -477,3 +477,7 @@ _all admin calls require auth and admin privilege_ * User ID hashed and prefixed by oauth provider name to avoid collisions and potential abuse. * All avatars cached locally to prevent rate limiters from google/github/facebook/yandex. * Docker build uses [publicly available](https://github.com/umputun/baseimage) base images. + +## Current status + +Remark42 is still under development and the first stable v1.0 is about to be released. API (v1) is stable and won't have any breaking changes. diff --git a/app/rest/api/admin.go b/app/rest/api/admin.go index 565c1f34..db752891 100644 --- a/app/rest/api/admin.go +++ b/app/rest/api/admin.go @@ -204,8 +204,9 @@ func (a *admin) alterComments(comments []store.Comment, r *http.Request) (res [] for i, c := range comments { + blocked := a.dataService.IsBlocked(c.Locator.SiteID, c.User.ID) // process blocked users - if a.dataService.IsBlocked(c.Locator.SiteID, c.User.ID) { + if blocked { if !isAdmin { // reset comment to deleted for non-admins c.SetDeleted(store.SoftDelete) } @@ -213,6 +214,11 @@ func (a *admin) alterComments(comments []store.Comment, r *http.Request) (res [] c.Deleted = true } + // set verified status retroactively + if !blocked { + c.User.Verified = a.dataService.IsVerified(c.Locator.SiteID, c.User.ID) + } + // hide info from non-admins if !isAdmin { c.User.IP = ""