From 9df5344050ec0a2b8bec03c7a89fff9d7d41ce2f Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sat, 20 Oct 2018 21:24:01 -0400 Subject: issue: Add author and authored fields --- app/class/issue.class.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'app/class') diff --git a/app/class/issue.class.php b/app/class/issue.class.php index 1c77894..651096e 100644 --- a/app/class/issue.class.php +++ b/app/class/issue.class.php @@ -32,8 +32,10 @@ class issue extends obj "guid", "numb", "assignee", + "author", "seen", "description", + "authored", "due", "tags", ); @@ -58,6 +60,9 @@ class issue extends obj $issue->name = $name; $issue->objtype = "issue"; $issue->numb = $numb; + $issue->setAuthor($owner); + $issue->saveObj(); // get timestamp + $issue->authored = $issue->created; $issue->saveObj(); return $issue; } @@ -83,6 +88,30 @@ class issue extends obj $this->saveObj(); } + /* + * Get the author of this issue. This is usually the user + * that opened the issue, but may differ if this issue was + * elevated from a previous discussion thread. + */ + public function getAuthor() : user + { + if (!isset($this->author) || $this->author == "") + return NULL; + + return new user($this->author); + } + + /* + * Set the author of this issue. This should usually only + * be done while constructing a new message or to clear out + * references to a user that got removed. + */ + public function setAuthor(user $author) : void + { + $this->author = $author->guid; + $this->saveObj(); + } + /* * Get the pad this issue exists under */ -- cgit v1.2.3