- end
-
- def create
-
- # TODO: Find better place to add these
- admin_issues = [ 'DiaryEntry', 'DiaryComment', 'User']
- moderator_issues = [ 'Changeset' ]
-
-
- @issue = Issue.find_by_reportable_id_and_reportable_type(params[:reportable_id],params[:reportable_type])
- # Check if Issue alrwady exists
- if !@issue
- @issue = Issue.find_or_initialize_by(issue_params)
- @issue.updated_by = nil
-
- # Reassign to moderators if it is a moderator issue
- @issue.issue_type = "administrator"
- if moderator_issues.include? @issue.reportable.class.name
- reassign_issue
- end
-
- @admins_or_mods = UserRole.where(role: @issue.issue_type)
- @admins_or_mods.each do |user|
- Notifier.new_issue_notification(User.find(user.user_id)).deliver_now
- end