Extracted action link alert logic to function