public TopicAlertButtonModel( IGlassBase model, IRenderingContextService renderingService, IAuthenticatedUserContext userContext, IUserContentService <ISavedSearchSaveable, ISavedSearchDisplayable> savedSearchService, ITextTranslator textTranslator) { var parameters = renderingService.GetCurrentRenderingParameters <ITopic_Alert_Options>(); if (IsAuthorPage(model)) { parameters = SetupAuthorParameters(parameters); } IsAuthenticated = userContext.IsAuthenticated; SetAlertText = textTranslator.Translate(DictionaryKeys.TopicSetAlertText); RemoveAlertText = textTranslator.Translate(DictionaryKeys.TopicRemoveAlertText); DisplayButton = model != null && (!string.IsNullOrEmpty(parameters?.Related_Search) || Sitecore.Context.PageMode.IsExperienceEditor); if (DisplayButton) { AlertIsSet = savedSearchService.Exists(new SavedSearchDisplayModel { Url = parameters?.Related_Search ?? string.Empty, AlertEnabled = true }); TopicName = GetTopicTitle(model); AlertTitle = !string.IsNullOrEmpty(parameters?.Search_Name) ? parameters.Search_Name : TopicName; AlertUrl = parameters?.Related_Search; } }
public bool Get(string url) { if (string.IsNullOrEmpty(url)) { return(false); } return(_savedSearchService.Exists(new SavedSearchInput { Url = url, AlertEnabled = true })); }