Render anime consumption activities

This commit is contained in:
Eduard Urbach 2018-11-12 11:40:46 +09:00
parent 0f0ad9047a
commit 76990417e4
2 changed files with 19 additions and 5 deletions

View File

@ -22,13 +22,14 @@ func Get(ctx *aero.Context) string {
} }
draft, isDraftable := obj.(arn.HasDraft) draft, isDraftable := obj.(arn.HasDraft)
return !isDraftable || !draft.IsDraft
if isDraftable && draft.IsDraft {
return false
}
} }
return true if activity.Type() == "ActivityConsumeAnime" {
return activity.(*arn.ActivityConsumeAnime).Anime() != nil
}
return false
}) })
arn.SortActivitiesLatestFirst(activities) arn.SortActivitiesLatestFirst(activities)

View File

@ -14,11 +14,24 @@ component Activity(activity arn.Activity, user *arn.User)
.activity-parent .activity-parent
if activity.Type() == "ActivityCreate" if activity.Type() == "ActivityCreate"
ActivityCreateTitle(activity.(*arn.ActivityCreate), user) ActivityCreateTitle(activity.(*arn.ActivityCreate), user)
else if activity.Type() == "ActivityConsumeAnime"
ActivityConsumeAnimeTitle(activity.(*arn.ActivityConsumeAnime), user)
.activity-date.utc-date(data-date=activity.GetCreated()) .activity-date.utc-date(data-date=activity.GetCreated())
if activity.Type() == "ActivityCreate" if activity.Type() == "ActivityCreate"
ActivityCreateText(activity.(*arn.ActivityCreate), user) ActivityCreateText(activity.(*arn.ActivityCreate), user)
else if activity.Type() == "ActivityConsumeAnime"
ActivityConsumeAnimeText(activity.(*arn.ActivityConsumeAnime), user)
component ActivityConsumeAnimeTitle(activity *arn.ActivityConsumeAnime, user *arn.User)
a(href=activity.Anime().Link())= activity.Anime().TitleByUser(user)
component ActivityConsumeAnimeText(activity *arn.ActivityConsumeAnime, user *arn.User)
if activity.ToEpisode > activity.FromEpisode
em= fmt.Sprintf("watched episodes %d - %d", activity.FromEpisode, activity.ToEpisode)
else
em= fmt.Sprintf("watched episode %d", activity.ToEpisode)
component ActivityCreateTitle(activity *arn.ActivityCreate, user *arn.User) component ActivityCreateTitle(activity *arn.ActivityCreate, user *arn.User)
if activity.ObjectType == "Post" if activity.ObjectType == "Post"