How to create a plugin
Hi, I'm attempting to create a plugin that will add a commenter as an issue watcher if they are not watching it already. I believe my code looks ok, but the watcher is not added after adding a comment, and no error is recorded. Any ideas? Thanks - Rob
public class Plugin : CounterSoft.Gemini.Commons.AbstractIssueListener
{
ServiceManager ws;
public Plugin()
{
ws = new ServiceManager("http://localhost/gemini", "plugin", "123456", "abcdefgh", false);
}
public override void IssueCommented(CounterSoft.Gemini.Commons.IssueEventArgs args)
{
foreach ( IssueWatcherEN watcher in args.Issue.Watchers)
{
if (watcher.UserID == args.Comment.UserID)
return;
}
// User commented, but is not watching the issue, add them as a watcher
IssueWatcherEN newWatch = new IssueWatcherEN();
newWatch.State = BaseEN.EntityState.New;
newWatch.UserID = args.Comment.UserID;
newWatch.IssueID = args.Issue.IssueID;
ws.IssuesService.CreateWatcher(args.Comment.IssueID, newWatch);
base.IssueCommented(args);
}
}
Rob
· 1 |
|
Tuesday, September 13, 2011, 11:09:54 PM |