feat: 优化首页帖子列表并新增右侧栏最新注册组件
首页列表精简 meta 与统计展示,板块色标前移并淡化;有回复时显示最后回复人。右侧栏新增最新注册(4 列头像网格),友链改为标签块并排换行。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -9,16 +9,16 @@ func TestNormalizeAsideWidgetsPreservesOrder(t *testing.T) {
|
||||
{ID: AsideWidgetRecentComments, Enabled: false},
|
||||
}
|
||||
out := NormalizeAsideWidgets(in)
|
||||
if len(out) != 3 {
|
||||
t.Fatalf("want 3 widgets, got %d", len(out))
|
||||
if len(out) != 4 {
|
||||
t.Fatalf("want 4 widgets, got %d", len(out))
|
||||
}
|
||||
want := []string{AsideWidgetFriendLinks, AsideWidgetTagCloud, AsideWidgetRecentComments}
|
||||
want := []string{AsideWidgetFriendLinks, AsideWidgetTagCloud, AsideWidgetRecentComments, AsideWidgetRecentUsers}
|
||||
for i, id := range want {
|
||||
if out[i].ID != id {
|
||||
t.Fatalf("index %d: want %s, got %s", i, id, out[i].ID)
|
||||
}
|
||||
}
|
||||
if !out[0].Enabled || !out[1].Enabled || out[2].Enabled {
|
||||
if !out[0].Enabled || !out[1].Enabled || out[2].Enabled || out[3].Enabled {
|
||||
t.Fatalf("enabled flags mismatch: %+v", out)
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ func TestAsideBoolsFromWidgets(t *testing.T) {
|
||||
{ID: AsideWidgetRecentComments, Enabled: true},
|
||||
{ID: AsideWidgetFriendLinks, Enabled: false},
|
||||
{ID: AsideWidgetTagCloud, Enabled: true},
|
||||
{ID: AsideWidgetRecentUsers, Enabled: true},
|
||||
}
|
||||
bools := asideBoolsFromWidgets(widgets)
|
||||
if !bools.tagCloud || !bools.recentComments || bools.friendLinks {
|
||||
|
||||
Reference in New Issue
Block a user