-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 84 - Change site-wide announcement into announcement with threa… #150
Issue 84 - Change site-wide announcement into announcement with threa… #150
Conversation
if($fc->getId() == null || trim($fc->getId()) == "") | ||
$em->persist($fc); | ||
else | ||
$em->merge($fc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be changed to be bit cleaner/readable
// get existing
$fc = $fcr->findSitewide()
if (is_null($fc->getId()) || trim($fc->getId()) == "") {
// If not existing, create new one
$fc = $data->toForumConfiguration();
}
// Set the new data
$fc->setForumId(null);
$fc->setAnnouncementSubmissionId($submission->getId());
$em->persist($fc);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 question 1 simplification
|
||
if ($form->isSubmitted() && $form->isValid()) { | ||
$fc = $data->toForumConfiguration(); | ||
// Find the user and forum for submission. | ||
$user = $ur->loadUserByUsername($this->get('security.token_storage')->getToken()->getUser()->getUsername()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be able to be simplified to $this->getUser()->getUsername();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh ok, I looked around on SO and saw this was the first example of getting the username. I'll change this.
// For sitewide settings, we need to force this to null. | ||
$fc->setForumId(null); | ||
// Load the current announcement's row id. Sitewide announcemnts have null forum id. | ||
$fc = $fcr->findSitewide(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there ever a situation this could return null?
On first migration, before the first announcement has been made?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the only reason this would ever be null is if the announcement forum hadn't been made yet (or deleted for whatever reason).
Issue #84
The sitewide announcement page has been made to act as a post submission page
Note: a forum with the name of "announcements" is required.
To test this issue:
To remove the global announcement header