Fixes #3508 - new _plugin dir introduces auth:login events which will never get triggered.

This commit is contained in:
Rolf Schmidt 2021-05-07 11:52:45 +00:00 committed by Martin Edenhofer
parent 236420da75
commit 1c4524de81
18 changed files with 33 additions and 30 deletions

View file

@ -5,6 +5,4 @@ class App.ControllerWizardFullScreen extends App.ControllerWizardModal
# login check / get session user # login check / get session user
redirectToLogin: => redirectToLogin: =>
App.Auth.loginCheck() App.Auth.loginCheck()
@el.remove() @navigate('#', { removeEl: true })
App.Plugin.init()
@navigate '#', { removeEl: true }

View file

@ -59,6 +59,8 @@ class App.DashboardActivityStream extends App.CollectionController
@el.closest('.sidebar').find('.activity-description').addClass('hidden') @el.closest('.sidebar').find('.activity-description').addClass('hidden')
onRenderItemEnd: (item, el) -> onRenderItemEnd: (item, el) ->
return if App.Session.get() is undefined
new App.WidgetAvatar( new App.WidgetAvatar(
el: el.find('.js-avatar') el: el.find('.js-avatar')
object_id: item.created_by_id object_id: item.created_by_id

View file

@ -16,8 +16,7 @@ class DefaultLocale extends App.Controller
processData: true processData: true
) )
@controllerBind('auth:login', (session) => if App.Session.get() isnt undefined
@delay(check, 3500, 'default_locale') @delay(check, 3500, 'default_locale')
)
App.Config.set('default_locale', DefaultLocale, 'Plugins') App.Config.set('default_locale', DefaultLocale, 'Plugins')

View file

@ -26,9 +26,8 @@ class DefaultTimezone extends App.Controller
# processData: true # processData: true
#) #)
@controllerBind('auth:login', (session) => if App.Session.get() isnt undefined
@delay(check, 8500, 'default_timezone') @delay(check, 8500, 'default_timezone')
)
updateSetting: (timezone) -> updateSetting: (timezone) ->
App.Setting.set('timezone_default', timezone) App.Setting.set('timezone_default', timezone)

View file

@ -51,11 +51,9 @@ class App.Notify extends App.Controller
) )
# request desktop notification after login # request desktop notification after login
@controllerBind('auth', (data) -> if App.Session.get() isnt undefined && window.Notification
if !_.isEmpty(data) window.Notification.requestPermission()
return if !window.Notification
window.Notification.requestPermission()
)
$(window).focus( $(window).focus(
=> =>
for counter, notification of @desktopNotify for counter, notification of @desktopNotify

View file

@ -5,14 +5,16 @@ class SessionTimeout extends App.Controller
super super
lastEvent = new Date().getTime() lastEvent = new Date().getTime()
check_timeout = => checkTimeout = =>
return if new Date().getTime() - 1000 < lastEvent return if new Date().getTime() - 1000 < lastEvent
lastEvent = new Date().getTime() lastEvent = new Date().getTime()
@checkLogout() @checkLogout()
$(document).off('keyup.session_timeout').on('keyup.session_timeout', check_timeout) # reset timeout on mouse move
$(document).off('mousemove.session_timeout').on('mousemove.session_timeout', check_timeout) $(document).off('keyup.session_timeout').on('keyup.session_timeout', checkTimeout)
@controllerBind('config_update', check_timeout) $(document).off('mousemove.session_timeout').on('mousemove.session_timeout', checkTimeout)
@controllerBind('config_update', checkTimeout)
@controllerBind('session_timeout', @quitApp) @controllerBind('session_timeout', @quitApp)
@interval(@checkLogout, 5000, 'session_timeout') @interval(@checkLogout, 5000, 'session_timeout')

View file

@ -14,12 +14,6 @@ class SwitchBackToUser extends App.Controller
@render() @render()
) )
# remove widget
@controllerBind('auth:logout', =>
App.Config.set('switch_back_to_possible', false)
@render()
)
render: (user) -> render: (user) ->
# if no switch to user is active # if no switch to user is active

View file

@ -27,9 +27,8 @@ class TranslationSupport extends App.Controller
@controllerBind('i18n:language:change', => @controllerBind('i18n:language:change', =>
@delay(check, 2500, 'translation_support') @delay(check, 2500, 'translation_support')
) )
@controllerBind('auth:login', => if App.Session.get() isnt undefined
@delay(check, 2500, 'translation_support') @delay(check, 2500, 'translation_support')
)
App.Config.set( 'translaton_support', TranslationSupport, 'Plugins' ) App.Config.set( 'translaton_support', TranslationSupport, 'Plugins' )

View file

@ -7,10 +7,6 @@ class UserSignupCheck extends App.Controller
new Modal(user: user) new Modal(user: user)
) )
@controllerBind('auth:login', (user) =>
return if !user
@verifyLater(user.id)
)
user = App.User.current() user = App.User.current()
@verifyLater(user.id) if user? @verifyLater(user.id) if user?

View file

@ -76,7 +76,6 @@ class Login extends App.ControllerFullPage
) )
success: (data, status, xhr) => success: (data, status, xhr) =>
App.Plugin.init()
# redirect to # # redirect to #
@log 'notice', 'REDIRECT to -#/-' @log 'notice', 'REDIRECT to -#/-'

View file

@ -159,7 +159,6 @@ class App.Auth
if _.isFunction(model_object.clearInMemory) if _.isFunction(model_object.clearInMemory)
model_object.clearInMemory() model_object.clearInMemory()
App.Plugin.init()
App.Event.trigger('auth') App.Event.trigger('auth')
App.Event.trigger('auth:logout') App.Event.trigger('auth:logout')

View file

@ -850,6 +850,8 @@ set new attributes of model (remove already available attributes)
collection collection
activityMessage: (item) -> activityMessage: (item) ->
return if !item
return "Need own activityMessage() in model to generate text (#{@objectDisplayName()}/#{item.type})." return "Need own activityMessage() in model to generate text (#{@objectDisplayName()}/#{item.type})."
@lastUpdatedAt: -> @lastUpdatedAt: ->

View file

@ -21,6 +21,9 @@ Data Privacy tasks will be executed every 10 minutes. The execution might take s
''' '''
activityMessage: (item) -> activityMessage: (item) ->
return if !item
return if !item.created_by
if item.type is 'create' if item.type is 'create'
return App.i18n.translateContent('%s created data privacy task to delete user id |%s|', item.created_by.displayName(), item.objectNative.deletable_id) return App.i18n.translateContent('%s created data privacy task to delete user id |%s|', item.created_by.displayName(), item.objectNative.deletable_id)
else if item.type is 'update' else if item.type is 'update'

View file

@ -48,6 +48,9 @@ Using **Organisations** you can **group** customers. This has among others two i
icon: 'organization' icon: 'organization'
activityMessage: (item) -> activityMessage: (item) ->
return if !item
return if !item.created_by
if item.type is 'create' if item.type is 'create'
return App.i18n.translateContent('%s created Organization |%s|', item.created_by.displayName(), item.title) return App.i18n.translateContent('%s created Organization |%s|', item.created_by.displayName(), item.title)
else if item.type is 'update' else if item.type is 'update'

View file

@ -19,6 +19,9 @@ class App.Role extends App.Model
] ]
activityMessage: (item) -> activityMessage: (item) ->
return if !item
return if !item.created_by
if item.type is 'create' if item.type is 'create'
return App.i18n.translateContent('%s created Role |%s|', item.created_by.displayName(), item.title) return App.i18n.translateContent('%s created Role |%s|', item.created_by.displayName(), item.title)
else if item.type is 'update' else if item.type is 'update'

View file

@ -98,6 +98,8 @@ class App.Ticket extends App.Model
activityMessage: (item) -> activityMessage: (item) ->
return if !item return if !item
return if !item.created_by
if item.type is 'create' if item.type is 'create'
return App.i18n.translateContent('%s created Ticket |%s|', item.created_by.displayName(), item.title) return App.i18n.translateContent('%s created Ticket |%s|', item.created_by.displayName(), item.title)
else if item.type is 'update' else if item.type is 'update'

View file

@ -43,6 +43,8 @@ class App.TicketArticle extends App.Model
activityMessage: (item) -> activityMessage: (item) ->
return if !item return if !item
return if !item.created_by
if item.type is 'create' if item.type is 'create'
return App.i18n.translateContent('%s created Article for |%s|', item.created_by.displayName(), item.title) return App.i18n.translateContent('%s created Article for |%s|', item.created_by.displayName(), item.title)
else if item.type is 'update' else if item.type is 'update'

View file

@ -163,6 +163,9 @@ class App.User extends App.Model
icon: 'user' icon: 'user'
activityMessage: (item) -> activityMessage: (item) ->
return if !item
return if !item.created_by
if item.type is 'create' if item.type is 'create'
return App.i18n.translateContent('%s created User |%s|', item.created_by.displayName(), item.title) return App.i18n.translateContent('%s created User |%s|', item.created_by.displayName(), item.title)
else if item.type is 'update' else if item.type is 'update'