| 175 |
175 |
logger&.error "MailHandler: missing information from #{user}: #{e.message}"
|
| 176 |
176 |
false
|
| 177 |
177 |
rescue MissingContainer => e
|
| 178 |
|
logger&.error "MailHandler: reply to nonexistant object from #{user}: #{e.message}"
|
|
178 |
logger&.error "MailHandler: reply to nonexistent object from #{user}: #{e.message}"
|
| 179 |
179 |
false
|
| 180 |
180 |
rescue UnauthorizedAction => e
|
| 181 |
181 |
logger&.error "MailHandler: unauthorized attempt from #{user}: #{e.message}"
|
| ... | ... | |
| 232 |
232 |
def receive_issue_reply(issue_id, from_journal=nil)
|
| 233 |
233 |
issue = Issue.find_by(:id => issue_id)
|
| 234 |
234 |
if issue.nil?
|
| 235 |
|
raise MissingContainer, "reply to nonexistant issue [##{issue_id}]"
|
|
235 |
raise MissingContainer, "reply to nonexistent issue [##{issue_id}]"
|
| 236 |
236 |
end
|
| 237 |
237 |
|
| 238 |
238 |
# Never receive emails to projects where adding issue notes is not possible
|
| ... | ... | |
| 273 |
273 |
if journal && journal.journalized_type == 'Issue'
|
| 274 |
274 |
receive_issue_reply(journal.journalized_id, journal)
|
| 275 |
275 |
elsif m = email.subject.to_s.match(ISSUE_REPLY_SUBJECT_RE)
|
| 276 |
|
logger&.info "MailHandler: reply to a nonexistant journal, calling receive_issue_reply with issue from subject"
|
|
276 |
logger&.info "MailHandler: reply to a nonexistent journal, calling receive_issue_reply with issue from subject"
|
| 277 |
277 |
receive_issue_reply(m[1].to_i)
|
| 278 |
278 |
else
|
| 279 |
|
raise MissingContainer, "reply to nonexistant journal [#{journal_id}]"
|
|
279 |
raise MissingContainer, "reply to nonexistent journal [#{journal_id}]"
|
| 280 |
280 |
end
|
| 281 |
281 |
end
|
| 282 |
282 |
|
| ... | ... | |
| 284 |
284 |
def receive_message_reply(message_id)
|
| 285 |
285 |
message = Message.find_by(:id => message_id)&.root
|
| 286 |
286 |
if message.nil?
|
| 287 |
|
raise MissingContainer, "reply to nonexistant message [#{message_id}]"
|
|
287 |
raise MissingContainer, "reply to nonexistent message [#{message_id}]"
|
| 288 |
288 |
end
|
| 289 |
289 |
|
| 290 |
290 |
# Never receive emails to projects where adding messages is not possible
|
| ... | ... | |
| 312 |
312 |
def receive_news_reply(news_id)
|
| 313 |
313 |
news = News.find_by_id(news_id)
|
| 314 |
314 |
if news.nil?
|
| 315 |
|
raise MissingContainer, "reply to nonexistant news [#{news_id}]"
|
|
315 |
raise MissingContainer, "reply to nonexistent news [#{news_id}]"
|
| 316 |
316 |
end
|
| 317 |
317 |
|
| 318 |
318 |
# Never receive emails to projects where adding news comments is not possible
|
| ... | ... | |
| 339 |
339 |
if comment && comment.commented_type == 'News'
|
| 340 |
340 |
receive_news_reply(comment.commented.id)
|
| 341 |
341 |
else
|
| 342 |
|
raise MissingContainer, "reply to nonexistant comment [#{comment_id}]"
|
|
342 |
raise MissingContainer, "reply to nonexistent comment [#{comment_id}]"
|
| 343 |
343 |
end
|
| 344 |
344 |
end
|
| 345 |
345 |
|