public AdminService(ISessionFactory sessionFactory, IUserPermissionContext permissionContext, IEntryLinkFactory entryLinkFactory, IEnumTranslations enumTranslations, IUserIconFactory userIconFactory) : base(sessionFactory, permissionContext, entryLinkFactory) { this.enumTranslations = enumTranslations; this.userIconFactory = userIconFactory; }
public EventController(EventQueries queries, ReleaseEventService service, AlbumService albumService, IEnumTranslations enumTranslations) { this.queries = queries; this.service = service; this.albumService = albumService; this.enumTranslations = enumTranslations; }
public TagController(TagQueries queries, IEntryLinkFactory entryLinkFactory, IEnumTranslations enumTranslations, MarkdownParser markdownParser) { this.queries = queries; this.entryLinkFactory = entryLinkFactory; this.enumTranslations = enumTranslations; this.markdownParser = markdownParser; }
public FollowedArtistNotifier(IEntryLinkFactory entryLinkFactory, IUserMessageMailer mailer, IEnumTranslations enumTranslations, IEntrySubTypeNameFactory entrySubTypeNameFactory) { this.entryLinkFactory = entryLinkFactory; this.mailer = mailer; this.enumTranslations = enumTranslations; this.entrySubTypeNameFactory = entrySubTypeNameFactory; }
public TagController(TagQueries queries, IEntryLinkFactory entryLinkFactory, IEnumTranslations enumTranslations, MarkdownParser markdownParser, IAggregatedEntryImageUrlFactory entryThumbPersister) { _queries = queries; _entryLinkFactory = entryLinkFactory; _enumTranslations = enumTranslations; _markdownParser = markdownParser; _entryThumbPersister = entryThumbPersister; }
public EventController(EventQueries queries, ReleaseEventService service, IEnumTranslations enumTranslations, IEntryLinkFactory entryLinkFactory, IAggregatedEntryImageUrlFactory thumbPersister) { this.queries = queries; this.service = service; this.enumTranslations = enumTranslations; this.entryLinkFactory = entryLinkFactory; this.thumbPersister = thumbPersister; }
public TagController(TagQueries queries, IEntryLinkFactory entryLinkFactory, IEnumTranslations enumTranslations, MarkdownParser markdownParser, IEntryImagePersisterOld entryThumbPersister) { this.queries = queries; this.entryLinkFactory = entryLinkFactory; this.enumTranslations = enumTranslations; this.markdownParser = markdownParser; this.entryThumbPersister = entryThumbPersister; }
public EventQueries(IEventRepository eventRepository, IEntryLinkFactory entryLinkFactory, IUserPermissionContext permissionContext, IEntryThumbPersister imagePersister, IUserIconFactory userIconFactory, IEnumTranslations enumTranslations, IUserMessageMailer mailer) : base(eventRepository, permissionContext) { this.entryLinkFactory = entryLinkFactory; this.imagePersister = imagePersister; this.userIconFactory = userIconFactory; this.enumTranslations = enumTranslations; this.mailer = mailer; }
public TagQueries(ITagRepository repository, IUserPermissionContext permissionContext, IEntryLinkFactory entryLinkFactory, IEntryImagePersisterOld imagePersister, IUserIconFactory userIconFactory, IEnumTranslations enumTranslations) : base(repository, permissionContext) { this.entryLinkFactory = entryLinkFactory; this.imagePersister = imagePersister; this.userIconFactory = userIconFactory; this.enumTranslations = enumTranslations; }
public ArtistQueries(IArtistRepository repository, IUserPermissionContext permissionContext, IEntryLinkFactory entryLinkFactory, IEntryThumbPersister imagePersister, IEntryPictureFilePersister pictureFilePersister, ObjectCache cache, IUserIconFactory userIconFactory, IEnumTranslations enumTranslations) : base(repository, permissionContext) { this.entryLinkFactory = entryLinkFactory; this.imagePersister = imagePersister; this.pictureFilePersister = pictureFilePersister; this.cache = cache; this.userIconFactory = userIconFactory; this.enumTranslations = enumTranslations; }
public AlbumQueries(IAlbumRepository repository, IUserPermissionContext permissionContext, IEntryLinkFactory entryLinkFactory, IEntryThumbPersister imagePersister, IEntryPictureFilePersister pictureFilePersister, IUserMessageMailer mailer, IUserIconFactory userIconFactory, IEnumTranslations enumTranslations) : base(repository, permissionContext) { this.entryLinkFactory = entryLinkFactory; this.imagePersister = imagePersister; this.pictureFilePersister = pictureFilePersister; this.mailer = mailer; this.userIconFactory = userIconFactory; this.enumTranslations = enumTranslations; }
public TagQueries(ITagRepository repository, IUserPermissionContext permissionContext, IEntryLinkFactory entryLinkFactory, IEntryThumbPersister imagePersister, IAggregatedEntryImageUrlFactory thumbStore, IUserIconFactory userIconFactory, IEnumTranslations enumTranslations, ObjectCache cache) : base(repository, permissionContext) { _entryLinkFactory = entryLinkFactory; _imagePersister = imagePersister; _thumbStore = thumbStore; _userIconFactory = userIconFactory; _enumTranslations = enumTranslations; _cache = cache; }
public EventQueries(IEventRepository eventRepository, IEntryLinkFactory entryLinkFactory, IUserPermissionContext permissionContext, IEntryThumbPersister imagePersister, IUserIconFactory userIconFactory, IEnumTranslations enumTranslations, IUserMessageMailer mailer, IFollowedArtistNotifier followedArtistNotifier, IAggregatedEntryImageUrlFactory imageUrlFactory) : base(eventRepository, permissionContext) { this.entryLinkFactory = entryLinkFactory; this.imagePersister = imagePersister; this.userIconFactory = userIconFactory; this.enumTranslations = enumTranslations; this.mailer = mailer; this.followedArtistNotifier = followedArtistNotifier; this.imageUrlFactory = imageUrlFactory; }
public ArtistQueries(IArtistRepository repository, IUserPermissionContext permissionContext, IEntryLinkFactory entryLinkFactory, IEntryThumbPersister imagePersister, IEntryPictureFilePersister pictureFilePersister, ObjectCache cache, IUserIconFactory userIconFactory, IEnumTranslations enumTranslations, IAggregatedEntryImageUrlFactory imageUrlFactory) : base(repository, permissionContext) { _entryLinkFactory = entryLinkFactory; _imagePersister = imagePersister; _pictureFilePersister = pictureFilePersister; _cache = cache; _userIconFactory = userIconFactory; _enumTranslations = enumTranslations; _imageUrlFactory = imageUrlFactory; }
public SongQueries(ISongRepository repository, IUserPermissionContext permissionContext, IEntryLinkFactory entryLinkFactory, IPVParser pvParser, IUserMessageMailer mailer, ILanguageDetector languageDetector, IUserIconFactory userIconFactory, IEnumTranslations enumTranslations, ObjectCache cache, VdbConfigManager config) : base(repository, permissionContext) { this.entryLinkFactory = entryLinkFactory; this.pvParser = pvParser; this.mailer = mailer; this.languageDetector = languageDetector; this.userIconFactory = userIconFactory; this.enumTranslations = enumTranslations; this.cache = cache; this.config = config; }
public VenueQueries( IVenueRepository venueRepository, IEntryLinkFactory entryLinkFactory, IUserPermissionContext permissionContext, IEnumTranslations enumTranslations, IUserIconFactory userIconFactory, IDiscordWebhookNotifier discordWebhookNotifier) : base(venueRepository, permissionContext) { _entryLinkFactory = entryLinkFactory; _enumTranslations = enumTranslations; _userIconFactory = userIconFactory; _discordWebhookNotifier = discordWebhookNotifier; }
public EntryReportContract(EntryReport report, EntryForApiContract entry, IEnumTranslations enumTranslations) { ParamIs.NotNull(() => report); Created = report.Created; Entry = entry; Hostname = report.Hostname; Id = report.Id; Notes = report.Notes; ReportTypeName = enumTranslations != null?report.TranslatedReportTypeName(enumTranslations) : null; User = (report.User != null ? new UserWithEmailContract(report.User) : null); Version = (report.VersionBase != null ? new ArchivedObjectVersionContract(report.VersionBase) : null); }
public string GetEntrySubTypeName(IEntryBase entryBase, IEnumTranslations enumTranslations, CultureInfo culture) { switch (entryBase) { case Album a: return(enumTranslations.Translation(a.DiscType, culture)); case Artist a: return(enumTranslations.Translation(a.ArtistType, culture)); case Song s: return(enumTranslations.Translation(s.SongType, culture)); } return(string.Empty); }
public AlbumQueries(IAlbumRepository repository, IUserPermissionContext permissionContext, IEntryLinkFactory entryLinkFactory, IEntryThumbPersister imagePersister, IEntryPictureFilePersister pictureFilePersister, IUserMessageMailer mailer, IUserIconFactory userIconFactory, IEnumTranslations enumTranslations, IPVParser pvParser, IFollowedArtistNotifier followedArtistNotifier, IAggregatedEntryImageUrlFactory entryThumbPersister, ObjectCache cache) : base(repository, permissionContext) { this.entryLinkFactory = entryLinkFactory; this.imagePersister = imagePersister; this.pictureFilePersister = pictureFilePersister; this.mailer = mailer; this.userIconFactory = userIconFactory; this.enumTranslations = enumTranslations; this.pvParser = pvParser; this.followedArtistNotifier = followedArtistNotifier; this.imageUrlFactory = entryThumbPersister; this.cache = cache; }
public EntryReportContract(EntryReport report, EntryForApiContract entry, IEnumTranslations enumTranslations, IUserIconFactory userIconFactory) { ParamIs.NotNull(() => report); ClosedAt = report.ClosedAt; ClosedBy = report.ClosedBy != null ? new UserForApiContract(report.ClosedBy, userIconFactory, UserOptionalFields.MainPicture) : null; Created = report.Created; Entry = entry; Hostname = report.Hostname; Id = report.Id; Notes = report.Notes; ReportTypeName = enumTranslations != null?report.TranslatedReportTypeName(enumTranslations) : null; User = (report.User != null ? new UserForApiContract(report.User, userIconFactory, UserOptionalFields.MainPicture) : null); Version = (report.VersionBase != null ? new ArchivedObjectVersionContract(report.VersionBase) : null); }
/// <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 EventQueries( IEventRepository eventRepository, IEntryLinkFactory entryLinkFactory, IUserPermissionContext permissionContext, IEntryThumbPersister imagePersister, IUserIconFactory userIconFactory, IEnumTranslations enumTranslations, IUserMessageMailer mailer, IFollowedArtistNotifier followedArtistNotifier, IAggregatedEntryImageUrlFactory imageUrlFactory, IDiscordWebhookNotifier discordWebhookNotifier) : base(eventRepository, permissionContext) { _entryLinkFactory = entryLinkFactory; _imagePersister = imagePersister; _userIconFactory = userIconFactory; _enumTranslations = enumTranslations; _mailer = mailer; _followedArtistNotifier = followedArtistNotifier; _imageUrlFactory = imageUrlFactory; _discordWebhookNotifier = discordWebhookNotifier; }
public VenueQueries(IVenueRepository venueRepository, IEntryLinkFactory entryLinkFactory, IUserPermissionContext permissionContext, IEnumTranslations enumTranslations) : base(venueRepository, permissionContext) { _entryLinkFactory = entryLinkFactory; _enumTranslations = enumTranslations; }
public virtual string TranslateReason(IEnumTranslations translator) { return(string.Empty); }
public virtual string TranslateChangedFields(IEnumTranslations translator) { return(string.Empty); }
public override string TranslateChangedFields(IEnumTranslations translator) { return(!Equals(ChangedFields, DefaultField) ? translator.Translations <TFields>().GetAllNameNames(ChangedFields, DefaultField) : string.Empty); }
public override string TranslatedReportTypeName(IEnumTranslations enumTranslations, CultureInfo culture) { return(enumTranslations.Translation(ReportType, culture)); }
public override string TranslatedReportTypeName(IEnumTranslations enumTranslations) { return(enumTranslations.Translation(ReportType)); }
public override string TranslateReason(IEnumTranslations translator) { return(!Equals(Reason, default(TReason)) ? translator.Translations <TReason>().GetName(Reason) : Notes); }
public TagUsageForApiContract[] AddTags <TEntry, TTag>(int entryId, TagBaseContract[] tags, bool onlyAdd, IRepository <User> repository, IEntryLinkFactory entryLinkFactory, IEnumTranslations enumTranslations, Func <TEntry, TagManager <TTag> > tagFunc, Func <TEntry, IDatabaseContext <TTag>, ITagUsageFactory <TTag> > tagUsageFactoryFactory) where TEntry : IEntryWithNames, IEntryWithTags where TTag : TagUsage { ParamIs.NotNull(() => tags); permissionContext.VerifyManageDatabase(); tags = tags.Where(IsValid).ToArray(); if (onlyAdd && !tags.Any()) { return(new TagUsageForApiContract[0]); } return(repository.HandleTransaction(ctx => { // Tags are primarily added by Id, secondarily by translated name. // First separate given tags for tag IDs and tag names var tagIds = tags.Where(HasId).Select(t => t.Id).ToArray(); var translatedTagNames = tags.Where(t => !HasId(t) && !string.IsNullOrEmpty(t.Name)).Select(t => t.Name).ToArray(); // Load existing tags by name and ID. var tagsFromIds = ctx.Query <Tag>().Where(t => tagIds.Contains(t.Id)).ToArray(); var tagsFromNames = ctx.Query <Tag>().WhereHasName(translatedTagNames).ToArray(); // Figure out tags that don't exist yet (no ID and no matching name). var newTagNames = translatedTagNames.Except(tagsFromNames.SelectMany(t => t.Names.AllValues), StringComparer.InvariantCultureIgnoreCase).ToArray(); var user = ctx.OfType <User>().GetLoggedUser(permissionContext); var tagFactory = new TagFactoryRepository(ctx.OfType <Tag>(), new AgentLoginData(user)); var newTags = newTagNames.Select(t => tagFactory.CreateTag(t)).ToArray(); // Get the final list of tag names with translations var appliedTags = tagsFromNames.Concat(tagsFromIds).Concat(newTags).Distinct().ToArray(); var entry = ctx.OfType <TEntry>().Load(entryId); var tagUsageFactory = tagUsageFactoryFactory(entry, ctx.OfType <TTag>()); var tagNames = appliedTags.Select(t => t.DefaultName); ctx.AuditLogger.AuditLog(string.Format("tagging {0} with {1}", entryLinkFactory.CreateEntryLink(entry), string.Join(", ", tagNames)), user); var addedTags = appliedTags.Except(entry.Tags.Tags).ToArray(); new FollowedTagNotifier().SendNotifications(ctx, entry, addedTags, new[] { user.Id }, entryLinkFactory, enumTranslations); var updatedTags = tagFunc(entry).SyncVotes(user, appliedTags, tagUsageFactory, onlyAdd: onlyAdd); var tagCtx = ctx.OfType <Tag>(); foreach (var tag in updatedTags) { tagCtx.Update(tag); } RecomputeTagUsagesCounts(tagCtx, updatedTags); ctx.AuditLogger.SysLog("finished tagging"); return tagFunc(entry).ActiveUsages.Select(t => new TagUsageForApiContract(t, permissionContext.LanguagePreference)).ToArray(); })); }