Beispiel #1
0
 public async Task AddPublisherNotificationsAsync(Publisher publisher, ICatalogueItem target, string title, string msg)
 {
     foreach (User user in publisher.Users)
     {
         await AddNotificationAsync(target, user.Id, title, msg);
     }
 }
Beispiel #2
0
 public async Task AddUserNotificationsAsync(ICatalogueItem catalogueItem, ICatalogueItem target, string title, string msg)
 {
     foreach (Subscription subscription in catalogueItem.Subscriptions)
     {
         await AddNotificationAsync(target, (int)subscription.UserId, title, msg);
     }
 }
        public Task <GitlabResponse <GitlabProject> > UpdateProject(ICatalogueItem catalogueItem)
        {
            GitlabProject gitlabProject = _gitlabProjectConfig.GenerateDefaultGitlabProject();

            _PopulateGitlabProjectWithCatalogueItem(gitlabProject, catalogueItem);
            gitlabProject.id = catalogueItem.GitlabProjectId;
            // TODO: Usikker på om pathen burde endres eller ikke. Kjipt med urler som endres og rart med urler som ikke gjenspeiler innholdet o.O
            // gitlabProject.path = dataset.Title.ToLower().Trim().Replace(' ', '-').Replace("æ", "ae").Replace("ø", "o").Replace("å", "aa");
            return(_gitlabClient.UpdateGitlabProject(gitlabProject));
        }
Beispiel #4
0
        // Target is what catalogue item the user opens when clicking on the notification
        private async Task AddNotificationAsync(ICatalogueItem target, int userId, string title, string msg)
        {
            Notification notification = new Notification
            {
                UserId         = userId,
                Title          = title,
                Description    = msg,
                TimeOfCreation = DateTime.Now,
            };

            if (target is Dataset)
            {
                notification.DatasetId = target.Id;
            }
            if (target is Coordination)
            {
                notification.CoordinationId = target.Id;
            }

            await _notificationRepository.AddNotificationAsync(notification);
        }
 private void _PopulateGitlabProjectWithCatalogueItem(GitlabProject gitlabProject, ICatalogueItem catalogueItem)
 {
     gitlabProject.name        = catalogueItem.Title.Replace(':', ' ');
     gitlabProject.description = catalogueItem.Description.Substring(0, Math.Min(2000, catalogueItem.Description.Length)); // This is the max number of characters in the gitlab project
     if (catalogueItem is Dataset)
     {
         var dataset = (Dataset)catalogueItem;
         gitlabProject.tag_list = dataset.DatasetTags.Select(tag => tag.Tags.Name).ToList();
     }
     if (catalogueItem is Coordination)
     {
         var coordination = (Coordination)catalogueItem;
         gitlabProject.tag_list = coordination.CoordinationTags.Select(tag => tag.Tags.Name).ToList();
     }
 }