public async Task <IStandardComment> CreateCommentAsync(IStandardComment comment) { var eaComment = await _commentMapper.ToNewSpecialComment(comment); await PostComment(eaComment); return(comment); }
internal static bool OfInterest(IStandardComment message, string machineOrigin) { if (message.MessageOrigin.Equals(machineOrigin)) { return(false); } return(true); }
public async Task <IStandardComment> HandleCommentCreation(IStandardComment comment) { if (comment.Content != null) { await _resourceService.CreateCommentAsync(comment); } return(null); }
internal static bool OfInterest(IStandardComment message, string machineOrigin) { if (message.MessageOrigin.Equals(machineOrigin)) { return(false); } if (!message.Identifiers.ContainsKey(InstanceKeyNames.JIRA_ISSUE)) { return(false); } return(true); }
public async Task <Comment> ToNewSpecialComment(IStandardComment comment) { var author = comment.Author == null ? null : await _dbService.GetEasyAccessUserFrom(comment.Author.UserMap[_configSettings.UserColumnName]); var projectId = await ProjectIdProvider.GetProjectId(comment.Identifiers, await _dbService.GetAllProjectMappings()); return(new Comment() { Content = "[" + comment.MessageOrigin.Split('_')[0] + "] | " + comment.Content, AuthorId = author?.Id, AuthorEmail = author?.Email, AuthorName = author?.Name, ProjectId = projectId, TopicGuid = comment.Identifiers[InstanceKeyNames.EASY_ACCESS_TOPIC].Id, Date = comment.Created }); }
public async Task <IStandardComment> CreateCommentAsync(IStandardComment comment) { var jiraIssue = await _resourceClient.RestClient.Issues.GetIssueAsync(comment.Identifiers[InstanceKeyNames.JIRA_ISSUE].Id); var jiraComment = await _commentMapper.ToNewSpecialComment(comment); //Hack to get the right user to post comment, because JIRA doesnt allow custom author out-of-the-box. //Using extension "Extender for JIRA" RemoteComment remoteComment = new RemoteComment() { author = jiraComment.Author, body = jiraComment.Body, roleLevel = jiraComment.RoleLevel, groupLevel = jiraComment.GroupLevel }; var resource = String.Format("rest/api/2/issue/{0}/comment", jiraIssue.Key); var request = new RestRequest(resource, Method.POST); request.AddHeader("contextUser", comment.Author.UserMap[_configSettings.UserColumnName]); request.RequestFormat = DataFormat.Json; request.JsonSerializer = new RestSharpJsonSerializer(JsonSerializer.Create(_resourceClient.RestClient.RestClient.Settings.JsonSerializerSettings)); request.AddJsonBody(remoteComment); var response = await _resourceClient.RestClient.RestClient.RestSharpClient.ExecuteTaskAsync(request); // End hack //var createdComment = await jiraIssue.AddCommentAsync(jiraComment); return(comment); }
public Task <Comment> ToUpdatedSpecialComment(IStandardComment instance, Comment oldSpecial) { throw new NotImplementedException(); }
public Task <IStandardComment> UpdateCommentAsync(IStandardComment comment) { throw new NotImplementedException(); }
public void DeleteCommentAsync(IStandardComment comment) { throw new NotImplementedException(); }