Log length increase and score update

This commit is contained in:
Eduard Urbach 2018-03-10 01:20:54 +01:00
parent 1f2a8a3eda
commit 9626204f15
3 changed files with 16 additions and 10 deletions

View File

@ -33,16 +33,11 @@ component Sidebar(user *arn.User)
if user != nil
SidebarButton("Support", "/support", "heart")
if arn.IsDevelopment()
SidebarButton("Groups", "/groups", "users")
//- if arn.IsDevelopment()
//- SidebarButton("Groups", "/groups", "users")
if user != nil && (user.Role == "editor" || user.Role == "admin")
if user.Role == "admin"
SidebarButton("Admin", "/admin", "wrench")
if (user.Role == "editor" || user.Role == "admin")
SidebarButton("Editor", "/editor", "pencil")
SidebarButton("Editor", "/editor", "pencil")
SidebarButton("Log", "/log", "list")
//- Disabled:
@ -62,6 +57,9 @@ component Sidebar(user *arn.User)
Icon("search")
FuzzySearch
if user != nil && user.Role == "admin"
SidebarButton("Admin", "/admin", "wrench")
a.sidebar-link.action(href="#", data-action="toggleTheme", data-trigger="click")
.sidebar-button
Icon("paint-brush")

View File

@ -12,7 +12,7 @@ import (
"github.com/animenotifier/notify.moe/utils"
)
const maxEntries = 40
const maxEntries = 120
// Get edit log.
func Get(ctx *aero.Context) string {

View File

@ -15,11 +15,15 @@ func Get(ctx *aero.Context) string {
return ctx.Redirect("/")
}
ignoreDifferences := arn.FilterIgnoreAnimeDifferences(func(entry *arn.IgnoreAnimeDifference) bool {
return entry.CreatedBy == user.ID
})
logEntries := arn.FilterEditLogEntries(func(entry *arn.EditLogEntry) bool {
return entry.UserID == user.ID
})
score := 0
score := len(ignoreDifferences)
for _, entry := range logEntries {
switch entry.Action {
@ -29,6 +33,10 @@ func Get(ctx *aero.Context) string {
case "edit":
score += 2
if entry.ObjectType == "Anime" && (entry.Key == "Summary" || entry.Key == "Synopsis") {
score += 2
}
case "delete", "arrayRemove":
score++