diff --git a/app/assets/javascripts/sidebar/services/sidebar_service.js b/app/assets/javascripts/sidebar/services/sidebar_service.js index ace2a163adc365890c84bde85eec81b12217a7db..cea26acd101dc6809855d1d2a52ca195c1795933 100644 --- a/app/assets/javascripts/sidebar/services/sidebar_service.js +++ b/app/assets/javascripts/sidebar/services/sidebar_service.js @@ -22,7 +22,6 @@ export default class SidebarService { constructor(endpointMap) { if (!SidebarService.singleton) { this.endpoint = endpointMap.endpoint; - this.toggleSubscriptionEndpoint = endpointMap.toggleSubscriptionEndpoint; this.moveIssueEndpoint = endpointMap.moveIssueEndpoint; this.projectsAutocompleteEndpoint = endpointMap.projectsAutocompleteEndpoint; this.fullPath = endpointMap.fullPath; @@ -75,10 +74,6 @@ export default class SidebarService { }); } - toggleSubscription() { - return axios.post(this.toggleSubscriptionEndpoint); - } - moveIssue(moveToProjectId) { return axios.post(this.moveIssueEndpoint, { move_to_project_id: moveToProjectId, diff --git a/app/assets/javascripts/sidebar/sidebar_mediator.js b/app/assets/javascripts/sidebar/sidebar_mediator.js index 0a5e44a9b957259f3bfd0bce95a676b18def9c23..9144e3b08dbab1507d0b26f9322fb0e86f35b71c 100644 --- a/app/assets/javascripts/sidebar/sidebar_mediator.js +++ b/app/assets/javascripts/sidebar/sidebar_mediator.js @@ -17,7 +17,6 @@ export default class SidebarMediator { this.store = new Store(options); this.service = new Service({ endpoint: options.endpoint, - toggleSubscriptionEndpoint: options.toggleSubscriptionEndpoint, moveIssueEndpoint: options.moveIssueEndpoint, projectsAutocompleteEndpoint: options.projectsAutocompleteEndpoint, fullPath: options.fullPath, @@ -85,22 +84,6 @@ export default class SidebarMediator { this.store.setAssigneeData(data); this.store.setReviewerData(data); this.store.setTimeTrackingData(data); - this.store.setParticipantsData(data); - this.store.setSubscriptionsData(data); - } - - toggleSubscription() { - this.store.setFetchingState('subscriptions', true); - return this.service - .toggleSubscription() - .then(() => { - this.store.setSubscribedState(!this.store.subscribed); - this.store.setFetchingState('subscriptions', false); - }) - .catch((err) => { - this.store.setFetchingState('subscriptions', false); - throw err; - }); } fetchAutocompleteProjects(searchTerm) { diff --git a/app/assets/javascripts/sidebar/stores/sidebar_store.js b/app/assets/javascripts/sidebar/stores/sidebar_store.js index 3c108b06eabb5c6a005fff79b43d1ed37b5d9b70..94c54fc098028cb886834546abc6d116c36a5aba 100644 --- a/app/assets/javascripts/sidebar/stores/sidebar_store.js +++ b/app/assets/javascripts/sidebar/stores/sidebar_store.js @@ -22,8 +22,6 @@ export default class SidebarStore { this.isFetching = { assignees: true, reviewers: true, - participants: true, - subscriptions: true, }; this.isLoading = {}; this.autocompleteProjects = []; @@ -63,18 +61,6 @@ export default class SidebarStore { this.humanTotalTimeSpent = data.human_total_time_spent; } - setParticipantsData(data) { - this.isFetching.participants = false; - this.participants = data.participants || []; - } - - setSubscriptionsData(data) { - this.projectEmailsDisabled = data.project_emails_disabled || false; - this.subscribeDisabledDescription = data.subscribe_disabled_description; - this.isFetching.subscriptions = false; - this.subscribed = data.subscribed || false; - } - setFetchingState(key, value) { this.isFetching[key] = value; } diff --git a/app/serializers/issuable_sidebar_extras_entity.rb b/app/serializers/issuable_sidebar_extras_entity.rb index 77f2e34fa5d3b728f8dfcb7af2a111762e52b0e1..68c71cd5cf3f2a5af48d8e623db3806a3bb18678 100644 --- a/app/serializers/issuable_sidebar_extras_entity.rb +++ b/app/serializers/issuable_sidebar_extras_entity.rb @@ -3,23 +3,6 @@ class IssuableSidebarExtrasEntity < Grape::Entity include RequestAwareEntity include TimeTrackableEntity - include NotificationsHelper - - expose :participants, using: ::API::Entities::UserBasic do |issuable| - issuable.participants(request.current_user) - end - - expose :project_emails_disabled do |issuable| - issuable.project.emails_disabled? - end - - expose :subscribe_disabled_description do |issuable| - notification_description(:owner_disabled) - end - - expose :subscribed do |issuable| - issuable.subscribed?(request.current_user, issuable.project) - end expose :assignees, using: ::API::Entities::UserBasic end diff --git a/spec/frontend/sidebar/sidebar_mediator_spec.js b/spec/frontend/sidebar/sidebar_mediator_spec.js index 019ded870930e684dd66f02844d6b797cec589ab..cb84c142d558dc485116bfa9e3fbd590f0f0a7b0 100644 --- a/spec/frontend/sidebar/sidebar_mediator_spec.js +++ b/spec/frontend/sidebar/sidebar_mediator_spec.js @@ -63,8 +63,6 @@ describe('Sidebar mediator', () => { expect(mediator.store.assignees).toEqual(mockData.assignees); expect(mediator.store.humanTimeEstimate).toEqual(mockData.human_time_estimate); expect(mediator.store.humanTotalTimeSpent).toEqual(mockData.human_total_time_spent); - expect(mediator.store.participants).toEqual(mockData.participants); - expect(mediator.store.subscribed).toEqual(mockData.subscribed); expect(mediator.store.timeEstimate).toEqual(mockData.time_estimate); expect(mediator.store.totalTimeSpent).toEqual(mockData.total_time_spent); }); @@ -117,19 +115,4 @@ describe('Sidebar mediator', () => { urlSpy.mockRestore(); }); }); - - it('toggle subscription', () => { - mediator.store.setSubscribedState(false); - mock.onPost(mediatorMockData.toggleSubscriptionEndpoint).reply(200, {}); - const spy = jest - .spyOn(mediator.service, 'toggleSubscription') - .mockReturnValue(Promise.resolve()); - - return mediator.toggleSubscription().then(() => { - expect(spy).toHaveBeenCalled(); - expect(mediator.store.subscribed).toEqual(true); - - spy.mockRestore(); - }); - }); }); diff --git a/spec/frontend/sidebar/sidebar_store_spec.js b/spec/frontend/sidebar/sidebar_store_spec.js index 7b73dc868b72f1002a186c552e60a1408e3ea18f..3930dabfcfa39c8ae0150ded6f534c0edf1e6d06 100644 --- a/spec/frontend/sidebar/sidebar_store_spec.js +++ b/spec/frontend/sidebar/sidebar_store_spec.js @@ -16,17 +16,6 @@ const ANOTHER_ASSINEE = { avatar_url: 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon', }; -const PARTICIPANT = { - id: 1, - state: 'active', - username: 'marcene', - name: 'Allie Will', - web_url: 'foo.com', - avatar_url: 'gravatar.com/avatar/xxx', -}; - -const PARTICIPANT_LIST = [PARTICIPANT, { ...PARTICIPANT, id: 2 }, { ...PARTICIPANT, id: 3 }]; - describe('Sidebar store', () => { let testContext; @@ -113,28 +102,6 @@ describe('Sidebar store', () => { expect(testContext.store.changing).toBe(true); }); - it('sets participants data', () => { - expect(testContext.store.participants.length).toEqual(0); - - testContext.store.setParticipantsData({ - participants: PARTICIPANT_LIST, - }); - - expect(testContext.store.isFetching.participants).toEqual(false); - expect(testContext.store.participants.length).toEqual(PARTICIPANT_LIST.length); - }); - - it('sets subcriptions data', () => { - expect(testContext.store.subscribed).toEqual(null); - - testContext.store.setSubscriptionsData({ - subscribed: true, - }); - - expect(testContext.store.isFetching.subscriptions).toEqual(false); - expect(testContext.store.subscribed).toEqual(true); - }); - it('set assigned data', () => { const users = { assignees: UsersMockHelper.createNumberRandomUsers(3), @@ -147,11 +114,11 @@ describe('Sidebar store', () => { }); it('sets fetching state', () => { - expect(testContext.store.isFetching.participants).toEqual(true); + expect(testContext.store.isFetching.assignees).toEqual(true); - testContext.store.setFetchingState('participants', false); + testContext.store.setFetchingState('assignees', false); - expect(testContext.store.isFetching.participants).toEqual(false); + expect(testContext.store.isFetching.assignees).toEqual(false); }); it('sets loading state', () => { diff --git a/spec/serializers/issuable_sidebar_extras_entity_spec.rb b/spec/serializers/issuable_sidebar_extras_entity_spec.rb index f49b9acfd5d1009d7394b9bf694115dd13a2145d..80c135cdc2261bbe21261ca40d812a177375420a 100644 --- a/spec/serializers/issuable_sidebar_extras_entity_spec.rb +++ b/spec/serializers/issuable_sidebar_extras_entity_spec.rb @@ -10,11 +10,7 @@ subject { described_class.new(resource, request: request).as_json } - it 'have subscribe attributes' do - expect(subject).to include(:participants, - :project_emails_disabled, - :subscribe_disabled_description, - :subscribed, - :assignees) + it 'have assignee attribute' do + expect(subject).to include(:assignees) end end