Skip to content

Commit

Permalink
oops
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcom committed Nov 26, 2024
1 parent 8827c8f commit 2802d17
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main/scala/ru/org/linux/topic/AddTopicController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -157,19 +157,22 @@ class AddTopicController(searchQueueSender: SearchQueueSender, captcha: CaptchaS
val params = prepareModel(Some(group), section)(sessionUserOpt).to(mutable.HashMap)

val postingUser = AuthUtil.postingUser(sessionUserOpt, Option(form.getNick), Option(form.getPassword), errors)
val user = postingUser.userOpt.getOrElse(userService.getAnonymous)

user.checkFrozen(errors)

IPBlockDao.checkBlockIP(ipBlockInfo, errors, postingUser.userOpt.orNull)

if (!groupPermissionService.isTopicPostingAllowed(group)(postingUser)) {
errors.reject(null, "Недостаточно прав для постинга тем в эту группу")
}

val tmpl = Template.getTemplate

if (!groupPermissionService.enableAllowAnonymousCheckbox(group)(postingUser)) {
form.setAllowAnonymous(true)
}

val tmpl = Template.getTemplate

val message = MessageTextService.processPostingText(Strings.nullToEmpty(form.getMsg), tmpl.getFormatMode)

if (!postingUser.authorized) {
Expand Down Expand Up @@ -207,7 +210,7 @@ class AddTopicController(searchQueueSender: SearchQueueSender, captcha: CaptchaS
None
}

val previewMsg: Topic = Topic.fromAddRequest(form, postingUser.userOpt.getOrElse(userService.getAnonymous), request.getRemoteAddr)
val previewMsg: Topic = Topic.fromAddRequest(form, user, request.getRemoteAddr)

val imageObject = imagePreview.map(i => Image(0, 0, "gallery/preview/" + i.mainFile.getName, deleted = false, main = true))

Expand Down Expand Up @@ -243,7 +246,7 @@ class AddTopicController(searchQueueSender: SearchQueueSender, captcha: CaptchaS
if (!form.isPreviewMode && !errors.hasErrors) {
session.removeAttribute("image")

createNewTopic(request, form, group, params, section, postingUser.userOpt.orNull, message, imagePreview, previewMsg)
createNewTopic(request, form, group, params, section, user, message, imagePreview, previewMsg)
} else {
new ModelAndView("add", params.asJava)
}
Expand Down

0 comments on commit 2802d17

Please sign in to comment.