-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathActivityService.php
More file actions
384 lines (362 loc) · 22.4 KB
/
Copy pathActivityService.php
File metadata and controls
384 lines (362 loc) · 22.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2021 Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Polls\Service;
use OCA\Polls\AppConstants;
use OCA\Polls\Db\Share;
use OCA\Polls\Event\BaseEvent;
use OCA\Polls\Event\CommentEvent;
use OCA\Polls\Event\OptionEvent;
use OCA\Polls\Event\PollEvent;
use OCA\Polls\Event\ShareEvent;
use OCA\Polls\Event\VoteEvent;
use OCA\Polls\UserSession;
use OCP\Activity\IEvent as ActivityEvent;
use OCP\Activity\IManager as ActivityManager;
use OCP\IL10N;
use OCP\L10N\IFactory;
class ActivityService {
protected const APP_ID = AppConstants::APP_ID;
private ActivityEvent $activityEvent;
private BaseEvent $baseEvent;
private string $shareType = '';
private bool $userIsActor = true;
private const FIRST_PERSON_FULL = 'firstFull';
private const THIRD_PERSON_FULL = 'thirdFull';
private const FIRST_PERSON_FILTERED = 'firstFiltered';
private const THIRD_PERSON_FILTERED = 'thirdFiltered';
/** @psalm-suppress PossiblyUnusedMethod */
public function __construct(
private ActivityManager $activityManager,
private IL10N $l10n,
private IFactory $transFactory,
private UserSession $userSession,
) {
}
public function getActivityMessage(ActivityEvent $activityEvent, string $language, bool $filtered = false): string {
$this->activityEvent = $activityEvent;
$this->l10n = $this->transFactory->get($this->activityEvent->getApp(), $language);
try {
$this->userIsActor = $this->activityEvent->getAuthor() === $this->userSession->getCurrentUserId();
} catch (\Exception $e) {
$this->userIsActor = false;
}
$parameters = $this->activityEvent->getSubjectParameters();
$this->shareType = $parameters['shareType']['name'] ?? '';
$messages = $this->getMatchedMessages();
if ($filtered) {
return $this->userIsActor ? $messages[self::FIRST_PERSON_FILTERED] : $messages[self::THIRD_PERSON_FILTERED];
}
return $this->userIsActor ? $messages[self::FIRST_PERSON_FULL] : $messages[self::THIRD_PERSON_FULL];
}
public function addActivity(BaseEvent $baseEvent): void {
$this->baseEvent = $baseEvent;
$this->createActivityEvent();
$this->publishActivityEvent();
}
private function createActivityEvent(): void {
$this->activityEvent = $this->activityManager->generateEvent();
$this->activityEvent->setApp(AppConstants::APP_ID)
->setType($this->baseEvent->getActivityType() ?? '')
->setAuthor($this->baseEvent->getActor())
->setObject($this->baseEvent->getActivityObjectType() ?? '', $this->baseEvent->getActivityObjectId())
->setSubject($this->baseEvent->getActivityType() ?? '', $this->baseEvent->getActivitySubjectParams())
->setTimestamp(time());
}
private function publishActivityEvent(): void {
$this->activityEvent->setAffectedUser($this->baseEvent->getActor());
$this->activityManager->publish($this->activityEvent);
// add additional event for poll owner if not actor
if ($this->baseEvent->getActor() !== $this->baseEvent->getPollOwner()) {
$this->activityEvent->setAffectedUser($this->baseEvent->getPollOwner());
$this->activityManager->publish($this->activityEvent);
}
}
private function getMatchedMessages(): array {
return match ($this->activityEvent->getType()) {
CommentEvent::ADD => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have commented on poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has commented on poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have commented'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has commented'),
],
CommentEvent::DELETE => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have deleted a comment from poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has deleted a comment from poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have deleted a comment'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has deleted a comment'),
],
CommentEvent::RESTORE => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have restored a comment from poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has restored a comment from poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have restored a comment'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has restored a comment'),
],
OptionEvent::ADD => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have added an option to poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has added an option to poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have added an option'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has added an option'),
],
OptionEvent::UPDATE => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have changed an option of poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has changed an option of poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have changed an option'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has changed an option'),
],
OptionEvent::CONFIRM => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have confirmed option {optionTitle} of poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has confirmed option {optionTitle} of poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have confirmed option {optionTitle}'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has confirmed option {optionTitle}'),
],
OptionEvent::UNCONFIRM => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have unconfirmed option {optionTitle} of poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has unconfirmed option {optionTitle} of poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have unconfirmed option {optionTitle}'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has unconfirmed option {optionTitle}'),
],
OptionEvent::DELETE => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have deleted option {optionTitle} from poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has deleted option {optionTitle} from poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have deleted option {optionTitle}'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has deleted option {optionTitle}'),
],
OptionEvent::RESTORE => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have restored option {optionTitle} from poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has restored option {optionTitle} from poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have restored option {optionTitle}'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has restored option {optionTitle}'),
],
PollEvent::ADD => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have added poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has added poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have created this poll'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has created this poll'),
],
PollEvent::UPDATE => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have changed the configuration of poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has changed the configuration of poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have changed the configuration'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has changed the configuration'),
],
PollEvent::DELETE => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have archived poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has archived poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have archived this poll'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has archived this poll'),
],
PollEvent::RESTORE => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have restored poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has restored poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have restored this poll'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has restored this poll'),
],
PollEvent::EXPIRE => [
self::FIRST_PERSON_FULL => $this->l10n->t('Poll {pollTitle} has been closed'),
self::THIRD_PERSON_FULL => $this->l10n->t('Poll {pollTitle} has been closed'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('This poll has been closed'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('This poll has been closed'),
],
PollEvent::CLOSE => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have closed the poll "{pollTitle}"'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has closed the poll "{pollTitle}"'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have closed this poll'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has closed this poll'),
],
PollEvent::REOPEN => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have reopened the poll "{pollTitle}"'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has reopened the poll "{pollTitle}"'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have reopened this poll'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has reopened this poll'),
],
PollEvent::OWNER_CHANGE => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have changed the owner of poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has changed the owner of poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have changed the poll owner'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has changed the poll owner'),
],
PollEvent::OPTION_REORDER => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have reordered the options of poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has reordered the options of poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have reordered the options'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has reordered the options'),
],
ShareEvent::CHANGE_EMAIL => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have changed your email address'),
self::THIRD_PERSON_FULL => $this->l10n->t('{sharee} has changed the email address'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have changed your email address'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('Email address of {sharee} has been changed'),
],
ShareEvent::CHANGE_DISPLAY_NAME => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have changed your name'),
self::THIRD_PERSON_FULL => $this->l10n->t('{sharee} has changed the name'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have changed your name'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('Display name of {sharee} has been changed'),
],
ShareEvent::CHANGE_LABEL => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have changed the share label'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have changed the share label'),
],
ShareEvent::CHANGE_TYPE => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have changed the share type'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has changed the share type'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have changed the share type'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has changed the share type'),
],
ShareEvent::CHANGE_REG_CONSTR => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have changed the registration constraints for the public share labeled {sharee}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has changed the registration constraints for the public share labeled {sharee}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have changed the registration constraints for the public share labeled {sharee}'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has changed the registration constraints for the public share labeled {sharee}'),
],
ShareEvent::REGISTRATION => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have registered to poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{sharee} registered to poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have registered'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{sharee} has registered'),
],
VoteEvent::SET => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have voted in poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has voted in poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have voted'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has voted'),
],
VoteEvent::DELETED_ORPHANED => [
self::FIRST_PERSON_FULL => $this->l10n->t('One or more orphaned votes heve been deleted from {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has deleted your orphaned polls from poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('Orphaned votes deleted'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} deleted orphaned votes'),
],
ShareEvent::LOCKED => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have locked the share of {sharee}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has locked the share of {sharee}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have locked the share of {sharee}'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has locked the share of {sharee}'),
],
ShareEvent::UNLOCKED => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have unlocked the share of {sharee}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has unlocked the share of {sharee}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have unlocked the share of {sharee}'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has unlocked the share of {sharee}'),
],
ShareEvent::ADD => match ($this->shareType) {
Share::TYPE_PUBLIC => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have added a public share to poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has added a public share to poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have added a public share'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has added a public share'),
],
Share::TYPE_GROUP => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have shared poll {pollTitle} with group {sharee}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has shared poll {pollTitle} with group {sharee}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have shared this poll with group {sharee}'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has shared this poll with group {sharee}'),
],
Share::TYPE_CIRCLE => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have shared poll {pollTitle} with circle {sharee}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has shared poll {pollTitle} with circle {sharee}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have shared this poll with circle {sharee}'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has shared this poll with circle {sharee}'),
],
Share::TYPE_CONTACTGROUP => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have shared poll {pollTitle} with contact group {sharee}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has shared poll {pollTitle} with contact group {sharee}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have shared this poll with contact group {sharee}'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has shared this poll with contact group {sharee}'),
],
default => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have shared poll {pollTitle} with {sharee}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has shared poll {pollTitle} with {sharee}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have shared this poll with {sharee}'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has shared this poll with {sharee}'),
],
},
ShareEvent::DELETE => match ($this->shareType) {
Share::TYPE_USER, Share::TYPE_EMAIL, Share::TYPE_CONTACT, Share::TYPE_EXTERNAL => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have deleted the share for {sharee} from poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has deleted the share for {sharee} from poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have deleted share of {sharee}'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has deleted a share'),
],
Share::TYPE_PUBLIC => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have deleted a public share from poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has deleted a public share from poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have deleted a public share'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has deleted a public share'),
],
Share::TYPE_GROUP => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have deleted the share for group {sharee} from poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has deleted the share for group {sharee} from poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have deleted the share for group {sharee}'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has deleted the share for group {sharee}'),
],
Share::TYPE_CIRCLE => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have deleted the share for circle {sharee} from poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has deleted the share for circle {sharee} from poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have deleted the share for circle {sharee}'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has deleted the share for circle {sharee}'),
],
Share::TYPE_CONTACTGROUP => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have deleted the share for contact group {sharee} from poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has deleted the share for contact group {sharee} from poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have deleted the share for contact group {sharee}'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has deleted the share for contact group {sharee}'),
],
default => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have deleted a share from poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has deleted a share from poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have deleted share of {sharee}'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has deleted a share'),
],
},
ShareEvent::RESTORE => match ($this->shareType) {
Share::TYPE_USER, Share::TYPE_EMAIL, Share::TYPE_CONTACT, Share::TYPE_EXTERNAL => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have restored the share for {sharee} from poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has restored the share for {sharee} from poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have restored share of {sharee}'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has restored a share'),
],
Share::TYPE_PUBLIC => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have restored a public share from poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has restored a public share from poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have restored a public share'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has restored a public share'),
],
Share::TYPE_GROUP => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have restored the share for group {sharee} from poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has restored the share for group {sharee} from poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have restored the share for group {sharee}'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has restored the share for group {sharee}'),
],
Share::TYPE_CIRCLE => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have restored the share for circle {sharee} from poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has restored the share for circle {sharee} from poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have restored the share for circle {sharee}'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has restored the share for circle {sharee}'),
],
Share::TYPE_CONTACTGROUP => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have restored the share for contact group {sharee} from poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has restored the share for contact group {sharee} from poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have restored the share for contact group {sharee}'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has restored the share for contact group {sharee}'),
],
default => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have restored a share from poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has restored a share from poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have restored share of {sharee}'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has restored a share'),
],
},
default => [
self::FIRST_PERSON_FULL => $this->l10n->t('You have done something indescribable with poll {pollTitle}'),
self::THIRD_PERSON_FULL => $this->l10n->t('{actor} has done something indescribable with poll {pollTitle}'),
self::FIRST_PERSON_FILTERED => $this->l10n->t('You have done something indescribable with this poll'),
self::THIRD_PERSON_FILTERED => $this->l10n->t('{actor} has done something indescribable with this poll'),
],
};
}
}