Bugfix/labels tagging

This bugfix is intended to resolve the problem mentioned in the ticket #2902 and also optimize the code. Instead of making 1 call AJAX for each object(message), only one call AJAX request is made for all the selected messages.

Another quick fix is made at the same time; there is no longer a visual glitch where the selection is wrong at the end of the AJAX call.
Maybe you could return a 500 with the IMAP error message.