feat: restore default stream details
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-05-30 12:42:41 +01:00
parent 80d0bbe0f5
commit 3cabc7ac16
11 changed files with 754 additions and 23 deletions

View File

@ -69,12 +69,17 @@ public class StreamManagerFactory
State = UserStreamState.Live,
EdgeIp = info.EdgeIp,
ForwardClientId = info.ClientId,
Title = user.Title,
Summary = user.Summary,
Image = user.Image,
ContentWarning = user.ContentWarning,
Tags = user.Tags,
Goal = user.Goal
};
// add new stream
if (existingLive == default)
if (existingLive == null)
{
await stream.CopyLastStreamDetails(_db);
var ev = _eventBuilder.CreateStreamEvent(stream);
stream.Event = NostrJson.Serialize(ev) ?? "";
_db.Streams.Add(stream);

View File

@ -261,7 +261,18 @@ public class UserService
.ExecuteUpdateAsync(o => o.SetProperty(v => v.Title, req.Title)
.SetProperty(v => v.Summary, req.Summary)
.SetProperty(v => v.Image, req.Image)
.SetProperty(v => v.Tags, req.Tags.Length > 0 ? string.Join(",", req.Tags) : null)
.SetProperty(v => v.Tags, req.Tags != null && req.Tags.Length > 0 ? string.Join(",", req.Tags) : null)
.SetProperty(v => v.ContentWarning, req.ContentWarning)
.SetProperty(v => v.Goal, req.Goal));
}
public async Task SetStreamInfoDefaults(string pubkey, PatchEvent req)
{
await _db.Users.Where(a => a.PubKey == pubkey)
.ExecuteUpdateAsync(o => o.SetProperty(v => v.Title, req.Title)
.SetProperty(v => v.Summary, req.Summary)
.SetProperty(v => v.Image, req.Image)
.SetProperty(v => v.Tags, req.Tags != null && req.Tags.Length > 0 ? string.Join(",", req.Tags) : null)
.SetProperty(v => v.ContentWarning, req.ContentWarning)
.SetProperty(v => v.Goal, req.Goal));
}