@@ -415,27 +415,31 @@ function icon_callback($vals, $style, $output_mod) {
415415if (!hm_exists ('message_controls ' )) {
416416function message_controls ($ output_mod ) {
417417 $ txt = '' ;
418+ $ controls = ['read ' , 'unread ' , 'flag ' , 'unflag ' , 'delete ' , 'archive ' , 'junk ' ];
419+ $ controls = array_filter ($ controls , function ($ val ) use ($ output_mod ) {
420+ if (in_array ($ val , [$ output_mod ->get ('list_path ' , '' ), strtolower ($ output_mod ->get ('core_msg_control_folder ' , '' ))])) {
421+ return false ;
422+ }
423+ if ($ val == 'flag ' && $ output_mod ->get ('list_path ' , '' ) == 'flagged ' ) {
424+ return false ;
425+ }
426+ return true ;
427+ });
428+
418429 $ res = '<a class="toggle_link" href="#"><i class="bi bi-check-square-fill"></i></a> ' .
419430 '<div class="msg_controls fs-6 d-none gap-1 align-items-center"> ' .
420431 '<div class="dropdown on_mobile"> ' .
421432 '<button type="button" class="btn btn-outline-success btn-sm dropdown-toggle" id="coreMsgControlDropdown" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="true">Actions</button> ' .
422- '<ul class="dropdown-menu" aria-labelledby="coreMsgControlDropdown"> ' .
423- '<li><a class="dropdown-item msg_read core_msg_control btn btn-sm btn-light text-black-50" href="#" data-action="read"> ' .$ output_mod ->trans ('Read ' ).'</a></li> ' .
424- '<li><a class="dropdown-item msg_unread core_msg_control btn btn-sm btn-light text-black-50" href="#" data-action="unread"> ' .$ output_mod ->trans ('Unread ' ).'</a></li> ' .
425- '<li><a class="dropdown-item msg_flag core_msg_control btn btn-sm btn-light text-black-50" href="#" data-action="flag"> ' .$ output_mod ->trans ('Flag ' ).'</a></li> ' .
426- '<li><a class="dropdown-item msg_unflag core_msg_control btn btn-sm btn-light text-black-50" href="#" data-action="unflag"> ' .$ output_mod ->trans ('Unflag ' ).'</a></li> ' .
427- '<li><a class="dropdown-item msg_delete core_msg_control btn btn-sm btn-light text-black-50" href="#" data-action="delete"> ' .$ output_mod ->trans ('Delete ' ).'</a></li> ' .
428- '<li><a class="dropdown-item msg_archive core_msg_control btn btn-sm btn-light text-black-50" href="#" data-action="archive"> ' .$ output_mod ->trans ('Archive ' ).'</a></li> ' .
429- '<li><a class="dropdown-item msg_junk core_msg_control btn btn-sm btn-light text-black-50" href="#" data-action="junk"> ' .$ output_mod ->trans ('Junk ' ).'</a></li> ' .
430- '</ul> ' .
431- '</div> ' .
432- '<a class="msg_read core_msg_control btn btn-sm btn-light no_mobile border text-black-50" href="#" data-action="read"> ' .$ output_mod ->trans ('Read ' ).'</a> ' .
433- '<a class="msg_unread core_msg_control btn btn-sm btn-light no_mobile border text-black-50" href="#" data-action="unread"> ' .$ output_mod ->trans ('Unread ' ).'</a> ' .
434- '<a class="msg_flag core_msg_control btn btn-sm btn-light no_mobile border text-black-50" href="#" data-action="flag"> ' .$ output_mod ->trans ('Flag ' ).'</a> ' .
435- '<a class="msg_unflag core_msg_control btn btn-sm btn-light no_mobile border text-black-50" href="#" data-action="unflag"> ' .$ output_mod ->trans ('Unflag ' ).'</a> ' .
436- '<a class="msg_delete core_msg_control btn btn-sm btn-light no_mobile border text-black-50" href="#" data-action="delete"> ' .$ output_mod ->trans ('Delete ' ).'</a> ' .
437- '<a class="msg_archive core_msg_control btn btn-sm btn-light no_mobile border text-black-50" href="#" data-action="archive"> ' .$ output_mod ->trans ('Archive ' ).'</a> ' .
438- '<a class="msg_junk core_msg_control btn btn-sm btn-light no_mobile border text-black-50" href="#" data-action="junk"> ' .$ output_mod ->trans ('Junk ' ).'</a> ' ;
433+ '<ul class="dropdown-menu" aria-labelledby="coreMsgControlDropdown"> ' ;
434+ foreach ($ controls as $ control ) {
435+ $ res .= '<li><a class="dropdown-item msg_ ' .$ control .' core_msg_control btn btn-sm btn-light text-black-50" href="#" data-action=" ' .$ control .'"> ' .$ output_mod ->trans (ucfirst ($ control )).'</a></li> ' ;
436+ }
437+ $ res .= '</ul> ' .
438+ '</div> ' ;
439+
440+ foreach ($ controls as $ control ) {
441+ $ res .= '<a class="msg_ ' .$ control .' core_msg_control btn btn-sm btn-light no_mobile border text-black-50" href="#" data-action=" ' .$ control .'"> ' .$ output_mod ->trans (ucfirst ($ control )).'</a> ' ;
442+ }
439443
440444 if ($ output_mod ->get ('msg_controls_extra ' )) {
441445 $ res .= $ output_mod ->get ('msg_controls_extra ' );
0 commit comments