private string CreateMessageBody(Artist[] followedArtists, User user, IEntryWithNames entry, IEntryLinkFactory entryLinkFactory, bool markdown) { var entryTypeName = entry.EntryType.ToString().ToLowerInvariant(); var entryName = entry.Names.SortNames[user.DefaultLanguageSelection]; var url = entryLinkFactory.GetFullEntryUrl(entry); string entryLink; if (markdown) { entryLink = MarkdownHelper.CreateMarkdownLink(url, entryName); } else { entryLink = string.Format("{0} ( {1} )", entryName, url); } string msg; if (followedArtists.Length == 1) { var artistName = followedArtists.First().TranslatedName[user.DefaultLanguageSelection]; msg = string.Format("A new {0}, '{1}', by {2} was just added.", entryTypeName, entryLink, artistName); } else { msg = string.Format("A new {0}, '{1}', by multiple artists you're following was just added.", entryTypeName, entryLink); } msg += "\nYou're receiving this notification because you're following the artist(s)."; return msg; }
private string CreateMessageBody(Tag[] followedArtists, User user, IEntryWithNames entry, IEntryLinkFactory entryLinkFactory, bool markdown, string entryTypeName) { var entryName = entry.Names.SortNames[user.DefaultLanguageSelection]; var url = entryLinkFactory.GetFullEntryUrl(entry); string entryLink; if (markdown) { entryLink = MarkdownHelper.CreateMarkdownLink(url, entryName); } else { entryLink = $"{entryName} ( {url} )"; } string msg; if (followedArtists.Length == 1) { var artistName = followedArtists.First().TranslatedName[user.DefaultLanguageSelection]; msg = $"A new {entryTypeName}, '{entryLink}', tagged with {artistName} was just added."; } else { msg = $"A new {entryTypeName}, '{entryLink}', tagged with multiple tags you're following was just added."; } msg += "\nYou're receiving this notification because you're following the tag(s)."; return(msg); }
private string CreateMessageBody(Artist[] followedArtists, User user, IEntryWithNames entry, bool markdown, string entryTypeName) { var entryName = entry.Names.SortNames[user.DefaultLanguageSelection]; var url = entryLinkFactory.GetFullEntryUrl(entry); string entryLink; if (markdown) { entryLink = MarkdownHelper.CreateMarkdownLink(url, entryName); } else { entryLink = string.Format("{0} ( {1} )", entryName, url); } string msg; if (followedArtists.Length == 1) { var artistName = followedArtists.First().TranslatedName[user.DefaultLanguageSelection]; msg = string.Format("A new {0}, '{1}', by {2} was just added.", entryTypeName, entryLink, artistName); } else { msg = string.Format("A new {0}, '{1}', by multiple artists you're following was just added.", entryTypeName, entryLink); } msg += "\nYou're receiving this notification because you're following the artist(s)."; return(msg); }
public static EntryForApiContract Create(IEntryWithNames entry, ContentLanguagePreference languagePreference, IEntryThumbPersister thumbPersister, IEntryImagePersisterOld imagePersisterOld, bool ssl, EntryOptionalFields includedFields) { ParamIs.NotNull(() => entry); switch (entry.EntryType) { case EntryType.Album: return(new EntryForApiContract((Album)entry, languagePreference, thumbPersister, ssl, includedFields)); case EntryType.Artist: return(new EntryForApiContract((Artist)entry, languagePreference, thumbPersister, ssl, includedFields)); case EntryType.DiscussionTopic: return(new EntryForApiContract((DiscussionTopic)entry, languagePreference)); case EntryType.ReleaseEvent: return(new EntryForApiContract((ReleaseEvent)entry, thumbPersister, ssl, includedFields)); case EntryType.Song: return(new EntryForApiContract((Song)entry, languagePreference, includedFields)); case EntryType.SongList: return(new EntryForApiContract((SongList)entry, imagePersisterOld, ssl, includedFields)); case EntryType.Tag: return(new EntryForApiContract((Tag)entry, languagePreference, imagePersisterOld, ssl, includedFields)); } return(new EntryForApiContract(entry, languagePreference, includedFields)); }
public static EntryForApiContract Create(IEntryWithNames entry, ContentLanguagePreference languagePreference, IEntryThumbPersister thumbPersister, IEntryImagePersisterOld imagePersisterOld, bool ssl, EntryOptionalFields includedFields) { ParamIs.NotNull(() => entry); if (entry is Album) { return(new EntryForApiContract((Album)entry, languagePreference, thumbPersister, ssl, includedFields)); } else if (entry is Artist) { return(new EntryForApiContract((Artist)entry, languagePreference, thumbPersister, ssl, includedFields)); } else if (entry is DiscussionTopic) { return(new EntryForApiContract((DiscussionTopic)entry, languagePreference)); } else if (entry is Song) { return(new EntryForApiContract((Song)entry, languagePreference, includedFields)); } else if (entry is Tag) { return(new EntryForApiContract((Tag)entry, imagePersisterOld, ssl, includedFields)); } throw new ArgumentException("Unsupported entry type: " + entry, "entry"); }
public static EntryForPictureDisplayContract Create(IEntryWithNames entry, string mime, byte[] bytes, ContentLanguagePreference languagePreference) { var name = entry.Names.SortNames[languagePreference]; var pic = (bytes != null ? new PictureContract(bytes, mime) : null); return(new EntryForPictureDisplayContract(entry.EntryType, entry.Id, name, entry.Version, pic)); }
public static EntryForPictureDisplayContract Create(IEntryWithNames entry, string mime, byte[] bytes, ContentLanguagePreference languagePreference) { var name = entry.Names.SortNames[languagePreference]; var pic = (bytes != null ? new PictureContract(bytes, mime) : null); return new EntryForPictureDisplayContract(entry.EntryType, entry.Id, name, entry.Version, pic); }
private EntryForApiContract(IEntryWithNames entry, ContentLanguagePreference languagePreference, EntryOptionalFields fields) { EntryType = entry.EntryType; Id = entry.Id; DefaultName = entry.DefaultName; DefaultNameLanguage = entry.Names.SortNames.DefaultLanguage; Name = entry.Names.SortNames[languagePreference]; Version = entry.Version; if (fields.HasFlag(EntryOptionalFields.AdditionalNames)) { AdditionalNames = entry.Names.GetAdditionalNamesStringForLanguage(languagePreference); } }
private EntryForApiContract(IEntryWithNames entry, ContentLanguagePreference languagePreference) { EntryType = entry.EntryType; Id = entry.Id; DefaultName = entry.DefaultName; DefaultNameLanguage = entry.Names.SortNames.DefaultLanguage; Name = entry.Names.SortNames[languagePreference]; Version = entry.Version; if (languagePreference != ContentLanguagePreference.Default) { AdditionalNames = entry.Names.GetAdditionalNamesStringForLanguage(languagePreference); LocalizedName = entry.Names.SortNames[languagePreference]; } }
private EntryForApiContract(IEntryWithNames entry, ContentLanguagePreference languagePreference) { EntryType = entry.EntryType; Id = entry.Id; DefaultName = entry.DefaultName; DefaultNameLanguage = entry.Names.SortNames.DefaultLanguage; Name = entry.Names.SortNames[languagePreference]; Version = entry.Version; if (languagePreference != ContentLanguagePreference.Default) { AdditionalNames = entry.Names.GetAdditionalNamesStringForLanguage(languagePreference); LocalizedName = entry.Names.SortNames[languagePreference]; } }
public static EntryForApiContract Create(IEntryWithNames entry, ContentLanguagePreference languagePreference, IAggregatedEntryImageUrlFactory thumbPersister, EntryOptionalFields includedFields) { ParamIs.NotNull(() => entry); return(entry.EntryType switch { EntryType.Album => new EntryForApiContract((Album)entry, languagePreference, thumbPersister, includedFields), EntryType.Artist => new EntryForApiContract((Artist)entry, languagePreference, thumbPersister, includedFields), EntryType.DiscussionTopic => new EntryForApiContract((DiscussionTopic)entry, languagePreference), EntryType.ReleaseEvent => new EntryForApiContract((ReleaseEvent)entry, languagePreference, thumbPersister, includedFields), EntryType.Song => new EntryForApiContract((Song)entry, languagePreference, includedFields), EntryType.SongList => new EntryForApiContract((SongList)entry, thumbPersister, includedFields), EntryType.Tag => new EntryForApiContract((Tag)entry, languagePreference, thumbPersister, includedFields), _ => new EntryForApiContract(entry, languagePreference, includedFields), });
/// <summary> /// Sends notifications /// </summary> /// <param name="ctx">Repository context. Cannot be null.</param> /// <param name="entry">Entry that was created. Cannot be null.</param> /// <param name="artists">List of artists for the entry. Cannot be null.</param> /// <param name="creator">User who created the entry. The creator will be excluded from all notifications. Cannot be null.</param> /// <param name="entryLinkFactory">Factory for creating links to entries. Cannot be null.</param> public async Task SendNotificationsAsync(IDatabaseContext ctx, IEntryWithNames entry, IReadOnlyCollection <Tag> tags, int[] ignoreUsers, IEntryLinkFactory entryLinkFactory, IEnumTranslations enumTranslations) { ParamIs.NotNull(() => ctx); ParamIs.NotNull(() => entry); ParamIs.NotNull(() => tags); ParamIs.NotNull(() => ignoreUsers); ParamIs.NotNull(() => entryLinkFactory); if (!tags.Any()) { return; } try { await DoSendNotificationsAsync(ctx, entry, tags, ignoreUsers, entryLinkFactory, enumTranslations); } catch (GenericADOException x) { log.Error(x, "Unable to send notifications"); } }
public async Task <IReadOnlyCollection <User> > SendNotificationsAsync(IDatabaseContext ctx, IEntryWithNames entry, IEnumerable <Artist> artists, IUser creator) { try { return(await DoSendNotificationsAsync(ctx, entry, artists, creator)); } catch (GenericADOException x) { log.Error(x, "Unable to send notifications"); return(new User[0]); } }
/// <summary> /// Sends notifications /// </summary> /// <param name="ctx">Repository context. Cannot be null.</param> /// <param name="entry">Entry that was created. Cannot be null.</param> /// <param name="artists">List of artists for the entry. Cannot be null.</param> /// <param name="creator">User who created the entry. The creator will be excluded from all notifications. Cannot be null.</param> public User[] SendNotifications(IDatabaseContext ctx, IEntryWithNames entry, IEnumerable <Artist> artists, IUser creator) { ParamIs.NotNull(() => ctx); ParamIs.NotNull(() => entry); ParamIs.NotNull(() => artists); ParamIs.NotNull(() => creator); ParamIs.NotNull(() => entryLinkFactory); ParamIs.NotNull(() => mailer); var coll = artists.ToArray(); var artistIds = coll.Select(a => a.Id).ToArray(); log.Info("Sending notifications for {0} artists", artistIds.Length); // Get users with less than maximum number of unread messages, following any of the artists var usersWithArtists = ctx.OfType <ArtistForUser>() .Query() .Where(afu => artistIds.Contains(afu.Artist.Id) && afu.User.Id != creator.Id && afu.User.Active && afu.SiteNotifications && afu.User.ReceivedMessages.Count(m => m.Inbox == UserInboxType.Notifications && !m.Read) < afu.User.Options.UnreadNotificationsToKeep) .Select(afu => new { UserId = afu.User.Id, ArtistId = afu.Artist.Id }) .ToArray() .GroupBy(afu => afu.UserId) .ToDictionary(afu => afu.Key, afu => afu.Select(a => a.ArtistId)); var userIds = usersWithArtists.Keys; log.Debug("Found {0} users subscribed to artists", userIds.Count); if (!userIds.Any()) { return(new User[0]); } var entryTypeNames = enumTranslations.Translations <EntryType>(); var users = ctx.OfType <User>().Query().Where(u => userIds.Contains(u.Id)).ToArray(); foreach (var user in users) { var artistIdsForUser = new HashSet <int>(usersWithArtists[user.Id]); var followedArtists = coll.Where(a => artistIdsForUser.Contains(a.Id)).ToArray(); if (followedArtists.Length == 0) { continue; } string title; var culture = CultureHelper.GetCultureOrDefault(user.LanguageOrLastLoginCulture); var entryTypeName = entryTypeNames.GetName(entry.EntryType, culture).ToLowerInvariant(); var entrySubType = entrySubTypeNameFactory.GetEntrySubTypeName(entry, enumTranslations, culture)?.ToLowerInvariant(); if (!string.IsNullOrEmpty(entrySubType)) { entryTypeName += $" ({entrySubType})"; } var msg = CreateMessageBody(followedArtists, user, entry, true, entryTypeName); if (followedArtists.Length == 1) { var artistName = followedArtists.First().TranslatedName[user.DefaultLanguageSelection]; title = string.Format("New {0} by {1}", entryTypeName, artistName); } else { title = string.Format("New {0}", entryTypeName); } var notification = new UserMessage(user, title, msg, false); user.Messages.Add(notification); ctx.Save(notification); if (user.EmailOptions != UserEmailOptions.NoEmail && !string.IsNullOrEmpty(user.Email) && followedArtists.Any(a => a.Users.Any(u => u.User.Equals(user) && u.EmailNotifications))) { mailer.SendEmail(user.Email, user.Name, title, CreateMessageBody(followedArtists, user, entry, false, entryTypeName)); } } return(users); }
public Task <IReadOnlyCollection <User> > SendNotificationsAsync(IDatabaseContext ctx, IEntryWithNames entry, IEnumerable <Artist> artists, IUser creator) { return(Task.FromResult((IReadOnlyCollection <User>) new List <User>())); }
public EntryWithImageContract(IEntryWithNames entry, string mime, ContentLanguagePreference languagePreference) : base(entry, languagePreference) { Mime = mime; }
public EntryWithNameAndVersionContract(IEntryWithNames entry, ContentLanguagePreference languagePreference) : base(entry, languagePreference) { Version = entry.Version; }
public int GetHashCode(IEntryWithNames obj) { return(obj.Id); }
public string GetUrlFriendlyName(IEntryWithNames entry) { ParamIs.NotNull(() => entry); return(cachedNames.GetOrAdd(new GlobalEntryId(entry.EntryType, entry.Id), _ => entry.Names.GetUrlFriendlyName())); }
/// <summary> /// Sends notifications /// </summary> /// <param name="ctx">Repository context. Cannot be null.</param> /// <param name="entry">Entry that was created. Cannot be null.</param> /// <param name="artists">List of artists for the entry. Cannot be null.</param> /// <param name="creator">User who created the entry. The creator will be excluded from all notifications. Cannot be null.</param> /// <param name="entryLinkFactory">Factory for creating links to entries. Cannot be null.</param> public void SendNotifications(IDatabaseContext ctx, IEntryWithNames entry, IEnumerable <Tag> tags, int[] ignoreUsers, IEntryLinkFactory entryLinkFactory, IEnumTranslations enumTranslations) { ParamIs.NotNull(() => ctx); ParamIs.NotNull(() => entry); ParamIs.NotNull(() => tags); ParamIs.NotNull(() => ignoreUsers); ParamIs.NotNull(() => entryLinkFactory); var coll = tags.Distinct().ToArray(); var tagIds = coll.Select(a => a.Id).ToArray(); // Get users with less than maximum number of unread messages, following any of the tags var usersWithTags = ctx.OfType <TagForUser>() .Query() .Where(afu => tagIds.Contains(afu.Tag.Id) && afu.User.Active && !ignoreUsers.Contains(afu.User.Id) && afu.User.ReceivedMessages.Count(m => m.Inbox == UserInboxType.Notifications && !m.Read) < afu.User.Options.UnreadNotificationsToKeep) .Select(afu => new { UserId = afu.User.Id, TagId = afu.Tag.Id }) .ToArray() .GroupBy(afu => afu.UserId) .ToDictionary(afu => afu.Key, afu => afu.Select(a => a.TagId)); var userIds = usersWithTags.Keys; if (!userIds.Any()) { return; } var entryTypeNames = enumTranslations.Translations <EntryType>(); var users = ctx.OfType <User>().Query().Where(u => userIds.Contains(u.Id)).ToArray(); foreach (var user in users) { var tagIdsForUser = new HashSet <int>(usersWithTags[user.Id]); var followedTags = coll.Where(a => tagIdsForUser.Contains(a.Id)).ToArray(); if (followedTags.Length == 0) { continue; } string title; var entryTypeName = entryTypeNames.GetName(entry.EntryType, CultureHelper.GetCultureOrDefault(user.LanguageOrLastLoginCulture)).ToLowerInvariant(); var msg = CreateMessageBody(followedTags, user, entry, entryLinkFactory, true, entryTypeName); if (followedTags.Length == 1) { var artistName = followedTags.First().TranslatedName[user.DefaultLanguageSelection]; title = string.Format("New {0} tagged with {1}", entryTypeName, artistName); } else { title = string.Format("New {0}", entryTypeName); } var notification = user.CreateNotification(title, msg); ctx.Save(notification); } }
private async Task DoSendNotificationsAsync(IDatabaseContext ctx, IEntryWithNames entry, IReadOnlyCollection <Tag> tags, int[] ignoreUsers, IEntryLinkFactory entryLinkFactory, IEnumTranslations enumTranslations) { var coll = tags.Distinct().ToArray(); var tagIds = coll.Select(a => a.Id).ToArray(); s_log.Info("Sending notifications for {0} tags", tagIds.Length); // Get users with less than maximum number of unread messages, following any of the tags var usersWithTagsArr = await ctx.Query <TagForUser>() .Where(afu => tagIds.Contains(afu.Tag.Id)) .Select(afu => new { UserId = afu.User.Id, TagId = afu.Tag.Id }) .VdbToListAsync(); var usersWithTags = usersWithTagsArr .GroupBy(afu => afu.UserId) .ToDictionary(afu => afu.Key, afu => afu.Select(a => a.TagId)); var userIds = usersWithTags.Keys.Except(ignoreUsers).ToArray(); s_log.Debug("Found {0} users subscribed to tags", userIds.Length); if (!userIds.Any()) { s_log.Info("No users subscribed to tags - skipping."); return; } var entryTypeNames = enumTranslations.Translations <EntryType>(); var users = await ctx.Query <User>() .WhereIsActive() .WhereIdIn(userIds) .Where(u => u.ReceivedMessages.Count(m => m.Inbox == UserInboxType.Notifications && !m.Read) < u.Options.UnreadNotificationsToKeep) .VdbToListAsync(); foreach (var user in users) { var tagIdsForUser = new HashSet <int>(usersWithTags[user.Id]); var followedTags = coll.Where(a => tagIdsForUser.Contains(a.Id)).ToArray(); if (followedTags.Length == 0) { continue; } string title; var entryTypeName = entryTypeNames.GetName(entry.EntryType, CultureHelper.GetCultureOrDefault(user.LanguageOrLastLoginCulture)).ToLowerInvariant(); var msg = CreateMessageBody(followedTags, user, entry, entryLinkFactory, true, entryTypeName); if (followedTags.Length == 1) { var artistName = followedTags.First().TranslatedName[user.DefaultLanguageSelection]; title = $"New {entryTypeName} tagged with {artistName}"; } else { title = $"New {entryTypeName}"; } var notification = user.CreateNotification(title, msg); await ctx.SaveAsync(notification); } s_log.Info($"Sent notifications to {users.Count} users"); }
public EntryWithImageContract(IEntryWithNames entry, string mime, string songThumbUrl, ContentLanguagePreference languagePreference) : base(entry, languagePreference) { Mime = mime; SongThumbUrl = songThumbUrl; }
/// <summary> /// Sends notifications /// </summary> /// <param name="ctx">Repository context. Cannot be null.</param> /// <param name="entry">Entry that was created. Cannot be null.</param> /// <param name="artists">List of artists for the entry. Cannot be null.</param> /// <param name="creator">User who created the entry. The creator will be excluded from all notifications. Cannot be null.</param> /// <param name="entryLinkFactory">Factory for creating links to entries. Cannot be null.</param> /// <param name="mailer">Mailer for user email messages. Cannot be null.</param> public void SendNotifications(IRepositoryContext<UserMessage> ctx, IEntryWithNames entry, IEnumerable<Artist> artists, IUser creator, IEntryLinkFactory entryLinkFactory, IUserMessageMailer mailer) { ParamIs.NotNull(() => ctx); ParamIs.NotNull(() => entry); ParamIs.NotNull(() => artists); ParamIs.NotNull(() => creator); ParamIs.NotNull(() => entryLinkFactory); ParamIs.NotNull(() => mailer); var coll = artists.ToArray(); var artistIds = coll.Select(a => a.Id).ToArray(); // Get users with 3 or less unread messages, following any of the artists var usersWithArtists = ctx.OfType<ArtistForUser>() .Query() .Where(afu => artistIds.Contains(afu.Artist.Id) && afu.User.Id != creator.Id && afu.User.Active && afu.SiteNotifications && afu.User.ReceivedMessages.Count(m => !m.Read) <= 9) .Select(afu => new { UserId = afu.User.Id, ArtistId = afu.Artist.Id }) .ToArray() .GroupBy(afu => afu.UserId) .ToDictionary(afu => afu.Key, afu => afu.Select(a => a.ArtistId)); var userIds = usersWithArtists.Keys; if (!userIds.Any()) return; var users = ctx.OfType<User>().Query().Where(u => userIds.Contains(u.Id)).ToArray(); foreach (var user in users) { var artistIdsForUser = new HashSet<int>(usersWithArtists[user.Id]); var followedArtists = coll.Where(a => artistIdsForUser.Contains(a.Id)).ToArray(); if (followedArtists.Length == 0) continue; string title; var entryTypeName = entry.EntryType.ToString().ToLowerInvariant(); var msg = CreateMessageBody(followedArtists, user, entry, entryLinkFactory, true); if (followedArtists.Length == 1) { var artistName = followedArtists.First().TranslatedName[user.DefaultLanguageSelection]; title = string.Format("New {0} by {1}", entryTypeName, artistName); } else { title = string.Format("New {0}", entryTypeName); } var notification = new UserMessage(user, title, msg, false); ctx.Save(notification); if (user.EmailOptions != UserEmailOptions.NoEmail && !string.IsNullOrEmpty(user.Email) && followedArtists.Any(a => a.Users.Any(u => u.User.Equals(user) && u.EmailNotifications))) { mailer.SendEmail(user.Email, user.Name, title, CreateMessageBody(followedArtists, user, entry, entryLinkFactory, false)); } } }
/// <summary> /// Sends notifications /// </summary> /// <param name="ctx">Repository context. Cannot be null.</param> /// <param name="entry">Entry that was created. Cannot be null.</param> /// <param name="artists">List of artists for the entry. Cannot be null.</param> /// <param name="creator">User who created the entry. The creator will be excluded from all notifications. Cannot be null.</param> /// <param name="entryLinkFactory">Factory for creating links to entries. Cannot be null.</param> /// <param name="mailer">Mailer for user email messages. Cannot be null.</param> public void SendNotifications(IDatabaseContext <UserMessage> ctx, IEntryWithNames entry, IEnumerable <Artist> artists, IUser creator, IEntryLinkFactory entryLinkFactory, IUserMessageMailer mailer) { ParamIs.NotNull(() => ctx); ParamIs.NotNull(() => entry); ParamIs.NotNull(() => artists); ParamIs.NotNull(() => creator); ParamIs.NotNull(() => entryLinkFactory); ParamIs.NotNull(() => mailer); var coll = artists.ToArray(); var artistIds = coll.Select(a => a.Id).ToArray(); // Get users with 3 or less unread messages, following any of the artists var usersWithArtists = ctx.OfType <ArtistForUser>() .Query() .Where(afu => artistIds.Contains(afu.Artist.Id) && afu.User.Id != creator.Id && afu.User.Active && afu.SiteNotifications && afu.User.ReceivedMessages.Count(m => m.Inbox == UserInboxType.Notifications && !m.Read) < afu.User.Options.UnreadNotificationsToKeep) .Select(afu => new { UserId = afu.User.Id, ArtistId = afu.Artist.Id }) .ToArray() .GroupBy(afu => afu.UserId) .ToDictionary(afu => afu.Key, afu => afu.Select(a => a.ArtistId)); var userIds = usersWithArtists.Keys; if (!userIds.Any()) { return; } var users = ctx.OfType <User>().Query().Where(u => userIds.Contains(u.Id)).ToArray(); foreach (var user in users) { var artistIdsForUser = new HashSet <int>(usersWithArtists[user.Id]); var followedArtists = coll.Where(a => artistIdsForUser.Contains(a.Id)).ToArray(); if (followedArtists.Length == 0) { continue; } string title; var entryTypeName = entry.EntryType.ToString().ToLowerInvariant(); var msg = CreateMessageBody(followedArtists, user, entry, entryLinkFactory, true); if (followedArtists.Length == 1) { var artistName = followedArtists.First().TranslatedName[user.DefaultLanguageSelection]; title = string.Format("New {0} by {1}", entryTypeName, artistName); } else { title = string.Format("New {0}", entryTypeName); } var notification = new UserMessage(user, title, msg, false); user.Messages.Add(notification); ctx.Save(notification); if (user.EmailOptions != UserEmailOptions.NoEmail && !string.IsNullOrEmpty(user.Email) && followedArtists.Any(a => a.Users.Any(u => u.User.Equals(user) && u.EmailNotifications))) { mailer.SendEmail(user.Email, user.Name, title, CreateMessageBody(followedArtists, user, entry, entryLinkFactory, false)); } } }
public User[] SendNotifications(IDatabaseContext ctx, IEntryWithNames entry, IEnumerable <Artist> artists, IUser creator) { return(new User[0]); }
public EntryRefWithNameContract(IEntryWithNames entry, ContentLanguagePreference languagePreference) : base(entry) { Name = entry.Names.GetEntryName(languagePreference); }
public EntryForApiContract Create(IEntryWithNames entry, EntryOptionalFields includedFields, ContentLanguagePreference languagePreference, bool ssl) { return(EntryForApiContract.Create(entry, languagePreference, thumbPersister, imagePersisterOld, ssl, includedFields)); }
public EntryRefWithNameContract(IEntryWithNames entry, ContentLanguagePreference languagePreference) : base(entry) { Name = entry.Names.GetEntryName(languagePreference); }
public EntryWithNameAndVersionContract(IEntryWithNames entry, ContentLanguagePreference languagePreference) : base(entry, languagePreference) { Version = entry.Version; }
public EntryWithImageContract(IEntryWithNames entry, string mime, ContentLanguagePreference languagePreference) : base(entry, languagePreference) { Mime = mime; }