Просмотр исходного кода

Maintenance: Improve user handling for notifications.

Co-authored-by: Florian Liebe <fl@zammad.com>
Rolf Schmidt 5 месяцев назад
Родитель
Сommit
c3bf9341a0
2 измененных файлов с 8 добавлено и 9 удалено
  1. 4 5
      app/models/transaction/notification.rb
  2. 4 4
      i18n/zammad.pot

+ 4 - 5
app/models/transaction/notification.rb

@@ -62,6 +62,10 @@ class Transaction::Notification
     @article ||= article_by_item
   end
 
+  def current_user
+    @current_user ||= User.lookup(id: @item[:user_id]) || User.lookup(id: 1)
+  end
+
   def perform
 
     # return if we run import mode
@@ -238,11 +242,6 @@ class Transaction::Notification
                  raise "unknown type for notification #{@item[:type]}"
                end
 
-    current_user = User.lookup(id: @item[:user_id])
-    if !current_user
-      current_user = User.lookup(id: 1)
-    end
-
     attachments = []
     if article
       attachments = article.attachments_inline

+ 4 - 4
i18n/zammad.pot

@@ -17277,19 +17277,19 @@ msgstr ""
 msgid "You are on waiting list position <strong>%s</strong>."
 msgstr ""
 
-#: app/models/transaction/notification.rb:113
+#: app/models/transaction/notification.rb:117
 msgid "You are receiving this because you are a member of the group of this ticket."
 msgstr ""
 
-#: app/models/transaction/notification.rb:280
+#: app/models/transaction/notification.rb:279
 msgid "You are receiving this because you are out-of-office replacement for a participant of this ticket."
 msgstr ""
 
-#: app/models/transaction/notification.rb:81
+#: app/models/transaction/notification.rb:85
 msgid "You are receiving this because you are the owner of this ticket."
 msgstr ""
 
-#: app/models/transaction/notification.rb:75
+#: app/models/transaction/notification.rb:79
 msgid "You are receiving this because you were mentioned in this ticket."
 msgstr ""