Esempio n. 1
0
        public void SendIssueActionNotification(IIssueAction action)
        {
            if (action is ChangeState)
            {
                action = session.Get <ChangeState>(((ChangeState)action).Id);
            }
            var          project = action.Issue.Project;
            IList <User> users   = (from userProject in project.Users where userProject.Notifications && (!userProject.OnlyOwnIssues || action.Issue.CreatedBy == userProject.User) && userProject.User != action.User select userProject.User).ToList();

            foreach (var user in users)
            {
                var message = new MailMessage(sourceAddress, user.EmailAddress)
                {
                    Subject =
                        string.Format("Gitle: {0} - {1}",
                                      action.EmailSubject, action.Issue.Project.Name),
                    IsBodyHtml = true
                };

                message.Body = GetBody("issue-action", new Hashtable {
                    { "item", action }, { "user", user }
                });

                SendMessage(message);
            }
        }
Esempio n. 2
0
        public void ProcessAction(string comment, IIssueAction action, IIssueUser assignTo)
        {
            if (!String.IsNullOrEmpty(comment))
            {
                AddComment(comment);
            }

            _connection.ProcessAction(this, action, assignTo);
        }
Esempio n. 3
0
        public ActionMenuItem(IssueItemView item, IIssueAction action)
            : base(action.Name)
        {
            _issue  = item;
            _action = action;

            ToolTipText = String.Format("{0} and assign to {1}.", _action.Name, _issue.ReportedBy.Name);

            Click += DoClick;
        }
Esempio n. 4
0
		public ActionMenuItem(IssueItemView item, IIssueAction action)
			: base(action.Name)
		{
			_issue = item;
			_action = action;

			ToolTipText = String.Format("{0} and assign to {1}.", _action.Name, _issue.ReportedBy.Name);

			base.Click += new EventHandler(DoClick);
		}
Esempio n. 5
0
        internal void ProcessAction(JiraIssue issue, IIssueAction action, IIssueUser assignTo)
        {
            List <RemoteFieldValue> actionParams = new List <RemoteFieldValue>();

            RemoteField[] fields = _service.getFieldsForAction(_token, issue.DisplayId, action.Id);
            foreach (RemoteField field in fields)
            {
                RemoteFieldValue param     = new RemoteFieldValue();
                string           paramName = param.id = field.id;

                if (StringComparer.OrdinalIgnoreCase.Equals("Resolution", field.name))
                {
                    param.values = new string[] { FindFixResolution() }
                }
                ;
                else if (StringComparer.OrdinalIgnoreCase.Equals("Assignee", field.name))
                {
                    param.values = new string[] { assignTo.Id }
                }
                ;
                else if (StringComparer.OrdinalIgnoreCase.Equals("Worklog", paramName)) // JIRA 4.1 - worklogs are required!
                {
                    continue;
                }
                else
                {
                    param.values = issue.GetFieldValue(paramName);
                    if (param.values == null || param.values.Length == 0 || (param.values.Length == 1 && param.values[0] == null))
                    {
                        string setting = _settings(String.Format("{0}:{1}", action.Name, field.name));
                        if (setting != null)
                        {
                            param.values = new string[] { setting }
                        }
                        ;
                    }
                }

                actionParams.Add(param);
            }

            RemoteIssue newIssue = _service.progressWorkflowAction(_token, issue.DisplayId, action.Id, actionParams.ToArray());
        }
Esempio n. 6
0
 public void ProcessAction(string comment, IIssueAction action, IIssueUser assignTo)
 {
 }
Esempio n. 7
0
        internal void ProcessAction(JiraIssue issue, IIssueAction action, IIssueUser assignTo)
        {
            List<RemoteFieldValue> actionParams = new List<RemoteFieldValue>();

            RemoteField[] fields = _service.getFieldsForAction(_token, issue.DisplayId, action.Id);
            foreach (RemoteField field in fields)
            {
                RemoteFieldValue param = new RemoteFieldValue();
                string paramName = param.id = field.id;

                if (StringComparer.OrdinalIgnoreCase.Equals("Resolution", field.name))
                    param.values = new string[] { FindFixResolution() };
                else if (StringComparer.OrdinalIgnoreCase.Equals("Assignee", field.name))
                    param.values = new string[] { assignTo.Id };
                else if (StringComparer.OrdinalIgnoreCase.Equals("Worklog", paramName))	// JIRA 4.1 - worklogs are required!
                    continue;
                else
                {
                    param.values = issue.GetFieldValue(paramName);
                    if (param.values == null || param.values.Length == 0 || (param.values.Length == 1 && param.values[0] == null))
                    {
                        string setting = _settings(String.Format("{0}:{1}", action.Name, field.name));
                        if(setting != null)
                            param.values = new string[] { setting };
                    }
                }

                actionParams.Add(param);
            }

            RemoteIssue newIssue = _service.progressWorkflowAction(_token, issue.DisplayId, action.Id, actionParams.ToArray());
        }
Esempio n. 8
0
        public IEnumerable <Exception> CommitChanges(int revision, string[] files)
        {
            _serializer.Serialize(_storage);

            List <Exception> errors         = new List <Exception>();
            IList <IIssue>   selectedIssues = this.SelectedIssues;

            _selected.Clear();             //don't want to do this twice...
            StringBuilder comments = new StringBuilder(Comments);

            if (revision > 0)
            {
                if (comments.Length > 0)
                {
                    comments.AppendLine(Environment.NewLine);
                }
                comments.AppendFormat("revision: {0}", revision);
            }
            if (files != null && files.Length > 0)
            {
                if (comments.Length > 0)
                {
                    comments.AppendLine();
                }
                foreach (string file in files)
                {
                    comments.AppendLine(file);
                }
            }

            string actionName = null;

            if (PerformAction && _actions.SelectedItem != null)
            {
                actionName = _actions.SelectedItem.Name;
            }

            IIssueUser assignee = null;

            if (AssignTo && _assignees.SelectedItem != null)
            {
                assignee = _assignees.SelectedItem;
            }

            foreach (IIssue issue in selectedIssues)
            {
                try
                {
                    if (AddWorklog && TimeSpent.Length > 0)
                    {
                        issue.ProcessWorklog(_timeSpent, _timeEstimateRecalcualationMethod, _newTimeEstimate);
                    }
                }
                catch (Exception e)
                {
                    Log.Error(e, "Failed to commit issue {0} - {1}", issue.DisplayId, issue.Name);
                    errors.Add(e);
                }

                try
                {
                    if (actionName != null)
                    {
                        IIssueUser finalAssignee = assignee;
                        if (finalAssignee == ReportedByUser.Instance)
                        {
                            finalAssignee = issue.ReportedBy;
                        }
                        if (finalAssignee == null)
                        {
                            finalAssignee = issue.AssignedTo;
                        }

                        IIssueAction finalAction = null;
                        foreach (IIssueAction action in issue.GetActions())
                        {
                            if (action.Name == actionName)
                            {
                                finalAction = action; break;
                            }
                        }

                        if (finalAction == null)
                        {
                            throw new ApplicationException(String.Format("Action {0} not found.", actionName));
                        }
                        if (finalAssignee == null)
                        {
                            throw new ApplicationException("Invalid assignee.");
                        }

                        issue.ProcessAction(comments.ToString(), finalAction, finalAssignee);
                    }
                    else
                    {
                        issue.AddComment(comments.ToString());
                    }
                }
                catch (Exception e)
                {
                    Log.Error(e, "Failed to commit issue {0} - {1}", issue.DisplayId, issue.Name);
                    errors.Add(e);
                }
            }
            return(errors);
        }
Esempio n. 9
0
		public void ProcessAction(string comment, IIssueAction action, IIssueUser assignTo)
		{
			Issue.ProcessAction(comment, action, assignTo);
		}
Esempio n. 10
0
 public void ProcessAction(string comment, IIssueAction action, IIssueUser assignTo)
 {
     _issue.ProcessAction(comment, action, assignTo);
 }