From df1420d5db0bddedcca32e9b47f6aaa921b18b39 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sun, 13 Mar 2016 23:58:46 +0100 Subject: [PATCH] Added set to current user for macros. --- app/assets/javascripts/app/controllers/ticket_zoom.coffee | 7 +++++++ db/seeds.rb | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.coffee index 2c66a6c49..e43864afa 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.coffee @@ -548,6 +548,13 @@ class App.TicketZoom extends App.Controller else @sidebar.tagWidget.add(tag) + # apply user changes + else if attributes[1] is 'owner_id' + if content.pre_condition is 'current_user.id' + ticket[attributes[1]] = App.Session.get('id') + else + ticket[attributes[1]] = content.value + # apply direct value changes else ticket[attributes[1]] = content.value diff --git a/db/seeds.rb b/db/seeds.rb index 418860f9c..17abd8e95 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1661,6 +1661,10 @@ Macro.create_if_not_exists( operator: 'add', value: 'spam', }, + 'ticket.owner_id' => { + pre_condition: 'current_user.id', + value: '', + }, }, note: 'example macro', active: true,