Allow keeping proxy tags when proxying messages.

Required database migration:

Closes #75.
This commit is contained in:
Ske
2019-10-30 09:26:50 +01:00
parent 8604d25ffe
commit 49dc25ee02
7 changed files with 38 additions and 4 deletions

View File

@@ -66,6 +66,7 @@ namespace PluralKit
[JsonProperty("pronouns")] public string Pronouns { get; set; }
[JsonProperty("description")] public string Description { get; set; }
[JsonProperty("proxy_tags")] public ICollection<ProxyTag> ProxyTags { get; set; }
[JsonProperty("keep_proxy")] public bool KeepProxy { get; set; }
[JsonProperty("created")] public Instant Created { get; set; }
// These are deprecated as fuck, and are kinda hacky

View File

@@ -495,7 +495,7 @@ namespace PluralKit {
public async Task SaveMember(PKMember member) {
using (var conn = await _conn.Obtain())
await conn.ExecuteAsync("update members set name = @Name, display_name = @DisplayName, description = @Description, color = @Color, avatar_url = @AvatarUrl, birthday = @Birthday, pronouns = @Pronouns, proxy_tags = @ProxyTags where id = @Id", member);
await conn.ExecuteAsync("update members set name = @Name, display_name = @DisplayName, description = @Description, color = @Color, avatar_url = @AvatarUrl, birthday = @Birthday, pronouns = @Pronouns, proxy_tags = @ProxyTags, keep_proxy = @KeepProxy where id = @Id", member);
_logger.Information("Updated member {@Member}", member);
}

View File

@@ -32,7 +32,8 @@ create table if not exists members
birthday date,
pronouns text,
description text,
proxy_tags proxy_tag[] not null default array[], -- Rationale on making this an array rather than a separate table - we never need to query them individually, only access them as part of a selected Member struct
proxy_tags proxy_tag[] not null default array[], -- Rationale on making this an array rather than a separate table - we never need to query them individually, only access them as part of a selected Member struct
keep_proxy bool not null default false,
created timestamp not null default (current_timestamp at time zone 'utc')
);