]> git.mxchange.org Git - friendica.git/blob - static/dbview.config.php
Merge pull request #13288 from MrPetovan/task/user-server-block
[friendica.git] / static / dbview.config.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2010-2023, the Friendica project
4  *
5  * @license GNU AGPL version 3 or any later version
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU Affero General Public License for more details.
16  *
17  * You should have received a copy of the GNU Affero General Public License
18  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19  *
20  * Main view structure configuration file.
21  *
22  * Here are described all the view Friendica needs to work.
23  *
24  * Syntax (braces indicate optionale values):
25  * "<view name>" => [
26  *      "fields" => [
27  *              "<field name>" => ["table", "field"],
28  *              "<field name>" => "SQL expression",
29  *              ...
30  *      ],
31  *      "query" => "FROM `table` INNER JOIN `other-table` ..."
32  *      ],
33  * ],
34  *
35  * If you need to make any change, make sure to increment the DB_UPDATE_VERSION constant value in dbstructure.config.php.
36  *
37  */
38
39  return [
40         "application-view" => [
41                 "fields" => [
42                         "id" => ["application", "id"],
43                         "uid" => ["application-token", "uid"],
44                         "name" => ["application", "name"],
45                         "redirect_uri" => ["application", "redirect_uri"],
46                         "website" => ["application", "website"],
47                         "client_id" => ["application", "client_id"],
48                         "client_secret" => ["application", "client_secret"],
49                         "code" => ["application-token", "code"],
50                         "access_token" => ["application-token", "access_token"],
51                         "created_at" => ["application-token", "created_at"],
52                         "scopes" => ["application-token", "scopes"],
53                         "read" => ["application-token", "read"],
54                         "write" => ["application-token", "write"],
55                         "follow" => ["application-token", "follow"],
56                         "push" => ["application-token", "push"],
57                 ],
58                 "query" => "FROM `application-token`
59                         INNER JOIN `application` ON `application-token`.`application-id` = `application`.`id`"
60         ],
61         "circle-member-view" => [
62                 "fields" => [
63                         "id" => ["group_member", "id"],
64                         "uid" => ["group", "uid"],
65                         "contact-id" => ["group_member", "contact-id"],
66                         "contact-uri-id" => ["contact", "uri-id"],
67                         "contact-link" => ["contact", "url"],
68                         "contact-addr" => ["contact", "addr"],
69                         "contact-name" => ["contact", "name"],
70                         "contact-nick" => ["contact", "nick"],
71                         "contact-avatar" => ["contact", "thumb"],
72                         "contact-network" => ["contact", "network"],
73                         "contact-blocked" => ["contact", "blocked"],
74                         "contact-hidden" => ["contact", "hidden"],
75                         "contact-readonly" => ["contact", "readonly"],
76                         "contact-archive" => ["contact", "archive"],
77                         "contact-pending" => ["contact", "pending"],
78                         "contact-self" => ["contact", "self"],
79                         "contact-rel" => ["contact", "rel"],
80                         "contact-contact-type" => ["contact", "contact-type"],
81                         "circle-id" => ["group_member", "gid"],
82                         "circle-visible" => ["group", "visible"],
83                         "circle-deleted" => ["group", "deleted"],
84                         "circle-name" => ["group", "name"],
85                 ],
86                 "query" => "FROM `group_member`
87                         INNER JOIN `contact` ON `group_member`.`contact-id` = `contact`.`id`
88                         INNER JOIN `group` ON `group_member`.`gid` = `group`.`id`"
89         ],
90         "post-user-view" => [
91                 "fields" => [
92                         "id" => ["post-user", "id"],
93                         "post-user-id" => ["post-user", "id"],
94                         "uid" => ["post-user", "uid"],
95                         "parent" => ["post-thread-user", "post-user-id"],
96                         "uri" => ["item-uri", "uri"],
97                         "uri-id" => ["post-user", "uri-id"],
98                         "parent-uri" => ["parent-item-uri", "uri"],
99                         "parent-uri-id" => ["post-user", "parent-uri-id"],
100                         "thr-parent" => ["thr-parent-item-uri", "uri"],
101                         "thr-parent-id" => ["post-user", "thr-parent-id"],
102                         "conversation" => ["conversation-item-uri", "uri"],
103                         "conversation-id" => ["post-thread-user", "conversation-id"],
104                         "quote-uri" => ["quote-item-uri", "uri"],
105                         "quote-uri-id" => ["post-content", "quote-uri-id"],
106                         "guid" => ["item-uri", "guid"],
107                         "wall" => ["post-user", "wall"],
108                         "gravity" => ["post-user", "gravity"],
109                         "extid" => ["external-item-uri", "uri"],
110                         "external-id" => ["post-user", "external-id"],
111                         "created" => ["post-user", "created"],
112                         "edited" => ["post-user", "edited"],
113                         "commented" => ["post-thread-user", "commented"],
114                         "received" => ["post-user", "received"],
115                         "changed" => ["post-thread-user", "changed"],
116                         "post-type" => ["post-user", "post-type"],
117                         "post-reason" => ["post-user", "post-reason"],
118                         "private" => ["post-user", "private"],
119                         "pubmail" => ["post-thread-user", "pubmail"],
120                         "visible" => ["post-user", "visible"],
121                         "starred" => ["post-thread-user", "starred"],
122                         "unseen" => ["post-user", "unseen"],
123                         "deleted" => ["post-user", "deleted"],
124                         "origin" => ["post-user", "origin"],
125                         "parent-origin" => ["post-thread-user", "origin"],
126                         "mention" => ["post-thread-user", "mention"],
127                         "global" => ["post-user", "global"],
128                         "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post-user`.`uri-id`)",
129                         "network" => ["post-user", "network"],
130                         "protocol" => ["post-user", "protocol"],
131                         "vid" => ["post-user", "vid"],
132                         "psid" => ["post-user", "psid"],
133                         "verb" => "IF (`post-user`.`vid` IS NULL, '', `verb`.`name`)",
134                         "title" => ["post-content", "title"],
135                         "content-warning" => ["post-content", "content-warning"],
136                         "raw-body" => ["post-content", "raw-body"],
137                         "body" => "IFNULL (`post-content`.`body`, '')",
138                         "rendered-hash" => ["post-content", "rendered-hash"],
139                         "rendered-html" => ["post-content", "rendered-html"],
140                         "language" => ["post-content", "language"],
141                         "plink" => ["post-content", "plink"],
142                         "location" => ["post-content", "location"],
143                         "coord" => ["post-content", "coord"],
144                         "app" => ["post-content", "app"],
145                         "object-type" => ["post-content", "object-type"],
146                         "object" => ["post-content", "object"],
147                         "target-type" => ["post-content", "target-type"],
148                         "target" => ["post-content", "target"],
149                         "resource-id" => ["post-content", "resource-id"],
150                         "contact-id" => ["post-user", "contact-id"],
151                         "contact-uri-id" => ["contact", "uri-id"],
152                         "contact-link" => ["contact", "url"],
153                         "contact-addr" => ["contact", "addr"],
154                         "contact-name" => ["contact", "name"],
155                         "contact-nick" => ["contact", "nick"],
156                         "contact-avatar" => ["contact", "thumb"],
157                         "contact-network" => ["contact", "network"],
158                         "contact-blocked" => ["contact", "blocked"],
159                         "contact-hidden" => ["contact", "hidden"],
160                         "contact-readonly" => ["contact", "readonly"],
161                         "contact-archive" => ["contact", "archive"],
162                         "contact-pending" => ["contact", "pending"],
163                         "contact-rel" => ["contact", "rel"],
164                         "contact-uid" => ["contact", "uid"],
165                         "contact-contact-type" => ["contact", "contact-type"],
166                         "writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
167                         "self" => ["contact", "self"],
168                         "cid" => ["contact", "id"],
169                         "alias" => ["contact", "alias"],
170                         "photo" => ["contact", "photo"],
171                         "name-date" => ["contact", "name-date"],
172                         "uri-date" => ["contact", "uri-date"],
173                         "avatar-date" => ["contact", "avatar-date"],
174                         "thumb" => ["contact", "thumb"],
175                         "author-id" => ["post-user", "author-id"],
176                         "author-uri-id" => ["author", "uri-id"],
177                         "author-link" => ["author", "url"],
178                         "author-addr" => ["author", "addr"],
179                         "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
180                         "author-nick" => ["author", "nick"],
181                         "author-alias" => ["author", "alias"],
182                         "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
183                         "author-network" => ["author", "network"],
184                         "author-blocked" => ["author", "blocked"],
185                         "author-hidden" => ["author", "hidden"],
186                         "author-updated" => ["author", "updated"],
187                         "author-gsid" => ["author", "gsid"],
188                         "owner-id" => ["post-user", "owner-id"],
189                         "owner-uri-id" => ["owner", "uri-id"],
190                         "owner-link" => ["owner", "url"],
191                         "owner-addr" => ["owner", "addr"],
192                         "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
193                         "owner-nick" => ["owner", "nick"],
194                         "owner-alias" => ["owner", "alias"],
195                         "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
196                         "owner-network" => ["owner", "network"],
197                         "owner-blocked" => ["owner", "blocked"],
198                         "owner-hidden" => ["owner", "hidden"],
199                         "owner-updated" => ["owner", "updated"],
200                         "owner-gsid" => ["owner", "gsid"],
201                         "owner-contact-type" => ["owner", "contact-type"],
202                         "causer-id" => ["post-user", "causer-id"],
203                         "causer-uri-id" => ["causer", "uri-id"],
204                         "causer-link" => ["causer", "url"],
205                         "causer-addr" => ["causer", "addr"],
206                         "causer-name" => ["causer", "name"],
207                         "causer-nick" => ["causer", "nick"],
208                         "causer-alias" => ["causer", "alias"],
209                         "causer-avatar" => ["causer", "thumb"],
210                         "causer-network" => ["causer", "network"],
211                         "causer-blocked" => ["causer", "blocked"],
212                         "causer-hidden" => ["causer", "hidden"],
213                         "causer-gsid" => ["causer", "gsid"],
214                         "causer-contact-type" => ["causer", "contact-type"],
215                         "postopts" => ["post-delivery-data", "postopts"],
216                         "inform" => ["post-delivery-data", "inform"],
217                         "delivery_queue_count" => ["post-delivery-data", "queue_count"],
218                         "delivery_queue_done" => ["post-delivery-data", "queue_done"],
219                         "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
220                         "allow_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
221                         "allow_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
222                         "deny_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
223                         "deny_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
224                         "event-id" => ["post-user", "event-id"],
225                         "event-created" => ["event", "created"],
226                         "event-edited" => ["event", "edited"],
227                         "event-start" => ["event", "start"],
228                         "event-finish" => ["event", "finish"],
229                         "event-summary" => ["event", "summary"],
230                         "event-desc" => ["event", "desc"],
231                         "event-location" => ["event", "location"],
232                         "event-type" => ["event", "type"],
233                         "event-nofinish" => ["event", "nofinish"],
234                         "event-ignore" => ["event", "ignore"],
235                         "question-id" => ["post-question", "id"],
236                         "question-multiple" => ["post-question", "multiple"],
237                         "question-voters" => ["post-question", "voters"],
238                         "question-end-time" => ["post-question", "end-time"],
239                         "has-categories" => "EXISTS(SELECT `uri-id` FROM `post-category` WHERE `post-category`.`uri-id` = `post-user`.`uri-id` AND `post-category`.`uid` = `post-user`.`uid`)",
240                         "has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-user`.`uri-id`)",
241                         "signed_text" => ["diaspora-interaction", "interaction"],
242                         "parent-guid" => ["parent-item-uri", "guid"],
243                         "parent-network" => ["post-thread-user", "network"],
244                         "parent-author-id" => ["post-thread-user", "author-id"],
245                         "parent-author-link" => ["parent-post-author", "url"],
246                         "parent-author-name" => ["parent-post-author", "name"],
247                         "parent-author-nick" => ["parent-post-author", "nick"],
248                         "parent-author-network" => ["parent-post-author", "network"],
249                 ],
250                 "query" => "FROM `post-user`
251                         INNER JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
252                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
253                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id`
254                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
255                         LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-user`.`causer-id`
256                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-user`.`uri-id`
257                         LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
258                         LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
259                         LEFT JOIN `item-uri` AS `conversation-item-uri` ON `conversation-item-uri`.`id` = `post-thread-user`.`conversation-id`
260                         LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
261                         LEFT JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
262                         LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
263                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-user`.`uri-id`
264                         LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-user`.`uri-id`
265                         LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
266                         LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-user`.`uri-id` AND `post-user`.`origin`
267                         LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-user`.`uri-id`
268                         LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-user`.`psid`
269                         LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `post-thread-user`.`author-id`"
270         ],
271         "post-thread-user-view" => [
272                 "fields" => [
273                         "id" => ["post-user", "id"],
274                         "post-user-id" => ["post-user", "id"],
275                         "uid" => ["post-thread-user", "uid"],
276                         "parent" => ["post-thread-user", "post-user-id"],
277                         "uri" => ["item-uri", "uri"],
278                         "uri-id" => ["post-thread-user", "uri-id"],
279                         "parent-uri" => ["parent-item-uri", "uri"],
280                         "parent-uri-id" => ["post-user", "parent-uri-id"],
281                         "thr-parent" => ["thr-parent-item-uri", "uri"],
282                         "thr-parent-id" => ["post-user", "thr-parent-id"],
283                         "conversation" => ["conversation-item-uri", "uri"],
284                         "conversation-id" => ["post-thread-user", "conversation-id"],
285                         "quote-uri" => ["quote-item-uri", "uri"],
286                         "quote-uri-id" => ["post-content", "quote-uri-id"],
287                         "guid" => ["item-uri", "guid"],
288                         "wall" => ["post-thread-user", "wall"],
289                         "gravity" => ["post-user", "gravity"],
290                         "extid" => ["external-item-uri", "uri"],
291                         "external-id" => ["post-user", "external-id"],
292                         "created" => ["post-thread-user", "created"],
293                         "edited" => ["post-user", "edited"],
294                         "commented" => ["post-thread-user", "commented"],
295                         "received" => ["post-thread-user", "received"],
296                         "changed" => ["post-thread-user", "changed"],
297                         "post-type" => ["post-user", "post-type"],
298                         "post-reason" => ["post-user", "post-reason"],
299                         "private" => ["post-user", "private"],
300                         "pubmail" => ["post-thread-user", "pubmail"],
301                         "ignored" => ["post-thread-user", "ignored"],
302                         "visible" => ["post-user", "visible"],
303                         "starred" => ["post-thread-user", "starred"],
304                         "unseen" => ["post-thread-user", "unseen"],
305                         "deleted" => ["post-user", "deleted"],
306                         "origin" => ["post-thread-user", "origin"],
307                         "mention" => ["post-thread-user", "mention"],
308                         "global" => ["post-user", "global"],
309                         "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post-thread-user`.`uri-id`)",
310                         "network" => ["post-thread-user", "network"],
311                         "vid" => ["post-user", "vid"],
312                         "psid" => ["post-thread-user", "psid"],
313                         "verb" => "IF (`post-user`.`vid` IS NULL, '', `verb`.`name`)",
314                         "title" => ["post-content", "title"],
315                         "content-warning" => ["post-content", "content-warning"],
316                         "raw-body" => ["post-content", "raw-body"],
317                         "body" => ["post-content", "body"],
318                         "rendered-hash" => ["post-content", "rendered-hash"],
319                         "rendered-html" => ["post-content", "rendered-html"],
320                         "language" => ["post-content", "language"],
321                         "plink" => ["post-content", "plink"],
322                         "location" => ["post-content", "location"],
323                         "coord" => ["post-content", "coord"],
324                         "app" => ["post-content", "app"],
325                         "object-type" => ["post-content", "object-type"],
326                         "object" => ["post-content", "object"],
327                         "target-type" => ["post-content", "target-type"],
328                         "target" => ["post-content", "target"],
329                         "resource-id" => ["post-content", "resource-id"],
330                         "contact-id" => ["post-thread-user", "contact-id"],
331                         "contact-uri-id" => ["contact", "uri-id"],
332                         "contact-link" => ["contact", "url"],
333                         "contact-addr" => ["contact", "addr"],
334                         "contact-name" => ["contact", "name"],
335                         "contact-nick" => ["contact", "nick"],
336                         "contact-avatar" => ["contact", "thumb"],
337                         "contact-network" => ["contact", "network"],
338                         "contact-blocked" => ["contact", "blocked"],
339                         "contact-hidden" => ["contact", "hidden"],
340                         "contact-readonly" => ["contact", "readonly"],
341                         "contact-archive" => ["contact", "archive"],
342                         "contact-pending" => ["contact", "pending"],
343                         "contact-rel" => ["contact", "rel"],
344                         "contact-uid" => ["contact", "uid"],
345                         "contact-gsid" => ["contact", "gsid"],
346                         "contact-contact-type" => ["contact", "contact-type"],
347                         "writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
348                         "self" => ["contact", "self"],
349                         "cid" => ["contact", "id"],
350                         "alias" => ["contact", "alias"],
351                         "photo" => ["contact", "photo"],
352                         "name-date" => ["contact", "name-date"],
353                         "uri-date" => ["contact", "uri-date"],
354                         "avatar-date" => ["contact", "avatar-date"],
355                         "thumb" => ["contact", "thumb"],
356                         "author-id" => ["post-thread-user", "author-id"],
357                         "author-uri-id" => ["author", "uri-id"],
358                         "author-link" => ["author", "url"],
359                         "author-addr" => ["author", "addr"],
360                         "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
361                         "author-nick" => ["author", "nick"],
362                         "author-alias" => ["author", "alias"],
363                         "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
364                         "author-network" => ["author", "network"],
365                         "author-blocked" => ["author", "blocked"],
366                         "author-hidden" => ["author", "hidden"],
367                         "author-updated" => ["author", "updated"],
368                         "author-gsid" => ["author", "gsid"],
369                         "owner-id" => ["post-thread-user", "owner-id"],
370                         "owner-uri-id" => ["owner", "uri-id"],
371                         "owner-link" => ["owner", "url"],
372                         "owner-addr" => ["owner", "addr"],
373                         "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
374                         "owner-nick" => ["owner", "nick"],
375                         "owner-alias" => ["owner", "alias"],
376                         "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
377                         "owner-network" => ["owner", "network"],
378                         "owner-blocked" => ["owner", "blocked"],
379                         "owner-hidden" => ["owner", "hidden"],
380                         "owner-updated" => ["owner", "updated"],
381                         "owner-gsid" => ["owner", "gsid"],
382                         "owner-contact-type" => ["owner", "contact-type"],
383                         "causer-id" => ["post-thread-user", "causer-id"],
384                         "causer-uri-id" => ["causer", "uri-id"],
385                         "causer-link" => ["causer", "url"],
386                         "causer-addr" => ["causer", "addr"],
387                         "causer-name" => ["causer", "name"],
388                         "causer-nick" => ["causer", "nick"],
389                         "causer-alias" => ["causer", "alias"],
390                         "causer-avatar" => ["causer", "thumb"],
391                         "causer-network" => ["causer", "network"],
392                         "causer-blocked" => ["causer", "blocked"],
393                         "causer-hidden" => ["causer", "hidden"],
394                         "causer-gsid" => ["causer", "gsid"],
395                         "causer-contact-type" => ["causer", "contact-type"],
396                         "postopts" => ["post-delivery-data", "postopts"],
397                         "inform" => ["post-delivery-data", "inform"],
398                         "delivery_queue_count" => ["post-delivery-data", "queue_count"],
399                         "delivery_queue_done" => ["post-delivery-data", "queue_done"],
400                         "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
401                         "allow_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
402                         "allow_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
403                         "deny_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
404                         "deny_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
405                         "event-id" => ["post-user", "event-id"],
406                         "event-created" => ["event", "created"],
407                         "event-edited" => ["event", "edited"],
408                         "event-start" => ["event", "start"],
409                         "event-finish" => ["event", "finish"],
410                         "event-summary" => ["event", "summary"],
411                         "event-desc" => ["event", "desc"],
412                         "event-location" => ["event", "location"],
413                         "event-type" => ["event", "type"],
414                         "event-nofinish" => ["event", "nofinish"],
415                         "event-ignore" => ["event", "ignore"],
416                         "question-id" => ["post-question", "id"],
417                         "question-multiple" => ["post-question", "multiple"],
418                         "question-voters" => ["post-question", "voters"],
419                         "question-end-time" => ["post-question", "end-time"],
420                         "has-categories" => "EXISTS(SELECT `uri-id` FROM `post-category` WHERE `post-category`.`uri-id` = `post-thread-user`.`uri-id` AND `post-category`.`uid` = `post-thread-user`.`uid`)",
421                         "has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-thread-user`.`uri-id`)",
422                         "signed_text" => ["diaspora-interaction", "interaction"],
423                         "parent-guid" => ["parent-item-uri", "guid"],
424                         "parent-network" => ["post-thread-user", "network"],
425                         "parent-author-id" => ["post-thread-user", "author-id"],
426                         "parent-author-link" => ["author", "url"],
427                         "parent-author-name" => ["author", "name"],
428                         "parent-author-nick" => ["author", "nick"],
429                         "parent-author-network" => ["author", "network"],
430                 ],
431                 "query" => "FROM `post-thread-user`
432                         INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
433                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
434                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread-user`.`author-id`
435                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread-user`.`owner-id`
436                         LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread-user`.`causer-id`
437                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread-user`.`uri-id`
438                         LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
439                         LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
440                         LEFT JOIN `item-uri` AS `conversation-item-uri` ON `conversation-item-uri`.`id` = `post-thread-user`.`conversation-id`
441                         LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
442                         LEFT JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
443                         LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
444                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread-user`.`uri-id`
445                         LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread-user`.`uri-id`
446                         LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
447                         LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-thread-user`.`uri-id` AND `post-thread-user`.`origin`
448                         LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread-user`.`uri-id`
449                         LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-thread-user`.`psid`"
450         ],
451         "post-view" => [
452                 "fields" => [
453                         "uri" => ["item-uri", "uri"],
454                         "uri-id" => ["post", "uri-id"],
455                         "parent-uri" => ["parent-item-uri", "uri"],
456                         "parent-uri-id" => ["post", "parent-uri-id"],
457                         "thr-parent" => ["thr-parent-item-uri", "uri"],
458                         "thr-parent-id" => ["post", "thr-parent-id"],
459                         "conversation" => ["conversation-item-uri", "uri"],
460                         "conversation-id" => ["post-thread", "conversation-id"],
461                         "quote-uri" => ["quote-item-uri", "uri"],
462                         "quote-uri-id" => ["post-content", "quote-uri-id"],
463                         "guid" => ["item-uri", "guid"],
464                         "gravity" => ["post", "gravity"],
465                         "extid" => ["external-item-uri", "uri"],
466                         "external-id" => ["post", "external-id"],
467                         "created" => ["post", "created"],
468                         "edited" => ["post", "edited"],
469                         "commented" => ["post-thread", "commented"],
470                         "received" => ["post", "received"],
471                         "changed" => ["post-thread", "changed"],
472                         "post-type" => ["post", "post-type"],
473                         "private" => ["post", "private"],
474                         "visible" => ["post", "visible"],
475                         "deleted" => ["post", "deleted"],
476                         "global" => ["post", "global"],
477                         "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post`.`uri-id`)",
478                         "network" => ["post", "network"],
479                         "vid" => ["post", "vid"],
480                         "verb" => "IF (`post`.`vid` IS NULL, '', `verb`.`name`)",
481                         "title" => ["post-content", "title"],
482                         "content-warning" => ["post-content", "content-warning"],
483                         "raw-body" => ["post-content", "raw-body"],
484                         "body" => ["post-content", "body"],
485                         "rendered-hash" => ["post-content", "rendered-hash"],
486                         "rendered-html" => ["post-content", "rendered-html"],
487                         "language" => ["post-content", "language"],
488                         "plink" => ["post-content", "plink"],
489                         "location" => ["post-content", "location"],
490                         "coord" => ["post-content", "coord"],
491                         "app" => ["post-content", "app"],
492                         "object-type" => ["post-content", "object-type"],
493                         "object" => ["post-content", "object"],
494                         "target-type" => ["post-content", "target-type"],
495                         "target" => ["post-content", "target"],
496                         "resource-id" => ["post-content", "resource-id"],
497                         "contact-id" => ["post", "author-id"],
498                         "contact-uri-id" => ["author", "uri-id"],
499                         "contact-link" => ["author", "url"],
500                         "contact-addr" => ["author", "addr"],
501                         "contact-name" => ["author", "name"],
502                         "contact-nick" => ["author", "nick"],
503                         "contact-avatar" => ["author", "thumb"],
504                         "contact-network" => ["author", "network"],
505                         "contact-blocked" => ["author", "blocked"],
506                         "contact-hidden" => ["author", "hidden"],
507                         "contact-readonly" => ["author", "readonly"],
508                         "contact-archive" => ["author", "archive"],
509                         "contact-pending" => ["author", "pending"],
510                         "contact-rel" => ["author", "rel"],
511                         "contact-uid" => ["author", "uid"],
512                         "contact-contact-type" => ["author", "contact-type"],
513                         "writable" => "IF (`post`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `author`.`writable`)",
514                         "self" => "false",
515                         "cid" => ["author", "id"],
516                         "alias" => ["author", "alias"],
517                         "photo" => ["author", "photo"],
518                         "name-date" => ["author", "name-date"],
519                         "uri-date" => ["author", "uri-date"],
520                         "avatar-date" => ["author", "avatar-date"],
521                         "thumb" => ["author", "thumb"],
522                         "author-id" => ["post", "author-id"],
523                         "author-uri-id" => ["author", "uri-id"],
524                         "author-link" => ["author", "url"],
525                         "author-addr" => ["author", "addr"],
526                         "author-name" => ["author", "name"],
527                         "author-nick" => ["author", "nick"],
528                         "author-alias" => ["author", "alias"],
529                         "author-avatar" => ["author", "thumb"],
530                         "author-network" => ["author", "network"],
531                         "author-blocked" => ["author", "blocked"],
532                         "author-hidden" => ["author", "hidden"],
533                         "author-updated" => ["author", "updated"],
534                         "author-gsid" => ["author", "gsid"],
535                         "owner-id" => ["post", "owner-id"],
536                         "owner-uri-id" => ["owner", "uri-id"],
537                         "owner-link" => ["owner", "url"],
538                         "owner-addr" => ["owner", "addr"],
539                         "owner-name" => ["owner", "name"],
540                         "owner-nick" => ["owner", "nick"],
541                         "owner-alias" => ["owner", "alias"],
542                         "owner-avatar" => ["owner", "thumb"],
543                         "owner-network" => ["owner", "network"],
544                         "owner-blocked" => ["owner", "blocked"],
545                         "owner-hidden" => ["owner", "hidden"],
546                         "owner-updated" => ["owner", "updated"],
547                         "owner-contact-type" => ["owner", "contact-type"],
548                         "owner-gsid" => ["owner", "gsid"],
549                         "causer-id" => ["post", "causer-id"],
550                         "causer-uri-id" => ["causer", "uri-id"],
551                         "causer-link" => ["causer", "url"],
552                         "causer-addr" => ["causer", "addr"],
553                         "causer-name" => ["causer", "name"],
554                         "causer-nick" => ["causer", "nick"],
555                         "causer-alias" => ["causer", "alias"],
556                         "causer-avatar" => ["causer", "thumb"],
557                         "causer-network" => ["causer", "network"],
558                         "causer-blocked" => ["causer", "blocked"],
559                         "causer-hidden" => ["causer", "hidden"],
560                         "causer-contact-type" => ["causer", "contact-type"],
561                         "causer-gsid" => ["causer", "gsid"],
562                         "question-id" => ["post-question", "id"],
563                         "question-multiple" => ["post-question", "multiple"],
564                         "question-voters" => ["post-question", "voters"],
565                         "question-end-time" => ["post-question", "end-time"],
566                         "has-categories" => "0",
567                         "has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post`.`uri-id`)",
568                         "signed_text" => ["diaspora-interaction", "interaction"],
569                         "parent-guid" => ["parent-item-uri", "guid"],
570                         "parent-network" => ["post-thread", "network"],
571                         "parent-author-id" => ["post-thread", "author-id"],
572                         "parent-author-link" => ["parent-post-author", "url"],
573                         "parent-author-name" => ["parent-post-author", "name"],
574                         "parent-author-nick" => ["parent-post-author", "nick"],
575                         "parent-author-network" => ["parent-post-author", "network"],
576                 ],
577                 "query" => "FROM `post`
578                         STRAIGHT_JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`
579                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post`.`author-id`
580                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post`.`owner-id`
581                         LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post`.`causer-id`
582                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `post`.`uri-id`
583                         LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post`.`thr-parent-id`
584                         LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post`.`parent-uri-id`
585                         LEFT JOIN `item-uri` AS `conversation-item-uri` ON `conversation-item-uri`.`id` = `post-thread`.`conversation-id`
586                         LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post`.`external-id`
587                         LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
588                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post`.`uri-id`
589                         LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post`.`uri-id`
590                         LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
591                         LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post`.`uri-id`
592                         LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `post-thread`.`author-id`"
593         ],
594         "post-thread-view" => [
595                 "fields" => [
596                         "uri" => ["item-uri", "uri"],
597                         "uri-id" => ["post-thread", "uri-id"],
598                         "parent-uri" => ["parent-item-uri", "uri"],
599                         "parent-uri-id" => ["post", "parent-uri-id"],
600                         "thr-parent" => ["thr-parent-item-uri", "uri"],
601                         "thr-parent-id" => ["post", "thr-parent-id"],
602                         "conversation" => ["conversation-item-uri", "uri"],
603                         "conversation-id" => ["post-thread", "conversation-id"],
604                         "quote-uri" => ["quote-item-uri", "uri"],
605                         "quote-uri-id" => ["post-content", "quote-uri-id"],
606                         "guid" => ["item-uri", "guid"],
607                         "gravity" => ["post", "gravity"],
608                         "extid" => ["external-item-uri", "uri"],
609                         "external-id" => ["post", "external-id"],
610                         "created" => ["post-thread", "created"],
611                         "edited" => ["post", "edited"],
612                         "commented" => ["post-thread", "commented"],
613                         "received" => ["post-thread", "received"],
614                         "changed" => ["post-thread", "changed"],
615                         "post-type" => ["post", "post-type"],
616                         "private" => ["post", "private"],
617                         "visible" => ["post", "visible"],
618                         "deleted" => ["post", "deleted"],
619                         "global" => ["post", "global"],
620                         "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post-thread`.`uri-id`)",
621                         "network" => ["post-thread", "network"],
622                         "vid" => ["post", "vid"],
623                         "verb" => "IF (`post`.`vid` IS NULL, '', `verb`.`name`)",
624                         "title" => ["post-content", "title"],
625                         "content-warning" => ["post-content", "content-warning"],
626                         "raw-body" => ["post-content", "raw-body"],
627                         "body" => ["post-content", "body"],
628                         "rendered-hash" => ["post-content", "rendered-hash"],
629                         "rendered-html" => ["post-content", "rendered-html"],
630                         "language" => ["post-content", "language"],
631                         "plink" => ["post-content", "plink"],
632                         "location" => ["post-content", "location"],
633                         "coord" => ["post-content", "coord"],
634                         "app" => ["post-content", "app"],
635                         "object-type" => ["post-content", "object-type"],
636                         "object" => ["post-content", "object"],
637                         "target-type" => ["post-content", "target-type"],
638                         "target" => ["post-content", "target"],
639                         "resource-id" => ["post-content", "resource-id"],
640                         "contact-id" => ["post-thread", "author-id"],
641                         "contact-uri-id" => ["author", "uri-id"],
642                         "contact-link" => ["author", "url"],
643                         "contact-addr" => ["author", "addr"],
644                         "contact-name" => ["author", "name"],
645                         "contact-nick" => ["author", "nick"],
646                         "contact-avatar" => ["author", "thumb"],
647                         "contact-network" => ["author", "network"],
648                         "contact-blocked" => ["author", "blocked"],
649                         "contact-hidden" => ["author", "hidden"],
650                         "contact-readonly" => ["author", "readonly"],
651                         "contact-archive" => ["author", "archive"],
652                         "contact-pending" => ["author", "pending"],
653                         "contact-rel" => ["author", "rel"],
654                         "contact-uid" => ["author", "uid"],
655                         "contact-contact-type" => ["author", "contact-type"],
656                         "writable" => "IF (`post`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `author`.`writable`)",
657                         "self" => "false",
658                         "cid" => ["author", "id"],
659                         "alias" => ["author", "alias"],
660                         "photo" => ["author", "photo"],
661                         "name-date" => ["author", "name-date"],
662                         "uri-date" => ["author", "uri-date"],
663                         "avatar-date" => ["author", "avatar-date"],
664                         "thumb" => ["author", "thumb"],
665                         "author-id" => ["post-thread", "author-id"],
666                         "author-uri-id" => ["author", "uri-id"],
667                         "author-link" => ["author", "url"],
668                         "author-addr" => ["author", "addr"],
669                         "author-name" => ["author", "name"],
670                         "author-nick" => ["author", "nick"],
671                         "author-alias" => ["author", "alias"],
672                         "author-avatar" => ["author", "thumb"],
673                         "author-network" => ["author", "network"],
674                         "author-blocked" => ["author", "blocked"],
675                         "author-hidden" => ["author", "hidden"],
676                         "author-updated" => ["author", "updated"],
677                         "author-gsid" => ["author", "gsid"],
678                         "owner-id" => ["post-thread", "owner-id"],
679                         "owner-uri-id" => ["owner", "uri-id"],
680                         "owner-link" => ["owner", "url"],
681                         "owner-addr" => ["owner", "addr"],
682                         "owner-name" => ["owner", "name"],
683                         "owner-nick" => ["owner", "nick"],
684                         "owner-alias" => ["owner", "alias"],
685                         "owner-avatar" => ["owner", "thumb"],
686                         "owner-network" => ["owner", "network"],
687                         "owner-blocked" => ["owner", "blocked"],
688                         "owner-hidden" => ["owner", "hidden"],
689                         "owner-updated" => ["owner", "updated"],
690                         "owner-gsid" => ["owner", "gsid"],
691                         "owner-contact-type" => ["owner", "contact-type"],
692                         "causer-id" => ["post-thread", "causer-id"],
693                         "causer-uri-id" => ["causer", "uri-id"],
694                         "causer-link" => ["causer", "url"],
695                         "causer-addr" => ["causer", "addr"],
696                         "causer-name" => ["causer", "name"],
697                         "causer-nick" => ["causer", "nick"],
698                         "causer-alias" => ["causer", "alias"],
699                         "causer-avatar" => ["causer", "thumb"],
700                         "causer-network" => ["causer", "network"],
701                         "causer-blocked" => ["causer", "blocked"],
702                         "causer-hidden" => ["causer", "hidden"],
703                         "causer-gsid" => ["causer", "gsid"],
704                         "causer-contact-type" => ["causer", "contact-type"],
705                         "question-id" => ["post-question", "id"],
706                         "question-multiple" => ["post-question", "multiple"],
707                         "question-voters" => ["post-question", "voters"],
708                         "question-end-time" => ["post-question", "end-time"],
709                         "has-categories" => "0",
710                         "has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-thread`.`uri-id`)",
711                         "total-comments" => "(SELECT COUNT(*) FROM `post` WHERE `parent-uri-id` = `post-thread`.`uri-id` AND `gravity` = 6)",
712                         "total-actors" => "(SELECT COUNT(DISTINCT(`author-id`)) FROM `post` WHERE `parent-uri-id` = `post-thread`.`uri-id` AND `gravity` = 6)",
713                         "signed_text" => ["diaspora-interaction", "interaction"],
714                         "parent-guid" => ["parent-item-uri", "guid"],
715                         "parent-network" => ["post-thread", "network"],
716                         "parent-author-id" => ["post-thread", "author-id"],
717                         "parent-author-link" => ["author", "url"],
718                         "parent-author-name" => ["author", "name"],
719                         "parent-author-nick" => ["author", "nick"],
720                         "parent-author-network" => ["author", "network"],
721                 ],
722                 "query" => "FROM `post-thread`
723                         INNER JOIN `post` ON `post`.`uri-id` = `post-thread`.`uri-id`
724                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread`.`author-id`
725                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread`.`owner-id`
726                         LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread`.`causer-id`
727                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread`.`uri-id`
728                         LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post`.`thr-parent-id`
729                         LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post`.`parent-uri-id`
730                         LEFT JOIN `item-uri` AS `conversation-item-uri` ON `conversation-item-uri`.`id` = `post-thread`.`conversation-id`
731                         LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post`.`external-id`
732                         LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
733                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread`.`uri-id`
734                         LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread`.`uri-id`
735                         LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
736                         LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread`.`uri-id`"
737         ],
738         "category-view" => [
739                 "fields" => [
740                         "uri-id" => ["post-category", "uri-id"],
741                         "uid" => ["post-category", "uid"],
742                         "type" => ["post-category", "type"],
743                         "tid" => ["post-category", "tid"],
744                         "name" => ["tag", "name"],
745                         "url" => ["tag", "url"],
746                 ],
747                 "query" => "FROM `post-category`
748                         LEFT JOIN `tag` ON `post-category`.`tid` = `tag`.`id`"
749         ],
750         "collection-view" => [
751                 "fields" => [
752                         "uri-id" => ["post-collection", "uri-id"],
753                         "type" => ["post-collection", "type"],
754                         "cid" => ["post-collection", "author-id"],
755                         "received" => ["post", "received"],
756                         "created" => ["post", "created"],
757                         "commented" => ["post-thread", "commented"],
758                         "private" => ["post", "private"],
759                         "visible" => ["post", "visible"],
760                         "deleted" => ["post", "deleted"],
761                         "thr-parent-id" => ["post", "thr-parent-id"],
762                         "author-id" => ["post-collection", "author-id"],
763                         "gravity" => ["post", "gravity"],
764                 ],
765                 "query" => "FROM `post-collection`
766                         INNER JOIN `post` ON `post-collection`.`uri-id` = `post`.`uri-id`
767                         INNER JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`"
768         ],
769         "media-view" => [
770                 "fields" => [
771                         "uri-id" => ["post-media", "uri-id"],
772                         "type" => ["post-media", "type"],
773                         "received" => ["post", "received"],
774                         "created" => ["post", "created"],
775                         "private" => ["post", "private"],
776                         "visible" => ["post", "visible"],
777                         "deleted" => ["post", "deleted"],
778                         "thr-parent-id" => ["post", "thr-parent-id"],
779                         "author-id" => ["post", "author-id"],
780                         "gravity" => ["post", "gravity"],
781                 ],
782                 "query" => "FROM `post-media`
783                         INNER JOIN `post` ON `post-media`.`uri-id` = `post`.`uri-id`"
784         ],
785         "tag-view" => [
786                 "fields" => [
787                         "uri-id" => ["post-tag", "uri-id"],
788                         "type" => ["post-tag", "type"],
789                         "tid" => ["post-tag", "tid"],
790                         "cid" => ["post-tag", "cid"],
791                         "name" => "CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END",
792                         "url" => "CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END",
793                         "tag-type" => "CASE `cid` WHEN 0 THEN `tag`.`type` ELSE 1 END",
794                 ],
795                 "query" => "FROM `post-tag`
796                         LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
797                         LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`"
798         ],
799         "network-item-view" => [
800                 "fields" => [
801                         "uri-id" => ["post-user", "uri-id"],
802                         "parent" => ["post-thread-user", "post-user-id"],
803                         "received" => ["post-user", "received"],
804                         "commented" => ["post-thread-user", "commented"],
805                         "created" => ["post-user", "created"],
806                         "uid" => ["post-user", "uid"],
807                         "starred" => ["post-thread-user", "starred"],
808                         "mention" => ["post-thread-user", "mention"],
809                         "network" => ["post-user", "network"],
810                         "unseen" => ["post-user", "unseen"],
811                         "gravity" => ["post-user", "gravity"],
812                         "contact-id" => ["post-user", "contact-id"],
813                         "contact-type" => ["ownercontact", "contact-type"],
814                 ],
815                 "query" => "FROM `post-user`
816                         INNER JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
817                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
818                         STRAIGHT_JOIN `contact` AS `authorcontact` ON `authorcontact`.`id` = `post-thread-user`.`author-id`
819                         STRAIGHT_JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
820                         LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
821                         LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
822                         WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
823                         AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
824                         AND (`post-user`.`hidden` IS NULL OR NOT `post-user`.`hidden`)
825                         AND NOT `authorcontact`.`blocked` AND NOT `ownercontact`.`blocked`
826                         AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
827                         AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
828         ],
829         "network-thread-view" => [
830                 "fields" => [
831                         "uri-id" => ["post-thread-user", "uri-id"],
832                         "parent" => ["post-thread-user", "post-user-id"],
833                         "received" => ["post-thread-user", "received"],
834                         "commented" => ["post-thread-user", "commented"],
835                         "created" => ["post-thread-user", "created"],
836                         "uid" => ["post-thread-user", "uid"],
837                         "starred" => ["post-thread-user", "starred"],
838                         "mention" => ["post-thread-user", "mention"],
839                         "network" => ["post-thread-user", "network"],
840                         "contact-id" => ["post-thread-user", "contact-id"],
841                         "contact-type" => ["ownercontact", "contact-type"],
842                 ],
843                 "query" => "FROM `post-thread-user`
844                         INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
845                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
846                         STRAIGHT_JOIN `contact` AS `authorcontact` ON `authorcontact`.`id` = `post-thread-user`.`author-id`
847                         STRAIGHT_JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
848                         LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
849                         LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
850                         WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
851                         AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
852                         AND (`post-thread-user`.`hidden` IS NULL OR NOT `post-thread-user`.`hidden`)
853                         AND NOT `authorcontact`.`blocked` AND NOT `ownercontact`.`blocked`
854                         AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
855                         AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)
856                         AND NOT EXISTS(SELECT `gsid` FROM `user-gserver` WHERE `uid` = `post-thread-user`.`uid` AND `gsid` IN (`authorcontact`.`gsid`, `ownercontact`.`gsid`) AND `ignored`)"
857         ],
858         "owner-view" => [
859                 "fields" => [
860                         "id" => ["contact", "id"],
861                         "uid" => ["contact", "uid"],
862                         "created" => ["contact", "created"],
863                         "updated" => ["contact", "updated"],
864                         "self" => ["contact", "self"],
865                         "remote_self" => ["contact", "remote_self"],
866                         "rel" => ["contact", "rel"],
867                         "network" => ["contact", "network"],
868                         "protocol" => ["contact", "protocol"],
869                         "name" => ["contact", "name"],
870                         "nick" => ["contact", "nick"],
871                         "location" => ["contact", "location"],
872                         "about" => ["contact", "about"],
873                         "keywords" => ["contact", "keywords"],
874                         "xmpp" => ["contact", "xmpp"],
875                         "matrix" => ["contact", "matrix"],
876                         "attag" => ["contact", "attag"],
877                         "avatar" => ["contact", "avatar"],
878                         "photo" => ["contact", "photo"],
879                         "thumb" => ["contact", "thumb"],
880                         "micro" => ["contact", "micro"],
881                         "header" => ["contact", "header"],
882                         "url" => ["contact", "url"],
883                         "nurl" => ["contact", "nurl"],
884                         "uri-id" => ["contact", "uri-id"],
885                         "addr" => ["contact", "addr"],
886                         "alias" => ["contact", "alias"],
887                         "pubkey" => ["contact", "pubkey"],
888                         "prvkey" => ["contact", "prvkey"],
889                         "batch" => ["contact", "batch"],
890                         "request" => ["contact", "request"],
891                         "notify" => ["contact", "notify"],
892                         "poll" => ["contact", "poll"],
893                         "confirm" => ["contact", "confirm"],
894                         "poco" => ["contact", "poco"],
895                         "subhub" => ["contact", "subhub"],
896                         "hub-verify" => ["contact", "hub-verify"],
897                         "last-update" => ["contact", "last-update"],
898                         "success_update" => ["contact", "success_update"],
899                         "failure_update" => ["contact", "failure_update"],
900                         "name-date" => ["contact", "name-date"],
901                         "uri-date" => ["contact", "uri-date"],
902                         "avatar-date" => ["contact", "avatar-date"],
903                         "picdate" => ["contact", "avatar-date"], /// @todo Replaces all uses of "picdate" with "avatar-date"
904                         "term-date" => ["contact", "term-date"],
905                         "last-item" => ["contact", "last-item"],
906                         "priority" => ["contact", "priority"],
907                         "blocked" => ["user", "blocked"],
908                         "block_reason" => ["contact", "block_reason"],
909                         "readonly" => ["contact", "readonly"],
910                         "writable" => ["contact", "writable"],
911                         "forum" => ["contact", "forum"],
912                         "prv" => ["contact", "prv"],
913                         "contact-type" => ["contact", "contact-type"],
914                         "manually-approve" => ["contact", "manually-approve"],
915                         "hidden" => ["contact", "hidden"],
916                         "archive" => ["contact", "archive"],
917                         "pending" => ["contact", "pending"],
918                         "deleted" => ["contact", "deleted"],
919                         "unsearchable" => ["contact", "unsearchable"],
920                         "sensitive" => ["contact", "sensitive"],
921                         "baseurl" => ["contact", "baseurl"],
922                         "reason" => ["contact", "reason"],
923                         "info" => ["contact", "info"],
924                         "bdyear" => ["contact", "bdyear"],
925                         "bd" => ["contact", "bd"],
926                         "notify_new_posts" => ["contact", "notify_new_posts"],
927                         "fetch_further_information" => ["contact", "fetch_further_information"],
928                         "ffi_keyword_denylist" => ["contact", "ffi_keyword_denylist"],
929                         "parent-uid" => ["user", "parent-uid"],
930                         "guid" => ["user", "guid"],
931                         "nickname" => ["user", "nickname"], /// @todo Replaces all uses of "nickname" with "nick"
932                         "email" => ["user", "email"],
933                         "openid" => ["user", "openid"],
934                         "timezone" => ["user", "timezone"],
935                         "language" => ["user", "language"],
936                         "register_date" => ["user", "register_date"],
937                         "login_date" => ["user", "login_date"],
938                         "last-activity" => ["user", "last-activity"],
939                         "default-location" => ["user", "default-location"],
940                         "allow_location" => ["user", "allow_location"],
941                         "theme" => ["user", "theme"],
942                         "upubkey" => ["user", "pubkey"],
943                         "uprvkey" => ["user", "prvkey"],
944                         "sprvkey" => ["user", "sprvkey"],
945                         "spubkey" => ["user", "spubkey"],
946                         "verified" => ["user", "verified"],
947                         "blockwall" => ["user", "blockwall"],
948                         "hidewall" => ["user", "hidewall"],
949                         "blocktags" => ["user", "blocktags"],
950                         "unkmail" => ["user", "unkmail"],
951                         "cntunkmail" => ["user", "cntunkmail"],
952                         "notify-flags" => ["user", "notify-flags"],
953                         "page-flags" => ["user", "page-flags"],
954                         "account-type" => ["user", "account-type"],
955                         "prvnets" => ["user", "prvnets"],
956                         "maxreq" => ["user", "maxreq"],
957                         "expire" => ["user", "expire"],
958                         "account_removed" => ["user", "account_removed"],
959                         "account_expired" => ["user", "account_expired"],
960                         "account_expires_on" => ["user", "account_expires_on"],
961                         "expire_notification_sent" => ["user", "expire_notification_sent"],
962                         "def_gid" => ["user", "def_gid"],
963                         "allow_cid" => ["user", "allow_cid"],
964                         "allow_gid" => ["user", "allow_gid"],
965                         "deny_cid" => ["user", "deny_cid"],
966                         "deny_gid" => ["user", "deny_gid"],
967                         "openidserver" => ["user", "openidserver"],
968                         "publish" => ["profile", "publish"],
969                         "net-publish" => ["profile", "net-publish"],
970                         "hide-friends" => ["profile", "hide-friends"],
971                         "prv_keywords" => ["profile", "prv_keywords"],
972                         "pub_keywords" => ["profile", "pub_keywords"],
973                         "address" => ["profile", "address"],
974                         "locality" => ["profile", "locality"],
975                         "region" => ["profile", "region"],
976                         "postal-code" => ["profile", "postal-code"],
977                         "country-name" => ["profile", "country-name"],
978                         "homepage" => ["profile", "homepage"],
979                         "homepage_verified" => ["profile", "homepage_verified"],
980                         "dob" => ["profile", "dob"],
981                 ],
982                 "query" => "FROM `user`
983                         INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
984                         INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid`"
985         ],
986         "account-view" => [
987                 "fields" => [
988                         "id" => ["contact", "id"],
989                         "url" => ["contact", "url"],
990                         "nurl" => ["contact", "nurl"],
991                         "uri-id" => ["contact", "uri-id"],
992                         "guid" => ["item-uri", "guid"],
993                         "addr" => ["contact", "addr"],
994                         "alias" => ["contact", "alias"],
995                         "name" => ["contact", "name"],
996                         "nick" => ["contact", "nick"],
997                         "about" => ["contact", "about"],
998                         "keywords" => ["contact", "keywords"],
999                         "xmpp" => ["contact", "xmpp"],
1000                         "matrix" => ["contact", "matrix"],
1001                         "avatar" => ["contact", "avatar"],
1002                         "photo" => ["contact", "photo"],
1003                         "thumb" => ["contact", "thumb"],
1004                         "micro" => ["contact", "micro"],
1005                         "header" => ["contact", "header"],
1006                         "created" => ["contact", "created"],
1007                         "updated" => ["contact", "updated"],
1008                         "network" => ["contact", "network"],
1009                         "protocol" => ["contact", "protocol"],
1010                         "location" => ["contact", "location"],
1011                         "attag" => ["contact", "attag"],
1012                         "pubkey" => ["contact", "pubkey"],
1013                         "prvkey" => ["contact", "prvkey"],
1014                         "subscribe" => ["contact", "subscribe"],
1015                         "last-update" => ["contact", "last-update"],
1016                         "success_update" => ["contact", "success_update"],
1017                         "failure_update" => ["contact", "failure_update"],
1018                         "failed" => ["contact", "failed"],
1019                         "last-item" => ["contact", "last-item"],
1020                         "last-discovery" => ["contact", "last-discovery"],
1021                         "contact-type" => ["contact", "contact-type"],
1022                         "manually-approve" => ["contact", "manually-approve"],
1023                         "unsearchable" => ["contact", "unsearchable"],
1024                         "sensitive" => ["contact", "sensitive"],
1025                         "baseurl" => ["contact", "baseurl"],
1026                         "gsid" => ["contact", "gsid"],
1027                         "info" => ["contact", "info"],
1028                         "bdyear" => ["contact", "bdyear"],
1029                         "bd" => ["contact", "bd"],
1030                         "poco" => ["contact", "poco"],
1031                         "name-date" => ["contact", "name-date"],
1032                         "uri-date" => ["contact", "uri-date"],
1033                         "avatar-date" => ["contact", "avatar-date"],
1034                         "term-date" => ["contact", "term-date"],
1035                         "global-ignored" => ["contact", "hidden"],
1036                         "global-blocked" => ["contact", "blocked"],
1037                         "hidden" => ["contact", "hidden"],
1038                         "archive" => ["contact", "archive"],
1039                         "deleted" => ["contact", "deleted"],
1040                         "blocked" => ["contact", "blocked"],
1041                         "dfrn-notify" => ["contact", "notify"],
1042                         "dfrn-poll" => ["contact", "poll"],
1043                         "diaspora-guid" => ["item-uri", "guid"],
1044                         "diaspora-batch" => ["diaspora-contact", "batch"],
1045                         "diaspora-notify" => ["diaspora-contact", "notify"],
1046                         "diaspora-poll" => ["diaspora-contact", "poll"],
1047                         "diaspora-alias" => ["diaspora-contact", "alias"],
1048                         "ap-uuid" => ["apcontact", "uuid"],
1049                         "ap-type" => ["apcontact", "type"],
1050                         "ap-following" => ["apcontact", "following"],
1051                         "ap-followers" => ["apcontact", "followers"],
1052                         "ap-inbox" => ["apcontact", "inbox"],
1053                         "ap-outbox" => ["apcontact", "outbox"],
1054                         "ap-sharedinbox" => ["apcontact", "sharedinbox"],
1055                         "ap-generator" => ["apcontact", "generator"],
1056                         "ap-following_count" => ["apcontact", "following_count"],
1057                         "ap-followers_count" => ["apcontact", "followers_count"],
1058                         "ap-statuses_count" => ["apcontact", "statuses_count"],
1059                         "site_name" => ["gserver", "site_name"],
1060                         "platform" => ["gserver", "platform"],
1061                         "version" => ["gserver", "version"],
1062                         "server-blocked" => ["gserver", "blocked"],
1063                         "server-failed" => ["gserver", "failed"],
1064                 ],
1065                 "query" => "FROM `contact`
1066                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `contact`.`uri-id`
1067                         LEFT JOIN `apcontact` ON `apcontact`.`uri-id` = `contact`.`uri-id`
1068                         LEFT JOIN `diaspora-contact` ON `diaspora-contact`.`uri-id` = contact.`uri-id`
1069                         LEFT JOIN `gserver` ON `gserver`.`id` = contact.`gsid`
1070                         WHERE `contact`.`uid` = 0"
1071         ],
1072         "account-user-view" => [
1073                 "fields" => [
1074                         "id" => ["ucontact", "id"],
1075                         "pid" => ["contact", "id"],
1076                         "uid" => ["ucontact", "uid"],
1077                         "url" => ["contact", "url"],
1078                         "nurl" => ["contact", "nurl"],
1079                         "uri-id" => ["contact", "uri-id"],
1080                         "guid" => ["item-uri", "guid"],
1081                         "addr" => ["contact", "addr"],
1082                         "alias" => ["contact", "alias"],
1083                         "name" => ["contact", "name"],
1084                         "nick" => ["contact", "nick"],
1085                         "about" => ["contact", "about"],
1086                         "keywords" => ["contact", "keywords"],
1087                         "xmpp" => ["contact", "xmpp"],
1088                         "matrix" => ["contact", "matrix"],
1089                         "avatar" => ["contact", "avatar"],
1090                         "photo" => ["contact", "photo"],
1091                         "thumb" => ["contact", "thumb"],
1092                         "micro" => ["contact", "micro"],
1093                         "header" => ["contact", "header"],
1094                         "created" => ["contact", "created"],
1095                         "updated" => ["contact", "updated"],
1096                         "self" => ["ucontact", "self"],
1097                         "remote_self" => ["ucontact", "remote_self"],
1098                         "rel" =>  ["ucontact", "rel"],
1099                         "network" => ["contact", "network"],
1100                         "protocol" => ["ucontact", "protocol"],
1101                         "location" => ["contact", "location"],
1102                         "attag" => ["ucontact", "attag"],
1103                         "pubkey" => ["contact", "pubkey"],
1104                         "prvkey" => ["contact", "prvkey"],
1105                         "subscribe" => ["contact", "subscribe"],
1106                         "last-update" => ["contact", "last-update"],
1107                         "success_update" => ["contact", "success_update"],
1108                         "failure_update" => ["contact", "failure_update"],
1109                         "failed" => ["contact", "failed"],
1110                         "last-item" => ["contact", "last-item"],
1111                         "last-discovery" => ["contact", "last-discovery"],
1112                         "contact-type" => ["contact", "contact-type"],
1113                         "manually-approve" => ["contact", "manually-approve"],
1114                         "unsearchable" => ["contact", "unsearchable"],
1115                         "sensitive" => ["contact", "sensitive"],
1116                         "baseurl" => ["contact", "baseurl"],
1117                         "gsid" => ["contact", "gsid"],
1118                         "info" => ["ucontact", "info"],
1119                         "bdyear" => ["contact", "bdyear"],
1120                         "bd" => ["contact", "bd"],
1121                         "poco" => ["contact", "poco"],
1122                         "name-date" => ["contact", "name-date"],
1123                         "uri-date" => ["contact", "uri-date"],
1124                         "avatar-date" => ["contact", "avatar-date"],
1125                         "term-date" => ["contact", "term-date"],
1126                         "global-ignored" => ["contact", "hidden"],
1127                         "global-blocked" => ["contact", "blocked"],
1128                         "hidden" => ["ucontact", "hidden"],
1129                         "archive" => ["ucontact", "archive"],
1130                         "pending" => ["ucontact", "pending"],
1131                         "deleted" => ["ucontact", "deleted"],
1132                         "notify_new_posts" => ["ucontact", "notify_new_posts"],
1133                         "fetch_further_information" => ["ucontact", "fetch_further_information"],
1134                         "ffi_keyword_denylist" => ["ucontact", "ffi_keyword_denylist"],
1135                         "rating" => ["ucontact", "rating"],
1136                         "readonly" => ["ucontact", "readonly"],
1137                         "blocked" => ["ucontact", "blocked"],
1138                         "block_reason" => ["ucontact", "block_reason"],
1139                         "subhub" => ["ucontact", "subhub"],
1140                         "hub-verify" => ["ucontact", "hub-verify"],
1141                         "reason" => ["ucontact", "reason"],
1142                         "dfrn-notify" => ["contact", "notify"],
1143                         "dfrn-poll" => ["contact", "poll"],
1144                         "diaspora-guid" => ["item-uri", "guid"],
1145                         "diaspora-batch" => ["diaspora-contact", "batch"],
1146                         "diaspora-notify" => ["diaspora-contact", "notify"],
1147                         "diaspora-poll" => ["diaspora-contact", "poll"],
1148                         "diaspora-alias" => ["diaspora-contact", "alias"],
1149                         "diaspora-interacting_count" => ["diaspora-contact", "interacting_count"],
1150                         "diaspora-interacted_count" => ["diaspora-contact", "interacted_count"],
1151                         "diaspora-post_count" => ["diaspora-contact", "post_count"],
1152                         "ap-uuid" => ["apcontact", "uuid"],
1153                         "ap-type" => ["apcontact", "type"],
1154                         "ap-following" => ["apcontact", "following"],
1155                         "ap-followers" => ["apcontact", "followers"],
1156                         "ap-inbox" => ["apcontact", "inbox"],
1157                         "ap-outbox" => ["apcontact", "outbox"],
1158                         "ap-sharedinbox" => ["apcontact", "sharedinbox"],
1159                         "ap-generator" => ["apcontact", "generator"],
1160                         "ap-following_count" => ["apcontact", "following_count"],
1161                         "ap-followers_count" => ["apcontact", "followers_count"],
1162                         "ap-statuses_count" => ["apcontact", "statuses_count"],
1163                         "site_name" => ["gserver", "site_name"],
1164                         "platform" => ["gserver", "platform"],
1165                         "version" => ["gserver", "version"],
1166                         "server-blocked" => ["gserver", "blocked"],
1167                         "server-failed" => ["gserver", "failed"],
1168                 ],
1169                 "query" => "FROM `contact` AS `ucontact`
1170                         INNER JOIN `contact` ON `contact`.`uri-id` = `ucontact`.`uri-id` AND `contact`.`uid` = 0
1171                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `ucontact`.`uri-id`
1172                         LEFT JOIN `apcontact` ON `apcontact`.`uri-id` = `ucontact`.`uri-id`
1173                         LEFT JOIN `diaspora-contact` ON `diaspora-contact`.`uri-id` = `ucontact`.`uri-id`
1174                         LEFT JOIN `gserver` ON `gserver`.`id` = contact.`gsid`"
1175         ],
1176         "pending-view" => [
1177                 "fields" => [
1178                         "id" => ["register", "id"],
1179                         "hash" => ["register", "hash"],
1180                         "created" => ["register", "created"],
1181                         "uid" => ["register", "uid"],
1182                         "password" => ["register", "password"],
1183                         "language" => ["register", "language"],
1184                         "note" => ["register", "note"],
1185                         "self" => ["contact", "self"],
1186                         "name" => ["contact", "name"],
1187                         "url" => ["contact", "url"],
1188                         "micro" => ["contact", "micro"],
1189                         "email" => ["user", "email"],
1190                         "nick" => ["contact", "nick"],
1191                 ],
1192                 "query" => "FROM `register`
1193                         INNER JOIN `contact` ON `register`.`uid` = `contact`.`uid`
1194                         INNER JOIN `user` ON `register`.`uid` = `user`.`uid`"
1195         ],
1196         "tag-search-view" => [
1197                 "fields" => [
1198                         "uri-id" => ["post-tag", "uri-id"],
1199                         "uid" => ["post-user", "uid"],
1200                         "iid" => ["post-user", "id"],
1201                         "private" => ["post-user", "private"],
1202                         "wall" => ["post-user", "wall"],
1203                         "origin" => ["post-user", "origin"],
1204                         "global" => ["post-user", "global"],
1205                         "gravity" => ["post-user", "gravity"],
1206                         "received" => ["post-user", "received"],
1207                         "network" => ["post-user", "network"],
1208                         "author-id" => ["post-user", "author-id"],
1209                         "name" => ["tag", "name"],
1210                 ],
1211                 "query" => "FROM `post-tag`
1212                         INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid`
1213                         STRAIGHT_JOIN `post-user` ON `post-user`.`uri-id` = `post-tag`.`uri-id`
1214                         WHERE `post-tag`.`type` = 1"
1215         ],
1216         "workerqueue-view" => [
1217                 "fields" => [
1218                         "pid" => ["process", "pid"],
1219                         "priority" => ["workerqueue", "priority"],
1220                 ],
1221                 "query" => "FROM `process`
1222                         INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`
1223                         WHERE NOT `workerqueue`.`done`"
1224         ],
1225         "profile_field-view" => [
1226                 "fields" => [
1227                         "id" => ["profile_field", "id"],
1228                         "uid" => ["profile_field", "uid"],
1229                         "label" => ["profile_field", "label"],
1230                         "value" => ["profile_field", "value"],
1231                         "order" => ["profile_field", "order"],
1232                         "psid"=> ["profile_field", "psid"],
1233                         "allow_cid" => ["permissionset", "allow_cid"],
1234                         "allow_gid" => ["permissionset", "allow_gid"],
1235                         "deny_cid" => ["permissionset", "deny_cid"],
1236                         "deny_gid" => ["permissionset", "deny_gid"],
1237                         "created" => ["profile_field", "created"],
1238                         "edited" => ["profile_field", "edited"],
1239                 ],
1240                 "query" => "FROM `profile_field`
1241                         INNER JOIN `permissionset` ON `permissionset`.`id` = `profile_field`.`psid`"
1242         ],
1243         "diaspora-contact-view" => [
1244                 "fields" => [
1245                         "uri-id" => ["diaspora-contact", "uri-id"],
1246                         "url" => ["item-uri", "uri"],
1247                         "guid" => ["item-uri", "guid"],
1248                         "addr" => ["diaspora-contact", "addr"],
1249                         "alias" => ["diaspora-contact", "alias"],
1250                         "nick" => ["diaspora-contact", "nick"],
1251                         "name" => ["diaspora-contact", "name"],
1252                         "given-name" => ["diaspora-contact", "given-name"],
1253                         "family-name" => ["diaspora-contact", "family-name"],
1254                         "photo" => ["diaspora-contact", "photo"],
1255                         "photo-medium" => ["diaspora-contact", "photo-medium"],
1256                         "photo-small" => ["diaspora-contact", "photo-small"],
1257                         "batch" => ["diaspora-contact", "batch"],
1258                         "notify" => ["diaspora-contact", "notify"],
1259                         "poll" => ["diaspora-contact", "poll"],
1260                         "subscribe" => ["diaspora-contact", "subscribe"],
1261                         "searchable" => ["diaspora-contact", "searchable"],
1262                         "pubkey" => ["diaspora-contact", "pubkey"],
1263                         "baseurl" => ["gserver", "url"],
1264                         "gsid" => ["diaspora-contact", "gsid"],
1265                         "created" => ["diaspora-contact", "created"],
1266                         "updated" => ["diaspora-contact", "updated"],
1267                         "interacting_count" => ["diaspora-contact", "interacting_count"],
1268                         "interacted_count" => ["diaspora-contact", "interacted_count"],
1269                         "post_count" => ["diaspora-contact", "post_count"],
1270                 ],
1271                 "query" => "FROM `diaspora-contact`
1272                         INNER JOIN `item-uri` ON `item-uri`.`id` = `diaspora-contact`.`uri-id`
1273                         LEFT JOIN `gserver` ON `gserver`.`id` = `diaspora-contact`.`gsid`"
1274         ],
1275 ];