Skip to content

Commit 4e275f1

Browse files
author
Bizley
authored
Merge pull request #9 from yii-podium/feature/disconnect-members
Removed unfriend and unignore methods in favor of disconnect method
2 parents 9c3b3c3 + fac2a61 commit 4e275f1

File tree

13 files changed

+128
-627
lines changed

13 files changed

+128
-627
lines changed

docs/en/account.md

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ component's ID or configuration array that can be resolved as the above. Default
3232
- [createForum](#createforum)
3333
- [createPost](#createpost)
3434
- [createThread](#createthread)
35+
- [disconnectMember](#disconnectmember)
3536
- [edit](#edit)
3637
- [getMembership](#getmembership)
3738
- [getPodium](#getpodium)
@@ -48,8 +49,6 @@ component's ID or configuration array that can be resolved as the above. Default
4849
- [thumbDownPost](#thumbdownpost)
4950
- [thumbResetPost](#thumbresetpost)
5051
- [thumbUpPost](#thumbuppost)
51-
- [unfriendMember](#unfriendmember)
52-
- [unignoreMember](#unignoremember)
5352
- [unsubscribeThread](#unsubscribethread)
5453
- [votePoll](#votepoll)
5554

@@ -116,6 +115,16 @@ Creates a thread under the parent forum as the current user. See [create](thread
116115

117116
---
118117

118+
### disconnectMember
119+
120+
```
121+
disconnectMember(Podium\Api\Interfaces\MemberRepositoryInterface $target): Podium\Api\PodiumResponse
122+
```
123+
124+
Disconnects the target member from the current user. See [disconnect](member.md#disconnect).
125+
126+
---
127+
119128
### edit
120129

121130
```
@@ -280,26 +289,6 @@ Gives the post a thumb up from the current user. See [thumbUp](post.md#thumbup).
280289

281290
---
282291

283-
### unfriendMember
284-
285-
```
286-
unfriendMember(Podium\Api\Interfaces\MemberRepositoryInterface $target): Podium\Api\PodiumResponse
287-
```
288-
289-
Unfriends the target member as the current user. See [unfriend](member.md#unfriend).
290-
291-
---
292-
293-
### unignoreMember
294-
295-
```
296-
unignoreMember(Podium\Api\Interfaces\MemberRepositoryInterface $target): Podium\Api\PodiumResponse
297-
```
298-
299-
Unignores the target member as the current user. See [unignore](member.md#unignore).
300-
301-
---
302-
303292
### unsubscribeThread
304293

305294
```

docs/en/member.md

Lines changed: 22 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ or component's ID or configuration array that can be resolved as the above. Defa
4646

4747
- [ban](#ban)
4848
- [befriend](#befriend)
49+
- [disconnect](#disconnect)
4950
- [edit](#edit)
5051
- [getAcquaintance](#getacquaintance)
5152
- [getAcquaintanceRepository](#getacquaintancerepository)
@@ -57,8 +58,6 @@ or component's ID or configuration array that can be resolved as the above. Defa
5758
- [register](#register)
5859
- [remove](#remove)
5960
- [unban](#unban)
60-
- [unfriend](#unfriend)
61-
- [unignore](#unignore)
6261

6362
### ban
6463

@@ -84,8 +83,8 @@ befriend(
8483
): Podium\Api\PodiumResponse
8584
```
8685

87-
Befriends the target as the member if the target is not befriended already (can be ignored though). See also [unfriend](#unfriend),
88-
[ignore](#ignore), and [unignore](#unignore).
86+
Befriends the target as the member if the target is not befriended already (can be ignored though). See also [ignore](#ignore)
87+
and [disconnect](#disconnect).
8988

9089
#### Events
9190

@@ -94,6 +93,24 @@ Befriends the target as the member if the target is not befriended already (can
9493

9594
---
9695

96+
### disconnect
97+
98+
```
99+
disconnect(
100+
Podium\Api\Interfaces\MemberRepositoryInterface $member,
101+
Podium\Api\Interfaces\MemberRepositoryInterface $target
102+
): Podium\Api\PodiumResponse
103+
```
104+
105+
Disconnects the target from the member if there is a relationship between them. See also [befriend](#befriend) and [ignore](#ignore).
106+
107+
#### Events
108+
109+
- `Podium\Api\Services\Member\MemberAcquaintance::EVENT_BEFORE_DISCONNECTING`
110+
- `Podium\Api\Services\Member\MemberAcquaintance::EVENT_AFTER_DISCONNECTING`
111+
112+
---
113+
97114
### edit
98115

99116
```
@@ -180,7 +197,7 @@ ignore(
180197
```
181198

182199
Ignores the target as the member if the target is not ignored already (can be befriended though). Member cannot send
183-
messages to the member that ignores him. See also [befriend](#unfriend), [unfriend](#unfriend), and [unignore](#unignore).
200+
messages to the member that ignores him. See also [befriend](#unfriend) and [disconnect](#disconnect).
184201

185202
#### Events
186203

@@ -234,42 +251,4 @@ Unbans the member. See also [ban](#ban).
234251

235252
---
236253

237-
### unfriend
238-
239-
```
240-
unfriend(
241-
Podium\Api\Interfaces\MemberRepositoryInterface $member,
242-
Podium\Api\Interfaces\MemberRepositoryInterface $target
243-
): Podium\Api\PodiumResponse
244-
```
245-
246-
Unfriends the target as the member if the target is befriended. See also [befriend](#befriend), [ignore](#ignore),
247-
and [unignore](#unignore).
248-
249-
#### Events
250-
251-
- `Podium\Api\Services\Member\MemberAcquaintance::EVENT_BEFORE_UNFRIENDING`
252-
- `Podium\Api\Services\Member\MemberAcquaintance::EVENT_AFTER_UNFRIENDING`
253-
254-
---
255-
256-
### unignore
257-
258-
```
259-
unignore(
260-
Podium\Api\Interfaces\MemberRepositoryInterface $member,
261-
Podium\Api\Interfaces\MemberRepositoryInterface $target
262-
): Podium\Api\PodiumResponse
263-
```
264-
265-
Unignores the target as the member if the target is ignored. See also [befriend](#befriend), [unfriend](#unfriend),
266-
and [ignore](#ignore).
267-
268-
#### Events
269-
270-
- `Podium\Api\Services\Member\MemberAcquaintance::EVENT_BEFORE_UNIGNORING`
271-
- `Podium\Api\Services\Member\MemberAcquaintance::EVENT_AFTER_UNIGNORING`
272-
273-
---
274-
275254
[<<< Index](../README.md) | [Next >>> Message](message.md)

src/Components/Account.php

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -257,17 +257,6 @@ public function befriendMember(MemberRepositoryInterface $target): PodiumRespons
257257
return $memberComponent->befriend($this->getMembership(), $target);
258258
}
259259

260-
/**
261-
* @throws InvalidConfigException|NoMembershipException
262-
*/
263-
public function unfriendMember(MemberRepositoryInterface $target): PodiumResponse
264-
{
265-
/** @var MemberInterface $memberComponent */
266-
$memberComponent = $this->getPodium()->getMember();
267-
268-
return $memberComponent->unfriend($this->getMembership(), $target);
269-
}
270-
271260
/**
272261
* @throws InvalidConfigException|NoMembershipException
273262
*/
@@ -282,12 +271,12 @@ public function ignoreMember(MemberRepositoryInterface $target): PodiumResponse
282271
/**
283272
* @throws InvalidConfigException|NoMembershipException
284273
*/
285-
public function unignoreMember(MemberRepositoryInterface $target): PodiumResponse
274+
public function disconnectMember(MemberRepositoryInterface $target): PodiumResponse
286275
{
287276
/** @var MemberInterface $memberComponent */
288277
$memberComponent = $this->getPodium()->getMember();
289278

290-
return $memberComponent->unignore($this->getMembership(), $target);
279+
return $memberComponent->disconnect($this->getMembership(), $target);
291280
}
292281

293282
/**

src/Components/Member.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,6 @@ public function befriend(MemberRepositoryInterface $member, MemberRepositoryInte
143143
return $this->getAcquaintance()->befriend($this->getAcquaintanceRepository(), $member, $target);
144144
}
145145

146-
/**
147-
* @throws InvalidConfigException
148-
*/
149-
public function unfriend(MemberRepositoryInterface $member, MemberRepositoryInterface $target): PodiumResponse
150-
{
151-
return $this->getAcquaintance()->unfriend($this->getAcquaintanceRepository(), $member, $target);
152-
}
153-
154146
/**
155147
* @throws InvalidConfigException
156148
*/
@@ -162,9 +154,9 @@ public function ignore(MemberRepositoryInterface $member, MemberRepositoryInterf
162154
/**
163155
* @throws InvalidConfigException
164156
*/
165-
public function unignore(MemberRepositoryInterface $member, MemberRepositoryInterface $target): PodiumResponse
157+
public function disconnect(MemberRepositoryInterface $member, MemberRepositoryInterface $target): PodiumResponse
166158
{
167-
return $this->getAcquaintance()->unignore($this->getAcquaintanceRepository(), $member, $target);
159+
return $this->getAcquaintance()->disconnect($this->getAcquaintanceRepository(), $member, $target);
168160
}
169161

170162
private ?BanisherInterface $banisher = null;

src/Events/AcquaintanceEvent.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,15 @@ class AcquaintanceEvent extends Event
1414
*/
1515
public bool $canBeFriends = true;
1616

17-
/**
18-
* @var bool whether member can unfriend target
19-
*/
20-
public bool $canUnfriend = true;
21-
2217
/**
2318
* @var bool whether member can ignore target
2419
*/
2520
public bool $canIgnore = true;
2621

2722
/**
28-
* @var bool whether member can unignore target
23+
* @var bool whether member can disconnect target
2924
*/
30-
public bool $canUnignore = true;
25+
public bool $canDisconnect = true;
3126

3227
public ?AcquaintanceRepositoryInterface $repository = null;
3328
}

src/Interfaces/AccountInterface.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,20 +88,15 @@ public function edit(array $data = []): PodiumResponse;
8888
*/
8989
public function befriendMember(MemberRepositoryInterface $target): PodiumResponse;
9090

91-
/**
92-
* Unfriends the target member as the current user.
93-
*/
94-
public function unfriendMember(MemberRepositoryInterface $target): PodiumResponse;
95-
9691
/**
9792
* Ignores the target member as the current user.
9893
*/
9994
public function ignoreMember(MemberRepositoryInterface $target): PodiumResponse;
10095

10196
/**
102-
* Unignores the target member as the current user.
97+
* Disconnects the target member from the current user.
10398
*/
104-
public function unignoreMember(MemberRepositoryInterface $target): PodiumResponse;
99+
public function disconnectMember(MemberRepositoryInterface $target): PodiumResponse;
105100

106101
/**
107102
* Sends a message to the receiver as the current user.

src/Interfaces/AcquaintanceInterface.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,6 @@ public function befriend(
1717
MemberRepositoryInterface $target
1818
): PodiumResponse;
1919

20-
/**
21-
* Handles unfriending process.
22-
*/
23-
public function unfriend(
24-
AcquaintanceRepositoryInterface $acquaintance,
25-
MemberRepositoryInterface $member,
26-
MemberRepositoryInterface $target
27-
): PodiumResponse;
28-
2920
/**
3021
* Handles ignoring process.
3122
*/
@@ -36,9 +27,9 @@ public function ignore(
3627
): PodiumResponse;
3728

3829
/**
39-
* Handles unignoring process.
30+
* Handles disconnecting process.
4031
*/
41-
public function unignore(
32+
public function disconnect(
4233
AcquaintanceRepositoryInterface $acquaintance,
4334
MemberRepositoryInterface $member,
4435
MemberRepositoryInterface $target

src/Interfaces/MemberInterface.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,15 @@ public function edit(MemberRepositoryInterface $member, array $data = []): Podiu
4040
*/
4141
public function befriend(MemberRepositoryInterface $member, MemberRepositoryInterface $target): PodiumResponse;
4242

43-
/**
44-
* Unfriends the target as the member.
45-
*/
46-
public function unfriend(MemberRepositoryInterface $member, MemberRepositoryInterface $target): PodiumResponse;
47-
4843
/**
4944
* Ignores the target as the member.
5045
*/
5146
public function ignore(MemberRepositoryInterface $member, MemberRepositoryInterface $target): PodiumResponse;
5247

5348
/**
54-
* Unignores the target as the member.
49+
* Disconnects the target from the member.
5550
*/
56-
public function unignore(MemberRepositoryInterface $member, MemberRepositoryInterface $target): PodiumResponse;
51+
public function disconnect(MemberRepositoryInterface $member, MemberRepositoryInterface $target): PodiumResponse;
5752

5853
/**
5954
* Bans the member.

0 commit comments

Comments
 (0)