Esempio n. 1
0
            public SlackAttachment(PersistentEvent ev)
            {
                TimeStamp = ev.Date.ToUnixTimeSeconds();

                var ud = ev.GetUserDescription();
                var ui = ev.GetUserIdentity();

                Text = ud?.Description;

                string displayName = null;

                if (!String.IsNullOrEmpty(ui?.Identity))
                {
                    displayName = ui.Identity;
                }

                if (!String.IsNullOrEmpty(ui?.Name))
                {
                    displayName = ui.Name;
                }

                if (!String.IsNullOrEmpty(displayName) && !String.IsNullOrEmpty(ud?.EmailAddress))
                {
                    displayName = $"{displayName} ({ud.EmailAddress})";
                }
                else if (!String.IsNullOrEmpty(ui?.Identity) && !String.IsNullOrEmpty(ui.Name))
                {
                    displayName = $"{ui.Name} ({ui.Identity})";
                }

                if (!String.IsNullOrEmpty(displayName))
                {
                    AuthorName = displayName;

                    if (!String.IsNullOrEmpty(ud?.EmailAddress))
                    {
                        AuthorLink = $"mailto:{ud.EmailAddress}?body={ud.Description}";
                        //AuthorIcon = $"https://www.gravatar.com/avatar/{ud.EmailAddress.ToMD5()}",
                    }
                }
            }