## Description Make conversation unread counts always available at runtime by removing account feature checks from the API endpoint, unread-count listener, notifier, and ActionCable broadcast path. Update the dashboard to fetch sidebar unread counts for the active account without checking FEATURE_FLAGS.CONVERSATION_UNREAD_COUNTS, and remove the now-unused store clear action that only supported the disabled state. Keep the feature entry in config/features.yml to preserve flag bit order, but mark it enabled and deprecated so fresh installs default to the always-on behavior while feature-management UI hides it. Leave existing installation default rows untouched; no migration is included, so upgraded installs may still store the old flag value but runtime behavior no longer depends on it. Update specs around the new always-on contract and remove obsolete disabled-feature assertions. Fixes # CW-7237 ## Type of change Please delete options that are not relevant. - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality not to work as expected) - [ ] This change requires a documentation update ## How Has This Been Tested? Update specs around the new always-on contract and remove obsolete disabled-feature assertions. Ran specs locally for the changes. ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [ ] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules
43 lines
1.0 KiB
JavaScript
43 lines
1.0 KiB
JavaScript
import axios from 'axios';
|
|
import { actions } from '../../conversationUnreadCounts';
|
|
import types from '../../../mutation-types';
|
|
|
|
const commit = vi.fn();
|
|
global.axios = axios;
|
|
vi.mock('axios');
|
|
|
|
describe('#actions', () => {
|
|
beforeEach(() => {
|
|
commit.mockClear();
|
|
axios.get.mockReset();
|
|
});
|
|
|
|
describe('#get', () => {
|
|
it('commits unread counts when API is successful', async () => {
|
|
const payload = {
|
|
inboxes: { 1: '2' },
|
|
labels: { 3: 4 },
|
|
teams: { 5: 6 },
|
|
};
|
|
axios.get.mockResolvedValue({ data: { payload } });
|
|
|
|
await actions.get({ commit });
|
|
|
|
expect(axios.get).toHaveBeenCalledWith(
|
|
'/api/v1/conversations/unread_counts'
|
|
);
|
|
expect(commit.mock.calls).toEqual([
|
|
[types.SET_CONVERSATION_UNREAD_COUNTS, payload],
|
|
]);
|
|
});
|
|
|
|
it('does not commit when API fails', async () => {
|
|
axios.get.mockRejectedValue({ message: 'Incorrect header' });
|
|
|
|
await actions.get({ commit });
|
|
|
|
expect(commit).not.toHaveBeenCalled();
|
|
});
|
|
});
|
|
});
|