From d3eb293490f19292ceb78f0adf29ec72f7ded128 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Fri, 7 Oct 2022 21:46:39 +0200 Subject: [PATCH] Account: Simplify display name Make the internal representation of display name always a real string, no need for nulls here, this simplifies life a little. --- src/API/Account.vala | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/API/Account.vala b/src/API/Account.vala index c8ca4dd..4bb51cc 100644 --- a/src/API/Account.vala +++ b/src/API/Account.vala @@ -3,15 +3,20 @@ public class Tooth.API.Account : Entity, Widgetizable { public string id { get; set; } public string username { get; set; } public string acct { get; set; } - public string? _display_name = null; + + /* internal display name representation */ + private string _display_name = ""; + /* User's display name: Specific display name, or falling back to the + nickname */ public string display_name { set { - this._display_name = value; + _display_name = value; } get { - return (_display_name == null || _display_name == "") ? username : _display_name; + return ( ( _display_name.length > 0 ) ? _display_name : username ); } } + public string note { get; set; } public string header { get; set; } public string avatar { get; set; }