diff --git a/job/webfinger.go b/job/webfinger.go index 2a7c309..589b1e2 100644 --- a/job/webfinger.go +++ b/job/webfinger.go @@ -71,5 +71,8 @@ func (job *webfinger) work() error { } _, err = fed.GetOrFetchActor(context.Background(), job.storage, job.logger, job.httpClient, work) - return err + if err != nil { + job.logger.Warn("webfinger error", zap.Error(err), zap.String("location", work)) + } + return nil } diff --git a/storage/actor.go b/storage/actor.go index 6cc9679..453ff23 100644 --- a/storage/actor.go +++ b/storage/actor.go @@ -30,6 +30,7 @@ type ActorStorage interface { ActorSubjects(ctx context.Context, actors []uuid.UUID) ([]ActorAlias, error) ActorAliasSubjectExists(ctx context.Context, alias string) (bool, error) FilterGroupsByActorID(ctx context.Context, actorIDs []string) ([]string, error) + UpdateActorPayload(ctx context.Context, actorRowID uuid.UUID, payload Payload) error } type Actor struct { @@ -376,3 +377,9 @@ func (s pgStorage) FilterGroupsByActorID(ctx context.Context, actorIDs []string) query := fmt.Sprintf(`SELECT actor_id FROM actors WHERE payload->>'type' = 'Group' AND actor_id in (%s)`, strings.Join(common.DollarForEach(len(actorIDs)), ",")) return s.selectStrings(errors.WrapActorQueryFailedError, ctx, query, common.StringsToInterfaces(actorIDs)...) } + +func (s pgStorage) UpdateActorPayload(ctx context.Context, actorRowID uuid.UUID, payload Payload) error { + now := s.now() + _, err := s.db.ExecContext(ctx, "UPDATE actors SET payload = $3, updated_at = $2 WHERE id = $1", actorRowID, now, payload) + return errors.WrapActorUpdateFailedError(err) +} \ No newline at end of file diff --git a/storage/groups.go b/storage/groups.go index 669135e..1982dc8 100644 --- a/storage/groups.go +++ b/storage/groups.go @@ -44,6 +44,7 @@ type GroupStorage interface { UpdateGroupDefaultRole(ctx context.Context, groupActorRowID uuid.UUID, role GroupRole) error UpdateGroupAcceptFollowers(ctx context.Context, groupRowID uuid.UUID, acceptFollowers bool) error UpdateGroupAllowRemote(ctx context.Context, groupRowID uuid.UUID, allowRemote bool) error + UpdateGroupAbout(ctx context.Context, groupRowID uuid.UUID, about string) error } type Group struct { @@ -325,17 +326,23 @@ func (s pgStorage) MinutesSinceGroupBoost(ctx context.Context, groupActorRowID, func (s pgStorage) UpdateGroupDefaultRole(ctx context.Context, groupRowID uuid.UUID, role GroupRole) error { now := s.now() _, err := s.db.ExecContext(ctx, "UPDATE groups SET default_member_role = $3, updated_at = $2 WHERE id = $1", groupRowID, now, role) - return errors.WrapUserUpdateFailedError(err) + return errors.WrapGroupUpdateFailedError(err) } func (s pgStorage) UpdateGroupAcceptFollowers(ctx context.Context, groupRowID uuid.UUID, acceptFollowers bool) error { now := s.now() _, err := s.db.ExecContext(ctx, "UPDATE groups SET accept_followers = $3, updated_at = $2 WHERE id = $1", groupRowID, now, acceptFollowers) - return errors.WrapUserUpdateFailedError(err) + return errors.WrapGroupUpdateFailedError(err) } func (s pgStorage) UpdateGroupAllowRemote(ctx context.Context, groupRowID uuid.UUID, allowRemote bool) error { now := s.now() _, err := s.db.ExecContext(ctx, "UPDATE groups SET allow_remote = $3, updated_at = $2 WHERE id = $1", groupRowID, now, allowRemote) - return errors.WrapUserUpdateFailedError(err) + return errors.WrapGroupUpdateFailedError(err) +} + +func (s pgStorage) UpdateGroupAbout(ctx context.Context, groupRowID uuid.UUID, about string) error { + now := s.now() + _, err := s.db.ExecContext(ctx, "UPDATE groups SET about = $3, updated_at = $2 WHERE id = $1", groupRowID, now, about) + return errors.WrapGroupUpdateFailedError(err) } diff --git a/templates/group_profile.html b/templates/group_profile.html index 91eaaed..ef80399 100644 --- a/templates/group_profile.html +++ b/templates/group_profile.html @@ -7,7 +7,7 @@
{{ .group.About }}
+ {{ .group.About | toHTML }} {{ else }}This group does not have a description.
{{ end }} @@ -24,8 +24,8 @@