Show snapshot actions only for own snapshots

Resolve MS-536
This commit is contained in:
Ramon Wenger 2022-06-28 11:37:16 +02:00
parent 2c31fc60fe
commit e6f13151ff
3 changed files with 25 additions and 0 deletions

View File

@ -89,6 +89,14 @@ describe('Snapshot', () => {
shared: false,
creator: 'me',
},
{
id: 'U25hcHNob3ROb2RlOjU=',
title: 'Shared snapshot',
created: '2020-01-02',
mine: false,
shared: true,
creator: 'someone else',
},
],
},
},
@ -167,4 +175,18 @@ describe('Snapshot', () => {
cy.getByDataCy('modal-save-button').click();
cy.getByDataCy('snapshot-entry').should('have.length', 0);
});
it('Displays the Snapshot list correcly', () => {
cy.mockGraphqlOps(operations(true));
cy.visit('module/miteinander-reden/snapshots');
cy.getByDataCy('snapshot-entry').should('have.length', 1);
cy.getByDataCy('delete-snapshot-button').should('exist');
cy.getByDataCy('rename-snapshot-button').should('exist');
cy.getByDataCy('snapshot-link').should('have.text', 'Old Title');
cy.getByDataCy('team-snapshots-link').click();
cy.getByDataCy('snapshot-entry').should('have.length', 1);
cy.getByDataCy('snapshot-link').should('have.text', 'Shared snapshot');
cy.getByDataCy('delete-snapshot-button').should('not.exist');
cy.getByDataCy('rename-snapshot-button').should('not.exist');
});
});

View File

@ -18,6 +18,7 @@
<button
class="icon-button"
data-cy="delete-snapshot-button"
v-if="snapshot.mine"
@click="deleteSnapshot"
>
<trash-icon class="snapshot-list-item__icon" />
@ -25,6 +26,7 @@
<button
class="icon-button"
data-cy="rename-snapshot-button"
v-if="snapshot.mine"
@click="changeTitle"
>
<pen-icon class="snapshot-list-item__icon" />

View File

@ -13,6 +13,7 @@
<a
:class="{'snapshot-team-menu__link--active': selected === 'team'}"
class="snapshot-team-menu__link"
data-cy="team-snapshots-link"
@click="$emit('select', 'team')"
>Team Snapshots</a>
</li>