Police officer praised after social media post goes viral