Skip to content

Commit

Permalink
Fix case where you assign yourself your own todo (#203)
Browse files Browse the repository at this point in the history
* fix case where you assign yourself your own todo

* fix indentation

* fix playwright test setup

---------

Co-authored-by: ayusht2810 <[email protected]>
  • Loading branch information
mickmister and ayusht2810 authored Apr 16, 2024
1 parent e3f5939 commit d7932b3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions e2e/playwright/tests/test.list.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

import {test} from '@playwright/test';
import core from './todo_plugin.spec';

import '../support/init_test';

test.describe(core.connected);
core.connected();
6 changes: 2 additions & 4 deletions e2e/playwright/tests/todo_plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@ import {fillMessage, getTodoBotDMPageURL} from 'support/utils';
export default {
connected: () => {
test.describe('available commands', () => {
test('with just the main command', async ({pages, page, pw}) => {
test('with just the main command', async ({page, pw}) => {

const {adminClient, adminUser} = await pw.getAdminClient();
if (adminUser === null) {
throw new Error('can not get adminUser');
}
const dmURL = await getTodoBotDMPageURL(adminClient, '', adminUser.id);
await page.goto(dmURL, {waitUntil: 'load'});

const c = new pages.ChannelsPage(page);
const slash = new SlashCommandSuggestions(page.locator('#suggestionList'));

// # Run incomplete command to trigger help
Expand All @@ -39,4 +38,3 @@ export default {
});
},
};

6 changes: 4 additions & 2 deletions server/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,10 @@ func (l *listManager) ChangeAssignment(issueID string, userID string, sendTo str
return issue.Message, ir.ForeignUserID, nil
}

if err := l.store.RemoveReference(userID, issueID, list); err != nil {
return "", "", err
if userID != sendTo {
if err := l.store.RemoveReference(userID, issueID, list); err != nil {
return "", "", err
}
}

receiverIssue := newIssue(issue.Message, issue.Description, issue.PostID)
Expand Down

0 comments on commit d7932b3

Please sign in to comment.