3 * @copyright Copyright (C) 2010-2023, the Friendica project
5 * @license GNU AGPL version 3 or any later version
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.
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.
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/>.
20 * Main view structure configuration file.
22 * Here are described all the view Friendica needs to work.
24 * Syntax (braces indicate optionale values):
27 * "<field name>" => ["table", "field"],
28 * "<field name>" => "SQL expression",
31 * "query" => "FROM `table` INNER JOIN `other-table` ..."
35 * If you need to make any change, make sure to increment the DB_UPDATE_VERSION constant value in dbstructure.config.php.
40 "application-view" => [
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"],
58 "query" => "FROM `application-token`
59 INNER JOIN `application` ON `application-token`.`application-id` = `application`.`id`"
61 "circle-member-view" => [
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"],
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`"
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-contact-type" => ["author", "contact-type"],
188 "author-gsid" => ["author", "gsid"],
189 "author-baseurl" => ["author", "baseurl"],
190 "owner-id" => ["post-user", "owner-id"],
191 "owner-uri-id" => ["owner", "uri-id"],
192 "owner-link" => ["owner", "url"],
193 "owner-addr" => ["owner", "addr"],
194 "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
195 "owner-nick" => ["owner", "nick"],
196 "owner-alias" => ["owner", "alias"],
197 "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
198 "owner-network" => ["owner", "network"],
199 "owner-blocked" => ["owner", "blocked"],
200 "owner-hidden" => ["owner", "hidden"],
201 "owner-updated" => ["owner", "updated"],
202 "owner-gsid" => ["owner", "gsid"],
203 "owner-contact-type" => ["owner", "contact-type"],
204 "causer-id" => ["post-user", "causer-id"],
205 "causer-uri-id" => ["causer", "uri-id"],
206 "causer-link" => ["causer", "url"],
207 "causer-addr" => ["causer", "addr"],
208 "causer-name" => ["causer", "name"],
209 "causer-nick" => ["causer", "nick"],
210 "causer-alias" => ["causer", "alias"],
211 "causer-avatar" => ["causer", "thumb"],
212 "causer-network" => ["causer", "network"],
213 "causer-blocked" => ["causer", "blocked"],
214 "causer-hidden" => ["causer", "hidden"],
215 "causer-gsid" => ["causer", "gsid"],
216 "causer-contact-type" => ["causer", "contact-type"],
217 "postopts" => ["post-delivery-data", "postopts"],
218 "inform" => ["post-delivery-data", "inform"],
219 "delivery_queue_count" => ["post-delivery-data", "queue_count"],
220 "delivery_queue_done" => ["post-delivery-data", "queue_done"],
221 "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
222 "allow_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
223 "allow_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
224 "deny_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
225 "deny_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
226 "event-id" => ["post-user", "event-id"],
227 "event-created" => ["event", "created"],
228 "event-edited" => ["event", "edited"],
229 "event-start" => ["event", "start"],
230 "event-finish" => ["event", "finish"],
231 "event-summary" => ["event", "summary"],
232 "event-desc" => ["event", "desc"],
233 "event-location" => ["event", "location"],
234 "event-type" => ["event", "type"],
235 "event-nofinish" => ["event", "nofinish"],
236 "event-ignore" => ["event", "ignore"],
237 "question-id" => ["post-question", "id"],
238 "question-multiple" => ["post-question", "multiple"],
239 "question-voters" => ["post-question", "voters"],
240 "question-end-time" => ["post-question", "end-time"],
241 "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`)",
242 "has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-user`.`uri-id`)",
243 "signed_text" => ["diaspora-interaction", "interaction"],
244 "parent-guid" => ["parent-item-uri", "guid"],
245 "parent-network" => ["post-thread-user", "network"],
246 "parent-author-id" => ["post-thread-user", "author-id"],
247 "parent-author-link" => ["parent-post-author", "url"],
248 "parent-author-name" => ["parent-post-author", "name"],
249 "parent-author-nick" => ["parent-post-author", "nick"],
250 "parent-author-network" => ["parent-post-author", "network"],
252 "query" => "FROM `post-user`
253 INNER JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
254 STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
255 STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id`
256 STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
257 LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-user`.`causer-id`
258 LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-user`.`uri-id`
259 LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
260 LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
261 LEFT JOIN `item-uri` AS `conversation-item-uri` ON `conversation-item-uri`.`id` = `post-thread-user`.`conversation-id`
262 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
263 LEFT JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
264 LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
265 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-user`.`uri-id`
266 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-user`.`uri-id`
267 LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
268 LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-user`.`uri-id` AND `post-user`.`origin`
269 LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-user`.`uri-id`
270 LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-user`.`psid`
271 LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `post-thread-user`.`author-id`"
273 "post-thread-user-view" => [
275 "id" => ["post-user", "id"],
276 "post-user-id" => ["post-user", "id"],
277 "uid" => ["post-thread-user", "uid"],
278 "parent" => ["post-thread-user", "post-user-id"],
279 "uri" => ["item-uri", "uri"],
280 "uri-id" => ["post-thread-user", "uri-id"],
281 "parent-uri" => ["parent-item-uri", "uri"],
282 "parent-uri-id" => ["post-user", "parent-uri-id"],
283 "thr-parent" => ["thr-parent-item-uri", "uri"],
284 "thr-parent-id" => ["post-user", "thr-parent-id"],
285 "conversation" => ["conversation-item-uri", "uri"],
286 "conversation-id" => ["post-thread-user", "conversation-id"],
287 "quote-uri" => ["quote-item-uri", "uri"],
288 "quote-uri-id" => ["post-content", "quote-uri-id"],
289 "guid" => ["item-uri", "guid"],
290 "wall" => ["post-thread-user", "wall"],
291 "gravity" => ["post-user", "gravity"],
292 "extid" => ["external-item-uri", "uri"],
293 "external-id" => ["post-user", "external-id"],
294 "created" => ["post-thread-user", "created"],
295 "edited" => ["post-user", "edited"],
296 "commented" => ["post-thread-user", "commented"],
297 "received" => ["post-thread-user", "received"],
298 "changed" => ["post-thread-user", "changed"],
299 "post-type" => ["post-user", "post-type"],
300 "post-reason" => ["post-user", "post-reason"],
301 "private" => ["post-user", "private"],
302 "pubmail" => ["post-thread-user", "pubmail"],
303 "ignored" => ["post-thread-user", "ignored"],
304 "visible" => ["post-user", "visible"],
305 "starred" => ["post-thread-user", "starred"],
306 "unseen" => ["post-thread-user", "unseen"],
307 "deleted" => ["post-user", "deleted"],
308 "origin" => ["post-thread-user", "origin"],
309 "mention" => ["post-thread-user", "mention"],
310 "global" => ["post-user", "global"],
311 "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post-thread-user`.`uri-id`)",
312 "network" => ["post-thread-user", "network"],
313 "vid" => ["post-user", "vid"],
314 "psid" => ["post-thread-user", "psid"],
315 "verb" => "IF (`post-user`.`vid` IS NULL, '', `verb`.`name`)",
316 "title" => ["post-content", "title"],
317 "content-warning" => ["post-content", "content-warning"],
318 "raw-body" => ["post-content", "raw-body"],
319 "body" => ["post-content", "body"],
320 "rendered-hash" => ["post-content", "rendered-hash"],
321 "rendered-html" => ["post-content", "rendered-html"],
322 "language" => ["post-content", "language"],
323 "plink" => ["post-content", "plink"],
324 "location" => ["post-content", "location"],
325 "coord" => ["post-content", "coord"],
326 "app" => ["post-content", "app"],
327 "object-type" => ["post-content", "object-type"],
328 "object" => ["post-content", "object"],
329 "target-type" => ["post-content", "target-type"],
330 "target" => ["post-content", "target"],
331 "resource-id" => ["post-content", "resource-id"],
332 "contact-id" => ["post-thread-user", "contact-id"],
333 "contact-uri-id" => ["contact", "uri-id"],
334 "contact-link" => ["contact", "url"],
335 "contact-addr" => ["contact", "addr"],
336 "contact-name" => ["contact", "name"],
337 "contact-nick" => ["contact", "nick"],
338 "contact-avatar" => ["contact", "thumb"],
339 "contact-network" => ["contact", "network"],
340 "contact-blocked" => ["contact", "blocked"],
341 "contact-hidden" => ["contact", "hidden"],
342 "contact-readonly" => ["contact", "readonly"],
343 "contact-archive" => ["contact", "archive"],
344 "contact-pending" => ["contact", "pending"],
345 "contact-rel" => ["contact", "rel"],
346 "contact-uid" => ["contact", "uid"],
347 "contact-gsid" => ["contact", "gsid"],
348 "contact-contact-type" => ["contact", "contact-type"],
349 "writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
350 "self" => ["contact", "self"],
351 "cid" => ["contact", "id"],
352 "alias" => ["contact", "alias"],
353 "photo" => ["contact", "photo"],
354 "name-date" => ["contact", "name-date"],
355 "uri-date" => ["contact", "uri-date"],
356 "avatar-date" => ["contact", "avatar-date"],
357 "thumb" => ["contact", "thumb"],
358 "author-id" => ["post-thread-user", "author-id"],
359 "author-uri-id" => ["author", "uri-id"],
360 "author-link" => ["author", "url"],
361 "author-addr" => ["author", "addr"],
362 "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
363 "author-nick" => ["author", "nick"],
364 "author-alias" => ["author", "alias"],
365 "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
366 "author-network" => ["author", "network"],
367 "author-blocked" => ["author", "blocked"],
368 "author-hidden" => ["author", "hidden"],
369 "author-updated" => ["author", "updated"],
370 "author-contact-type" => ["author", "contact-type"],
371 "author-gsid" => ["author", "gsid"],
372 "owner-id" => ["post-thread-user", "owner-id"],
373 "owner-uri-id" => ["owner", "uri-id"],
374 "owner-link" => ["owner", "url"],
375 "owner-addr" => ["owner", "addr"],
376 "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
377 "owner-nick" => ["owner", "nick"],
378 "owner-alias" => ["owner", "alias"],
379 "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
380 "owner-network" => ["owner", "network"],
381 "owner-blocked" => ["owner", "blocked"],
382 "owner-hidden" => ["owner", "hidden"],
383 "owner-updated" => ["owner", "updated"],
384 "owner-gsid" => ["owner", "gsid"],
385 "owner-contact-type" => ["owner", "contact-type"],
386 "causer-id" => ["post-thread-user", "causer-id"],
387 "causer-uri-id" => ["causer", "uri-id"],
388 "causer-link" => ["causer", "url"],
389 "causer-addr" => ["causer", "addr"],
390 "causer-name" => ["causer", "name"],
391 "causer-nick" => ["causer", "nick"],
392 "causer-alias" => ["causer", "alias"],
393 "causer-avatar" => ["causer", "thumb"],
394 "causer-network" => ["causer", "network"],
395 "causer-blocked" => ["causer", "blocked"],
396 "causer-hidden" => ["causer", "hidden"],
397 "causer-gsid" => ["causer", "gsid"],
398 "causer-contact-type" => ["causer", "contact-type"],
399 "postopts" => ["post-delivery-data", "postopts"],
400 "inform" => ["post-delivery-data", "inform"],
401 "delivery_queue_count" => ["post-delivery-data", "queue_count"],
402 "delivery_queue_done" => ["post-delivery-data", "queue_done"],
403 "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
404 "allow_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
405 "allow_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
406 "deny_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
407 "deny_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
408 "event-id" => ["post-user", "event-id"],
409 "event-created" => ["event", "created"],
410 "event-edited" => ["event", "edited"],
411 "event-start" => ["event", "start"],
412 "event-finish" => ["event", "finish"],
413 "event-summary" => ["event", "summary"],
414 "event-desc" => ["event", "desc"],
415 "event-location" => ["event", "location"],
416 "event-type" => ["event", "type"],
417 "event-nofinish" => ["event", "nofinish"],
418 "event-ignore" => ["event", "ignore"],
419 "question-id" => ["post-question", "id"],
420 "question-multiple" => ["post-question", "multiple"],
421 "question-voters" => ["post-question", "voters"],
422 "question-end-time" => ["post-question", "end-time"],
423 "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`)",
424 "has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-thread-user`.`uri-id`)",
425 "signed_text" => ["diaspora-interaction", "interaction"],
426 "parent-guid" => ["parent-item-uri", "guid"],
427 "parent-network" => ["post-thread-user", "network"],
428 "parent-author-id" => ["post-thread-user", "author-id"],
429 "parent-author-link" => ["author", "url"],
430 "parent-author-name" => ["author", "name"],
431 "parent-author-nick" => ["author", "nick"],
432 "parent-author-network" => ["author", "network"],
434 "query" => "FROM `post-thread-user`
435 INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
436 STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
437 STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread-user`.`author-id`
438 STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread-user`.`owner-id`
439 LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread-user`.`causer-id`
440 LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread-user`.`uri-id`
441 LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
442 LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
443 LEFT JOIN `item-uri` AS `conversation-item-uri` ON `conversation-item-uri`.`id` = `post-thread-user`.`conversation-id`
444 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
445 LEFT JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
446 LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
447 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread-user`.`uri-id`
448 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread-user`.`uri-id`
449 LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
450 LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-thread-user`.`uri-id` AND `post-thread-user`.`origin`
451 LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread-user`.`uri-id`
452 LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-thread-user`.`psid`"
456 "uri" => ["item-uri", "uri"],
457 "uri-id" => ["post", "uri-id"],
458 "parent-uri" => ["parent-item-uri", "uri"],
459 "parent-uri-id" => ["post", "parent-uri-id"],
460 "thr-parent" => ["thr-parent-item-uri", "uri"],
461 "thr-parent-id" => ["post", "thr-parent-id"],
462 "conversation" => ["conversation-item-uri", "uri"],
463 "conversation-id" => ["post-thread", "conversation-id"],
464 "quote-uri" => ["quote-item-uri", "uri"],
465 "quote-uri-id" => ["post-content", "quote-uri-id"],
466 "guid" => ["item-uri", "guid"],
467 "gravity" => ["post", "gravity"],
468 "extid" => ["external-item-uri", "uri"],
469 "external-id" => ["post", "external-id"],
470 "created" => ["post", "created"],
471 "edited" => ["post", "edited"],
472 "commented" => ["post-thread", "commented"],
473 "received" => ["post", "received"],
474 "changed" => ["post-thread", "changed"],
475 "post-type" => ["post", "post-type"],
476 "private" => ["post", "private"],
477 "visible" => ["post", "visible"],
478 "deleted" => ["post", "deleted"],
479 "global" => ["post", "global"],
480 "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post`.`uri-id`)",
481 "network" => ["post", "network"],
482 "vid" => ["post", "vid"],
483 "verb" => "IF (`post`.`vid` IS NULL, '', `verb`.`name`)",
484 "title" => ["post-content", "title"],
485 "content-warning" => ["post-content", "content-warning"],
486 "raw-body" => ["post-content", "raw-body"],
487 "body" => ["post-content", "body"],
488 "rendered-hash" => ["post-content", "rendered-hash"],
489 "rendered-html" => ["post-content", "rendered-html"],
490 "language" => ["post-content", "language"],
491 "plink" => ["post-content", "plink"],
492 "location" => ["post-content", "location"],
493 "coord" => ["post-content", "coord"],
494 "app" => ["post-content", "app"],
495 "object-type" => ["post-content", "object-type"],
496 "object" => ["post-content", "object"],
497 "target-type" => ["post-content", "target-type"],
498 "target" => ["post-content", "target"],
499 "resource-id" => ["post-content", "resource-id"],
500 "contact-id" => ["post", "author-id"],
501 "contact-uri-id" => ["author", "uri-id"],
502 "contact-link" => ["author", "url"],
503 "contact-addr" => ["author", "addr"],
504 "contact-name" => ["author", "name"],
505 "contact-nick" => ["author", "nick"],
506 "contact-avatar" => ["author", "thumb"],
507 "contact-network" => ["author", "network"],
508 "contact-blocked" => ["author", "blocked"],
509 "contact-hidden" => ["author", "hidden"],
510 "contact-readonly" => ["author", "readonly"],
511 "contact-archive" => ["author", "archive"],
512 "contact-pending" => ["author", "pending"],
513 "contact-rel" => ["author", "rel"],
514 "contact-uid" => ["author", "uid"],
515 "contact-contact-type" => ["author", "contact-type"],
516 "writable" => "IF (`post`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `author`.`writable`)",
518 "cid" => ["author", "id"],
519 "alias" => ["author", "alias"],
520 "photo" => ["author", "photo"],
521 "name-date" => ["author", "name-date"],
522 "uri-date" => ["author", "uri-date"],
523 "avatar-date" => ["author", "avatar-date"],
524 "thumb" => ["author", "thumb"],
525 "author-id" => ["post", "author-id"],
526 "author-uri-id" => ["author", "uri-id"],
527 "author-link" => ["author", "url"],
528 "author-addr" => ["author", "addr"],
529 "author-name" => ["author", "name"],
530 "author-nick" => ["author", "nick"],
531 "author-alias" => ["author", "alias"],
532 "author-avatar" => ["author", "thumb"],
533 "author-network" => ["author", "network"],
534 "author-blocked" => ["author", "blocked"],
535 "author-hidden" => ["author", "hidden"],
536 "author-updated" => ["author", "updated"],
537 "author-contact-type" => ["author", "contact-type"],
538 "author-gsid" => ["author", "gsid"],
539 "owner-id" => ["post", "owner-id"],
540 "owner-uri-id" => ["owner", "uri-id"],
541 "owner-link" => ["owner", "url"],
542 "owner-addr" => ["owner", "addr"],
543 "owner-name" => ["owner", "name"],
544 "owner-nick" => ["owner", "nick"],
545 "owner-alias" => ["owner", "alias"],
546 "owner-avatar" => ["owner", "thumb"],
547 "owner-network" => ["owner", "network"],
548 "owner-blocked" => ["owner", "blocked"],
549 "owner-hidden" => ["owner", "hidden"],
550 "owner-updated" => ["owner", "updated"],
551 "owner-contact-type" => ["owner", "contact-type"],
552 "owner-gsid" => ["owner", "gsid"],
553 "causer-id" => ["post", "causer-id"],
554 "causer-uri-id" => ["causer", "uri-id"],
555 "causer-link" => ["causer", "url"],
556 "causer-addr" => ["causer", "addr"],
557 "causer-name" => ["causer", "name"],
558 "causer-nick" => ["causer", "nick"],
559 "causer-alias" => ["causer", "alias"],
560 "causer-avatar" => ["causer", "thumb"],
561 "causer-network" => ["causer", "network"],
562 "causer-blocked" => ["causer", "blocked"],
563 "causer-hidden" => ["causer", "hidden"],
564 "causer-contact-type" => ["causer", "contact-type"],
565 "causer-gsid" => ["causer", "gsid"],
566 "question-id" => ["post-question", "id"],
567 "question-multiple" => ["post-question", "multiple"],
568 "question-voters" => ["post-question", "voters"],
569 "question-end-time" => ["post-question", "end-time"],
570 "has-categories" => "0",
571 "has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post`.`uri-id`)",
572 "signed_text" => ["diaspora-interaction", "interaction"],
573 "parent-guid" => ["parent-item-uri", "guid"],
574 "parent-network" => ["post-thread", "network"],
575 "parent-author-id" => ["post-thread", "author-id"],
576 "parent-author-link" => ["parent-post-author", "url"],
577 "parent-author-name" => ["parent-post-author", "name"],
578 "parent-author-nick" => ["parent-post-author", "nick"],
579 "parent-author-network" => ["parent-post-author", "network"],
581 "query" => "FROM `post`
582 STRAIGHT_JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`
583 STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post`.`author-id`
584 STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post`.`owner-id`
585 LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post`.`causer-id`
586 LEFT JOIN `item-uri` ON `item-uri`.`id` = `post`.`uri-id`
587 LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post`.`thr-parent-id`
588 LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post`.`parent-uri-id`
589 LEFT JOIN `item-uri` AS `conversation-item-uri` ON `conversation-item-uri`.`id` = `post-thread`.`conversation-id`
590 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post`.`external-id`
591 LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
592 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post`.`uri-id`
593 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post`.`uri-id`
594 LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
595 LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post`.`uri-id`
596 LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `post-thread`.`author-id`"
598 "post-thread-view" => [
600 "uri" => ["item-uri", "uri"],
601 "uri-id" => ["post-thread", "uri-id"],
602 "parent-uri" => ["parent-item-uri", "uri"],
603 "parent-uri-id" => ["post", "parent-uri-id"],
604 "thr-parent" => ["thr-parent-item-uri", "uri"],
605 "thr-parent-id" => ["post", "thr-parent-id"],
606 "conversation" => ["conversation-item-uri", "uri"],
607 "conversation-id" => ["post-thread", "conversation-id"],
608 "quote-uri" => ["quote-item-uri", "uri"],
609 "quote-uri-id" => ["post-content", "quote-uri-id"],
610 "guid" => ["item-uri", "guid"],
611 "gravity" => ["post", "gravity"],
612 "extid" => ["external-item-uri", "uri"],
613 "external-id" => ["post", "external-id"],
614 "created" => ["post-thread", "created"],
615 "edited" => ["post", "edited"],
616 "commented" => ["post-thread", "commented"],
617 "received" => ["post-thread", "received"],
618 "changed" => ["post-thread", "changed"],
619 "post-type" => ["post", "post-type"],
620 "private" => ["post", "private"],
621 "visible" => ["post", "visible"],
622 "deleted" => ["post", "deleted"],
623 "global" => ["post", "global"],
624 "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post-thread`.`uri-id`)",
625 "network" => ["post-thread", "network"],
626 "vid" => ["post", "vid"],
627 "verb" => "IF (`post`.`vid` IS NULL, '', `verb`.`name`)",
628 "title" => ["post-content", "title"],
629 "content-warning" => ["post-content", "content-warning"],
630 "raw-body" => ["post-content", "raw-body"],
631 "body" => ["post-content", "body"],
632 "rendered-hash" => ["post-content", "rendered-hash"],
633 "rendered-html" => ["post-content", "rendered-html"],
634 "language" => ["post-content", "language"],
635 "plink" => ["post-content", "plink"],
636 "location" => ["post-content", "location"],
637 "coord" => ["post-content", "coord"],
638 "app" => ["post-content", "app"],
639 "object-type" => ["post-content", "object-type"],
640 "object" => ["post-content", "object"],
641 "target-type" => ["post-content", "target-type"],
642 "target" => ["post-content", "target"],
643 "resource-id" => ["post-content", "resource-id"],
644 "contact-id" => ["post-thread", "author-id"],
645 "contact-uri-id" => ["author", "uri-id"],
646 "contact-link" => ["author", "url"],
647 "contact-addr" => ["author", "addr"],
648 "contact-name" => ["author", "name"],
649 "contact-nick" => ["author", "nick"],
650 "contact-avatar" => ["author", "thumb"],
651 "contact-network" => ["author", "network"],
652 "contact-blocked" => ["author", "blocked"],
653 "contact-hidden" => ["author", "hidden"],
654 "contact-readonly" => ["author", "readonly"],
655 "contact-archive" => ["author", "archive"],
656 "contact-pending" => ["author", "pending"],
657 "contact-rel" => ["author", "rel"],
658 "contact-uid" => ["author", "uid"],
659 "contact-contact-type" => ["author", "contact-type"],
660 "writable" => "IF (`post`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `author`.`writable`)",
662 "cid" => ["author", "id"],
663 "alias" => ["author", "alias"],
664 "photo" => ["author", "photo"],
665 "name-date" => ["author", "name-date"],
666 "uri-date" => ["author", "uri-date"],
667 "avatar-date" => ["author", "avatar-date"],
668 "thumb" => ["author", "thumb"],
669 "author-id" => ["post-thread", "author-id"],
670 "author-uri-id" => ["author", "uri-id"],
671 "author-link" => ["author", "url"],
672 "author-addr" => ["author", "addr"],
673 "author-name" => ["author", "name"],
674 "author-nick" => ["author", "nick"],
675 "author-alias" => ["author", "alias"],
676 "author-avatar" => ["author", "thumb"],
677 "author-network" => ["author", "network"],
678 "author-blocked" => ["author", "blocked"],
679 "author-hidden" => ["author", "hidden"],
680 "author-updated" => ["author", "updated"],
681 "author-contact-type" => ["author", "contact-type"],
682 "author-gsid" => ["author", "gsid"],
683 "owner-id" => ["post-thread", "owner-id"],
684 "owner-uri-id" => ["owner", "uri-id"],
685 "owner-link" => ["owner", "url"],
686 "owner-addr" => ["owner", "addr"],
687 "owner-name" => ["owner", "name"],
688 "owner-nick" => ["owner", "nick"],
689 "owner-alias" => ["owner", "alias"],
690 "owner-avatar" => ["owner", "thumb"],
691 "owner-network" => ["owner", "network"],
692 "owner-blocked" => ["owner", "blocked"],
693 "owner-hidden" => ["owner", "hidden"],
694 "owner-updated" => ["owner", "updated"],
695 "owner-gsid" => ["owner", "gsid"],
696 "owner-contact-type" => ["owner", "contact-type"],
697 "causer-id" => ["post-thread", "causer-id"],
698 "causer-uri-id" => ["causer", "uri-id"],
699 "causer-link" => ["causer", "url"],
700 "causer-addr" => ["causer", "addr"],
701 "causer-name" => ["causer", "name"],
702 "causer-nick" => ["causer", "nick"],
703 "causer-alias" => ["causer", "alias"],
704 "causer-avatar" => ["causer", "thumb"],
705 "causer-network" => ["causer", "network"],
706 "causer-blocked" => ["causer", "blocked"],
707 "causer-hidden" => ["causer", "hidden"],
708 "causer-gsid" => ["causer", "gsid"],
709 "causer-contact-type" => ["causer", "contact-type"],
710 "question-id" => ["post-question", "id"],
711 "question-multiple" => ["post-question", "multiple"],
712 "question-voters" => ["post-question", "voters"],
713 "question-end-time" => ["post-question", "end-time"],
714 "has-categories" => "0",
715 "has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-thread`.`uri-id`)",
716 "total-comments" => "(SELECT COUNT(*) FROM `post` WHERE `parent-uri-id` = `post-thread`.`uri-id` AND `gravity` = 6)",
717 "total-actors" => "(SELECT COUNT(DISTINCT(`author-id`)) FROM `post` WHERE `parent-uri-id` = `post-thread`.`uri-id` AND `gravity` = 6)",
718 "signed_text" => ["diaspora-interaction", "interaction"],
719 "parent-guid" => ["parent-item-uri", "guid"],
720 "parent-network" => ["post-thread", "network"],
721 "parent-author-id" => ["post-thread", "author-id"],
722 "parent-author-link" => ["author", "url"],
723 "parent-author-name" => ["author", "name"],
724 "parent-author-nick" => ["author", "nick"],
725 "parent-author-network" => ["author", "network"],
727 "query" => "FROM `post-thread`
728 INNER JOIN `post` ON `post`.`uri-id` = `post-thread`.`uri-id`
729 STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread`.`author-id`
730 STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread`.`owner-id`
731 LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread`.`causer-id`
732 LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread`.`uri-id`
733 LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post`.`thr-parent-id`
734 LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post`.`parent-uri-id`
735 LEFT JOIN `item-uri` AS `conversation-item-uri` ON `conversation-item-uri`.`id` = `post-thread`.`conversation-id`
736 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post`.`external-id`
737 LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
738 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread`.`uri-id`
739 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread`.`uri-id`
740 LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
741 LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread`.`uri-id`"
745 "uri-id" => ["post-category", "uri-id"],
746 "uid" => ["post-category", "uid"],
747 "type" => ["post-category", "type"],
748 "tid" => ["post-category", "tid"],
749 "name" => ["tag", "name"],
750 "url" => ["tag", "url"],
752 "query" => "FROM `post-category`
753 LEFT JOIN `tag` ON `post-category`.`tid` = `tag`.`id`"
755 "collection-view" => [
757 "uri-id" => ["post-collection", "uri-id"],
758 "type" => ["post-collection", "type"],
759 "cid" => ["post-collection", "author-id"],
760 "received" => ["post", "received"],
761 "created" => ["post", "created"],
762 "commented" => ["post-thread", "commented"],
763 "private" => ["post", "private"],
764 "visible" => ["post", "visible"],
765 "deleted" => ["post", "deleted"],
766 "thr-parent-id" => ["post", "thr-parent-id"],
767 "author-id" => ["post-collection", "author-id"],
768 "gravity" => ["post", "gravity"],
770 "query" => "FROM `post-collection`
771 INNER JOIN `post` ON `post-collection`.`uri-id` = `post`.`uri-id`
772 INNER JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`"
776 "uri-id" => ["post-media", "uri-id"],
777 "type" => ["post-media", "type"],
778 "received" => ["post", "received"],
779 "created" => ["post", "created"],
780 "private" => ["post", "private"],
781 "visible" => ["post", "visible"],
782 "deleted" => ["post", "deleted"],
783 "thr-parent-id" => ["post", "thr-parent-id"],
784 "author-id" => ["post", "author-id"],
785 "gravity" => ["post", "gravity"],
787 "query" => "FROM `post-media`
788 INNER JOIN `post` ON `post-media`.`uri-id` = `post`.`uri-id`"
792 "uri-id" => ["post-tag", "uri-id"],
793 "type" => ["post-tag", "type"],
794 "tid" => ["post-tag", "tid"],
795 "cid" => ["post-tag", "cid"],
796 "name" => "CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END",
797 "url" => "CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END",
798 "tag-type" => "CASE `cid` WHEN 0 THEN `tag`.`type` ELSE 1 END",
800 "query" => "FROM `post-tag`
801 LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
802 LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`"
804 "network-item-view" => [
806 "uri-id" => ["post-user", "uri-id"],
807 "parent" => ["post-thread-user", "post-user-id"],
808 "received" => ["post-user", "received"],
809 "commented" => ["post-thread-user", "commented"],
810 "created" => ["post-user", "created"],
811 "uid" => ["post-user", "uid"],
812 "starred" => ["post-thread-user", "starred"],
813 "mention" => ["post-thread-user", "mention"],
814 "network" => ["post-user", "network"],
815 "unseen" => ["post-user", "unseen"],
816 "gravity" => ["post-user", "gravity"],
817 "contact-id" => ["post-user", "contact-id"],
818 "contact-type" => ["ownercontact", "contact-type"],
820 "query" => "FROM `post-user`
821 INNER JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
822 STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
823 STRAIGHT_JOIN `contact` AS `authorcontact` ON `authorcontact`.`id` = `post-thread-user`.`author-id`
824 STRAIGHT_JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
825 WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
826 AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
827 AND (`post-user`.`hidden` IS NULL OR NOT `post-user`.`hidden`)
828 AND NOT `authorcontact`.`blocked` AND NOT `ownercontact`.`blocked`
829 AND NOT EXISTS(SELECT `cid` FROM `user-contact` WHERE `uid` = `post-thread-user`.`uid` AND `cid` IN (`authorcontact`.`id`, `ownercontact`.`id`) AND (`blocked` OR `ignored`))
830 AND NOT EXISTS(SELECT `gsid` FROM `user-gserver` WHERE `uid` = `post-thread-user`.`uid` AND `gsid` IN (`authorcontact`.`gsid`, `ownercontact`.`gsid`) AND `ignored`)"
832 "network-thread-view" => [
834 "uri-id" => ["post-thread-user", "uri-id"],
835 "parent" => ["post-thread-user", "post-user-id"],
836 "received" => ["post-thread-user", "received"],
837 "commented" => ["post-thread-user", "commented"],
838 "created" => ["post-thread-user", "created"],
839 "uid" => ["post-thread-user", "uid"],
840 "starred" => ["post-thread-user", "starred"],
841 "mention" => ["post-thread-user", "mention"],
842 "network" => ["post-thread-user", "network"],
843 "contact-id" => ["post-thread-user", "contact-id"],
844 "contact-type" => ["ownercontact", "contact-type"],
846 "query" => "FROM `post-thread-user`
847 INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
848 STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
849 STRAIGHT_JOIN `contact` AS `authorcontact` ON `authorcontact`.`id` = `post-thread-user`.`author-id`
850 STRAIGHT_JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
851 WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
852 AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
853 AND (`post-thread-user`.`hidden` IS NULL OR NOT `post-thread-user`.`hidden`)
854 AND NOT `authorcontact`.`blocked` AND NOT `ownercontact`.`blocked`
855 AND NOT EXISTS(SELECT `cid` FROM `user-contact` WHERE `uid` = `post-thread-user`.`uid` AND `cid` IN (`authorcontact`.`id`, `ownercontact`.`id`) AND (`blocked` OR `ignored`))
856 AND NOT EXISTS(SELECT `gsid` FROM `user-gserver` WHERE `uid` = `post-thread-user`.`uid` AND `gsid` IN (`authorcontact`.`gsid`, `ownercontact`.`gsid`) AND `ignored`)"
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"],
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`"
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"],
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"
1072 "account-user-view" => [
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"],
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`"
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"],
1192 "query" => "FROM `register`
1193 INNER JOIN `contact` ON `register`.`uid` = `contact`.`uid`
1194 INNER JOIN `user` ON `register`.`uid` = `user`.`uid`"
1196 "tag-search-view" => [
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"],
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"
1216 "workerqueue-view" => [
1218 "pid" => ["process", "pid"],
1219 "priority" => ["workerqueue", "priority"],
1221 "query" => "FROM `process`
1222 INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`
1223 WHERE NOT `workerqueue`.`done`"
1225 "profile_field-view" => [
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"],
1240 "query" => "FROM `profile_field`
1241 INNER JOIN `permissionset` ON `permissionset`.`id` = `profile_field`.`psid`"
1243 "diaspora-contact-view" => [
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"],
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`"