Skip to content

Conversation

@vitormattos
Copy link
Contributor

@vitormattos vitormattos commented Nov 2, 2021

  • API endpoints to
    • block user POST /settings/block-user
      • create table to save block relation
        blocked_users
        actor_type
        actor_id
        blocked_type
        blocked_id
        datetime
      • integration tests flow to use on GET and DELETE endpoints
      • unit tests flow to use on GET and DELETE endpoints
    • list all users blocked GET /settings/block-user
    • unblock user DELETE /settings/block-user
  • block user 2 to send private message to user 1 if user 1 blocked user 2
  • user 1 don't receive notifications on groups with user 2 if user 1 blocked user 2 and user 2 user @all or @user1
  • cover all with integration and unit tests

close #2513

@vitormattos vitormattos added 2. developing enhancement feature: api 🛠️ OCS API for conversations, chats and participants php labels Nov 2, 2021
@vitormattos vitormattos added this to the 💖 Next Major (23) milestone Nov 2, 2021
@vitormattos vitormattos self-assigned this Nov 2, 2021
@vitormattos vitormattos changed the title Implement integration tests and skeleton to new endpoints Blocking users as a user Nov 3, 2021
@vitormattos vitormattos changed the title Blocking users as a user API changes: Blocking users as a user Nov 3, 2021
@vitormattos vitormattos force-pushed the feature/api-blocking-users branch 2 times, most recently from c898c62 to 6464ff3 Compare November 3, 2021 15:44
Rename endpoint
Save block on database

Signed-off-by: Vitor Mattos <[email protected]>
@vitormattos vitormattos force-pushed the feature/api-blocking-users branch 2 times, most recently from 421c000 to 25ff87d Compare November 4, 2021 01:46
Comment on lines 61 to 70
$qb = $this->db->getQueryBuilder();

$qb->delete($this->tableName)
->andWhere(
$qb->expr()->eq('actor_type', $qb->createNamedParameter($entity->getActorType(), Types::STRING)),
$qb->expr()->eq('actor_id', $qb->createNamedParameter($entity->getActorId(), Types::STRING)),
$qb->expr()->eq('blocked_type', $qb->createNamedParameter($entity->getBlockedType(), Types::STRING)),
$qb->expr()->eq('blocked_id', $qb->createNamedParameter($entity->getBlockedId(), Types::STRING))
);
$qb->executeStatement();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? We just always delete based on Id and done?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't implemented method to delete by ID, only implemented method to delete using blocked id and blocked type.
Do you think it will be necessary to delete by Id and by blocked id and blocked type?

Teardown to clean integration tests

Signed-off-by: Vitor Mattos <[email protected]>
@vitormattos vitormattos force-pushed the feature/api-blocking-users branch from 25ff87d to 5eec1ab Compare November 4, 2021 11:26
fix method typing
return all data on list blocked endpoint

Signed-off-by: Vitor Mattos <[email protected]>
Removed cache implementation

Signed-off-by: Vitor Mattos <[email protected]>
@vitormattos vitormattos deleted the feature/api-blocking-users branch January 21, 2022 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing enhancement feature: api 🛠️ OCS API for conversations, chats and participants php

Projects

None yet

Development

Successfully merging this pull request may close these issues.

👤🚫⚙️ Blocking users as a user

3 participants