set verified status retroactively

This commit is contained in:
Umputun
2018-06-11 09:24:32 -05:00
parent 3f807b2e3f
commit 3e60e57b75
2 changed files with 11 additions and 1 deletions
+4
View File
@@ -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.
+7 -1
View File
@@ -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 = ""