I don't like that we use splice and unshift here.

Can we try to just use push ? Something like
```javascript
var params = {
  items: [],
  type: 'action',
  header: ...
};

if (!...classList.contains('invalid-empty-content')) {
  params.items.push({
    // forward
  });
}

params.items.push(
  {
    // view report
  },
  {
    // delete
  }
);

if (...classList.contains('error')) {
  params.items.push({
    // resend message
  });
}

params.items.push({
   // cancel
});
```