Skip to content
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

Merged
merged 3 commits into from
Apr 1, 2018

Conversation

tstiegler
Copy link
Contributor

@tstiegler tstiegler commented Apr 1, 2018

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:

  • Log in as an admin
  • Click "Front Page Configuration" under the "Admin" menu in the navigation bar.
  • Enter the global header, announcement title and and announcement content.
  • Click "Add new announcement".

To remove the global announcement header

  • Click "Front Page Configuration" under the "Admin" menu in the navigation bar.
  • Click "Remove current announcement".

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…d submission.
if($fc->getId() == null || trim($fc->getId()) == "")
$em->persist($fc);
else
$em->merge($fc);
Copy link
Collaborator

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);

Copy link
Collaborator

@nationwide13 nationwide13 left a 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());
Copy link
Collaborator

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();

Copy link
Contributor Author

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();
Copy link
Collaborator

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?

Copy link
Contributor Author

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).

@psineur psineur merged commit d38051d into develop Apr 1, 2018
@tstiegler tstiegler deleted the feature-sitewide-announcements-part-2-issue-84 branch April 2, 2018 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants