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-gsid" => ["author", "gsid"],
188 "author-baseurl" => ["author", "baseurl"],
189 "owner-id" => ["post-user", "owner-id"],
190 "owner-uri-id" => ["owner", "uri-id"],
191 "owner-link" => ["owner", "url"],
192 "owner-addr" => ["owner", "addr"],
193 "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
194 "owner-nick" => ["owner", "nick"],
195 "owner-alias" => ["owner", "alias"],
196 "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
197 "owner-network" => ["owner", "network"],
198 "owner-blocked" => ["owner", "blocked"],
199 "owner-hidden" => ["owner", "hidden"],
200 "owner-updated" => ["owner", "updated"],
201 "owner-gsid" => ["owner", "gsid"],
202 "owner-contact-type" => ["owner", "contact-type"],
203 "causer-id" => ["post-user", "causer-id"],
204 "causer-uri-id" => ["causer", "uri-id"],
205 "causer-link" => ["causer", "url"],
206 "causer-addr" => ["causer", "addr"],
207 "causer-name" => ["causer", "name"],
208 "causer-nick" => ["causer", "nick"],
209 "causer-alias" => ["causer", "alias"],
210 "causer-avatar" => ["causer", "thumb"],
211 "causer-network" => ["causer", "network"],
212 "causer-blocked" => ["causer", "blocked"],
213 "causer-hidden" => ["causer", "hidden"],
214 "causer-gsid" => ["causer", "gsid"],
215 "causer-contact-type" => ["causer", "contact-type"],
216 "postopts" => ["post-delivery-data", "postopts"],
217 "inform" => ["post-delivery-data", "inform"],
218 "delivery_queue_count" => ["post-delivery-data", "queue_count"],
219 "delivery_queue_done" => ["post-delivery-data", "queue_done"],
220 "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
221 "allow_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
222 "allow_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
223 "deny_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
224 "deny_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
225 "event-id" => ["post-user", "event-id"],
226 "event-created" => ["event", "created"],
227 "event-edited" => ["event", "edited"],
228 "event-start" => ["event", "start"],
229 "event-finish" => ["event", "finish"],
230 "event-summary" => ["event", "summary"],
231 "event-desc" => ["event", "desc"],
232 "event-location" => ["event", "location"],
233 "event-type" => ["event", "type"],
234 "event-nofinish" => ["event", "nofinish"],
235 "event-ignore" => ["event", "ignore"],
236 "question-id" => ["post-question", "id"],
237 "question-multiple" => ["post-question", "multiple"],
238 "question-voters" => ["post-question", "voters"],
239 "question-end-time" => ["post-question", "end-time"],
240 "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`)",
241 "has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-user`.`uri-id`)",
242 "signed_text" => ["diaspora-interaction", "interaction"],
243 "parent-guid" => ["parent-item-uri", "guid"],
244 "parent-network" => ["post-thread-user", "network"],
245 "parent-author-id" => ["post-thread-user", "author-id"],
246 "parent-author-link" => ["parent-post-author", "url"],
247 "parent-author-name" => ["parent-post-author", "name"],
248 "parent-author-nick" => ["parent-post-author", "nick"],
249 "parent-author-network" => ["parent-post-author", "network"],
251 "query" => "FROM `post-user`
252 INNER JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
253 STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
254 STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id`
255 STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
256 LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-user`.`causer-id`
257 LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-user`.`uri-id`
258 LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
259 LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
260 LEFT JOIN `item-uri` AS `conversation-item-uri` ON `conversation-item-uri`.`id` = `post-thread-user`.`conversation-id`
261 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
262 LEFT JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
263 LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
264 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-user`.`uri-id`
265 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-user`.`uri-id`
266 LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
267 LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-user`.`uri-id` AND `post-user`.`origin`
268 LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-user`.`uri-id`
269 LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-user`.`psid`
270 LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `post-thread-user`.`author-id`"
272 "post-thread-user-view" => [
274 "id" => ["post-user", "id"],
275 "post-user-id" => ["post-user", "id"],
276 "uid" => ["post-thread-user", "uid"],
277 "parent" => ["post-thread-user", "post-user-id"],
278 "uri" => ["item-uri", "uri"],
279 "uri-id" => ["post-thread-user", "uri-id"],
280 "parent-uri" => ["parent-item-uri", "uri"],
281 "parent-uri-id" => ["post-user", "parent-uri-id"],
282 "thr-parent" => ["thr-parent-item-uri", "uri"],
283 "thr-parent-id" => ["post-user", "thr-parent-id"],
284 "conversation" => ["conversation-item-uri", "uri"],
285 "conversation-id" => ["post-thread-user", "conversation-id"],
286 "quote-uri" => ["quote-item-uri", "uri"],
287 "quote-uri-id" => ["post-content", "quote-uri-id"],
288 "guid" => ["item-uri", "guid"],
289 "wall" => ["post-thread-user", "wall"],
290 "gravity" => ["post-user", "gravity"],
291 "extid" => ["external-item-uri", "uri"],
292 "external-id" => ["post-user", "external-id"],
293 "created" => ["post-thread-user", "created"],
294 "edited" => ["post-user", "edited"],
295 "commented" => ["post-thread-user", "commented"],
296 "received" => ["post-thread-user", "received"],
297 "changed" => ["post-thread-user", "changed"],
298 "post-type" => ["post-user", "post-type"],
299 "post-reason" => ["post-user", "post-reason"],
300 "private" => ["post-user", "private"],
301 "pubmail" => ["post-thread-user", "pubmail"],
302 "ignored" => ["post-thread-user", "ignored"],
303 "visible" => ["post-user", "visible"],
304 "starred" => ["post-thread-user", "starred"],
305 "unseen" => ["post-thread-user", "unseen"],
306 "deleted" => ["post-user", "deleted"],
307 "origin" => ["post-thread-user", "origin"],
308 "mention" => ["post-thread-user", "mention"],
309 "global" => ["post-user", "global"],
310 "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post-thread-user`.`uri-id`)",
311 "network" => ["post-thread-user", "network"],
312 "vid" => ["post-user", "vid"],
313 "psid" => ["post-thread-user", "psid"],
314 "verb" => "IF (`post-user`.`vid` IS NULL, '', `verb`.`name`)",
315 "title" => ["post-content", "title"],
316 "content-warning" => ["post-content", "content-warning"],
317 "raw-body" => ["post-content", "raw-body"],
318 "body" => ["post-content", "body"],
319 "rendered-hash" => ["post-content", "rendered-hash"],
320 "rendered-html" => ["post-content", "rendered-html"],
321 "language" => ["post-content", "language"],
322 "plink" => ["post-content", "plink"],
323 "location" => ["post-content", "location"],
324 "coord" => ["post-content", "coord"],
325 "app" => ["post-content", "app"],
326 "object-type" => ["post-content", "object-type"],
327 "object" => ["post-content", "object"],
328 "target-type" => ["post-content", "target-type"],
329 "target" => ["post-content", "target"],
330 "resource-id" => ["post-content", "resource-id"],
331 "contact-id" => ["post-thread-user", "contact-id"],
332 "contact-uri-id" => ["contact", "uri-id"],
333 "contact-link" => ["contact", "url"],
334 "contact-addr" => ["contact", "addr"],
335 "contact-name" => ["contact", "name"],
336 "contact-nick" => ["contact", "nick"],
337 "contact-avatar" => ["contact", "thumb"],
338 "contact-network" => ["contact", "network"],
339 "contact-blocked" => ["contact", "blocked"],
340 "contact-hidden" => ["contact", "hidden"],
341 "contact-readonly" => ["contact", "readonly"],
342 "contact-archive" => ["contact", "archive"],
343 "contact-pending" => ["contact", "pending"],
344 "contact-rel" => ["contact", "rel"],
345 "contact-uid" => ["contact", "uid"],
346 "contact-gsid" => ["contact", "gsid"],
347 "contact-contact-type" => ["contact", "contact-type"],
348 "writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
349 "self" => ["contact", "self"],
350 "cid" => ["contact", "id"],
351 "alias" => ["contact", "alias"],
352 "photo" => ["contact", "photo"],
353 "name-date" => ["contact", "name-date"],
354 "uri-date" => ["contact", "uri-date"],
355 "avatar-date" => ["contact", "avatar-date"],
356 "thumb" => ["contact", "thumb"],
357 "author-id" => ["post-thread-user", "author-id"],
358 "author-uri-id" => ["author", "uri-id"],
359 "author-link" => ["author", "url"],
360 "author-addr" => ["author", "addr"],
361 "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
362 "author-nick" => ["author", "nick"],
363 "author-alias" => ["author", "alias"],
364 "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
365 "author-network" => ["author", "network"],
366 "author-blocked" => ["author", "blocked"],
367 "author-hidden" => ["author", "hidden"],
368 "author-updated" => ["author", "updated"],
369 "author-gsid" => ["author", "gsid"],
370 "owner-id" => ["post-thread-user", "owner-id"],
371 "owner-uri-id" => ["owner", "uri-id"],
372 "owner-link" => ["owner", "url"],
373 "owner-addr" => ["owner", "addr"],
374 "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
375 "owner-nick" => ["owner", "nick"],
376 "owner-alias" => ["owner", "alias"],
377 "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
378 "owner-network" => ["owner", "network"],
379 "owner-blocked" => ["owner", "blocked"],
380 "owner-hidden" => ["owner", "hidden"],
381 "owner-updated" => ["owner", "updated"],
382 "owner-gsid" => ["owner", "gsid"],
383 "owner-contact-type" => ["owner", "contact-type"],
384 "causer-id" => ["post-thread-user", "causer-id"],
385 "causer-uri-id" => ["causer", "uri-id"],
386 "causer-link" => ["causer", "url"],
387 "causer-addr" => ["causer", "addr"],
388 "causer-name" => ["causer", "name"],
389 "causer-nick" => ["causer", "nick"],
390 "causer-alias" => ["causer", "alias"],
391 "causer-avatar" => ["causer", "thumb"],
392 "causer-network" => ["causer", "network"],
393 "causer-blocked" => ["causer", "blocked"],
394 "causer-hidden" => ["causer", "hidden"],
395 "causer-gsid" => ["causer", "gsid"],
396 "causer-contact-type" => ["causer", "contact-type"],
397 "postopts" => ["post-delivery-data", "postopts"],
398 "inform" => ["post-delivery-data", "inform"],
399 "delivery_queue_count" => ["post-delivery-data", "queue_count"],
400 "delivery_queue_done" => ["post-delivery-data", "queue_done"],
401 "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
402 "allow_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
403 "allow_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
404 "deny_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
405 "deny_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
406 "event-id" => ["post-user", "event-id"],
407 "event-created" => ["event", "created"],
408 "event-edited" => ["event", "edited"],
409 "event-start" => ["event", "start"],
410 "event-finish" => ["event", "finish"],
411 "event-summary" => ["event", "summary"],
412 "event-desc" => ["event", "desc"],
413 "event-location" => ["event", "location"],
414 "event-type" => ["event", "type"],
415 "event-nofinish" => ["event", "nofinish"],
416 "event-ignore" => ["event", "ignore"],
417 "question-id" => ["post-question", "id"],
418 "question-multiple" => ["post-question", "multiple"],
419 "question-voters" => ["post-question", "voters"],
420 "question-end-time" => ["post-question", "end-time"],
421 "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`)",
422 "has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-thread-user`.`uri-id`)",
423 "signed_text" => ["diaspora-interaction", "interaction"],
424 "parent-guid" => ["parent-item-uri", "guid"],
425 "parent-network" => ["post-thread-user", "network"],
426 "parent-author-id" => ["post-thread-user", "author-id"],
427 "parent-author-link" => ["author", "url"],
428 "parent-author-name" => ["author", "name"],
429 "parent-author-nick" => ["author", "nick"],
430 "parent-author-network" => ["author", "network"],
432 "query" => "FROM `post-thread-user`
433 INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
434 STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
435 STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread-user`.`author-id`
436 STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread-user`.`owner-id`
437 LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread-user`.`causer-id`
438 LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread-user`.`uri-id`
439 LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
440 LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
441 LEFT JOIN `item-uri` AS `conversation-item-uri` ON `conversation-item-uri`.`id` = `post-thread-user`.`conversation-id`
442 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
443 LEFT JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
444 LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
445 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread-user`.`uri-id`
446 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread-user`.`uri-id`
447 LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
448 LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-thread-user`.`uri-id` AND `post-thread-user`.`origin`
449 LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread-user`.`uri-id`
450 LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-thread-user`.`psid`"
454 "uri" => ["item-uri", "uri"],
455 "uri-id" => ["post", "uri-id"],
456 "parent-uri" => ["parent-item-uri", "uri"],
457 "parent-uri-id" => ["post", "parent-uri-id"],
458 "thr-parent" => ["thr-parent-item-uri", "uri"],
459 "thr-parent-id" => ["post", "thr-parent-id"],
460 "conversation" => ["conversation-item-uri", "uri"],
461 "conversation-id" => ["post-thread", "conversation-id"],
462 "quote-uri" => ["quote-item-uri", "uri"],
463 "quote-uri-id" => ["post-content", "quote-uri-id"],
464 "guid" => ["item-uri", "guid"],
465 "gravity" => ["post", "gravity"],
466 "extid" => ["external-item-uri", "uri"],
467 "external-id" => ["post", "external-id"],
468 "created" => ["post", "created"],
469 "edited" => ["post", "edited"],
470 "commented" => ["post-thread", "commented"],
471 "received" => ["post", "received"],
472 "changed" => ["post-thread", "changed"],
473 "post-type" => ["post", "post-type"],
474 "private" => ["post", "private"],
475 "visible" => ["post", "visible"],
476 "deleted" => ["post", "deleted"],
477 "global" => ["post", "global"],
478 "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post`.`uri-id`)",
479 "network" => ["post", "network"],
480 "vid" => ["post", "vid"],
481 "verb" => "IF (`post`.`vid` IS NULL, '', `verb`.`name`)",
482 "title" => ["post-content", "title"],
483 "content-warning" => ["post-content", "content-warning"],
484 "raw-body" => ["post-content", "raw-body"],
485 "body" => ["post-content", "body"],
486 "rendered-hash" => ["post-content", "rendered-hash"],
487 "rendered-html" => ["post-content", "rendered-html"],
488 "language" => ["post-content", "language"],
489 "plink" => ["post-content", "plink"],
490 "location" => ["post-content", "location"],
491 "coord" => ["post-content", "coord"],
492 "app" => ["post-content", "app"],
493 "object-type" => ["post-content", "object-type"],
494 "object" => ["post-content", "object"],
495 "target-type" => ["post-content", "target-type"],
496 "target" => ["post-content", "target"],
497 "resource-id" => ["post-content", "resource-id"],
498 "contact-id" => ["post", "author-id"],
499 "contact-uri-id" => ["author", "uri-id"],
500 "contact-link" => ["author", "url"],
501 "contact-addr" => ["author", "addr"],
502 "contact-name" => ["author", "name"],
503 "contact-nick" => ["author", "nick"],
504 "contact-avatar" => ["author", "thumb"],
505 "contact-network" => ["author", "network"],
506 "contact-blocked" => ["author", "blocked"],
507 "contact-hidden" => ["author", "hidden"],
508 "contact-readonly" => ["author", "readonly"],
509 "contact-archive" => ["author", "archive"],
510 "contact-pending" => ["author", "pending"],
511 "contact-rel" => ["author", "rel"],
512 "contact-uid" => ["author", "uid"],
513 "contact-contact-type" => ["author", "contact-type"],
514 "writable" => "IF (`post`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `author`.`writable`)",
516 "cid" => ["author", "id"],
517 "alias" => ["author", "alias"],
518 "photo" => ["author", "photo"],
519 "name-date" => ["author", "name-date"],
520 "uri-date" => ["author", "uri-date"],
521 "avatar-date" => ["author", "avatar-date"],
522 "thumb" => ["author", "thumb"],
523 "author-id" => ["post", "author-id"],
524 "author-uri-id" => ["author", "uri-id"],
525 "author-link" => ["author", "url"],
526 "author-addr" => ["author", "addr"],
527 "author-name" => ["author", "name"],
528 "author-nick" => ["author", "nick"],
529 "author-alias" => ["author", "alias"],
530 "author-avatar" => ["author", "thumb"],
531 "author-network" => ["author", "network"],
532 "author-blocked" => ["author", "blocked"],
533 "author-hidden" => ["author", "hidden"],
534 "author-updated" => ["author", "updated"],
535 "author-gsid" => ["author", "gsid"],
536 "owner-id" => ["post", "owner-id"],
537 "owner-uri-id" => ["owner", "uri-id"],
538 "owner-link" => ["owner", "url"],
539 "owner-addr" => ["owner", "addr"],
540 "owner-name" => ["owner", "name"],
541 "owner-nick" => ["owner", "nick"],
542 "owner-alias" => ["owner", "alias"],
543 "owner-avatar" => ["owner", "thumb"],
544 "owner-network" => ["owner", "network"],
545 "owner-blocked" => ["owner", "blocked"],
546 "owner-hidden" => ["owner", "hidden"],
547 "owner-updated" => ["owner", "updated"],
548 "owner-contact-type" => ["owner", "contact-type"],
549 "owner-gsid" => ["owner", "gsid"],
550 "causer-id" => ["post", "causer-id"],
551 "causer-uri-id" => ["causer", "uri-id"],
552 "causer-link" => ["causer", "url"],
553 "causer-addr" => ["causer", "addr"],
554 "causer-name" => ["causer", "name"],
555 "causer-nick" => ["causer", "nick"],
556 "causer-alias" => ["causer", "alias"],
557 "causer-avatar" => ["causer", "thumb"],
558 "causer-network" => ["causer", "network"],
559 "causer-blocked" => ["causer", "blocked"],
560 "causer-hidden" => ["causer", "hidden"],
561 "causer-contact-type" => ["causer", "contact-type"],
562 "causer-gsid" => ["causer", "gsid"],
563 "question-id" => ["post-question", "id"],
564 "question-multiple" => ["post-question", "multiple"],
565 "question-voters" => ["post-question", "voters"],
566 "question-end-time" => ["post-question", "end-time"],
567 "has-categories" => "0",
568 "has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post`.`uri-id`)",
569 "signed_text" => ["diaspora-interaction", "interaction"],
570 "parent-guid" => ["parent-item-uri", "guid"],
571 "parent-network" => ["post-thread", "network"],
572 "parent-author-id" => ["post-thread", "author-id"],
573 "parent-author-link" => ["parent-post-author", "url"],
574 "parent-author-name" => ["parent-post-author", "name"],
575 "parent-author-nick" => ["parent-post-author", "nick"],
576 "parent-author-network" => ["parent-post-author", "network"],
578 "query" => "FROM `post`
579 STRAIGHT_JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`
580 STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post`.`author-id`
581 STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post`.`owner-id`
582 LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post`.`causer-id`
583 LEFT JOIN `item-uri` ON `item-uri`.`id` = `post`.`uri-id`
584 LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post`.`thr-parent-id`
585 LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post`.`parent-uri-id`
586 LEFT JOIN `item-uri` AS `conversation-item-uri` ON `conversation-item-uri`.`id` = `post-thread`.`conversation-id`
587 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post`.`external-id`
588 LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
589 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post`.`uri-id`
590 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post`.`uri-id`
591 LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
592 LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post`.`uri-id`
593 LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `post-thread`.`author-id`"
595 "post-thread-view" => [
597 "uri" => ["item-uri", "uri"],
598 "uri-id" => ["post-thread", "uri-id"],
599 "parent-uri" => ["parent-item-uri", "uri"],
600 "parent-uri-id" => ["post", "parent-uri-id"],
601 "thr-parent" => ["thr-parent-item-uri", "uri"],
602 "thr-parent-id" => ["post", "thr-parent-id"],
603 "conversation" => ["conversation-item-uri", "uri"],
604 "conversation-id" => ["post-thread", "conversation-id"],
605 "quote-uri" => ["quote-item-uri", "uri"],
606 "quote-uri-id" => ["post-content", "quote-uri-id"],
607 "guid" => ["item-uri", "guid"],
608 "gravity" => ["post", "gravity"],
609 "extid" => ["external-item-uri", "uri"],
610 "external-id" => ["post", "external-id"],
611 "created" => ["post-thread", "created"],
612 "edited" => ["post", "edited"],
613 "commented" => ["post-thread", "commented"],
614 "received" => ["post-thread", "received"],
615 "changed" => ["post-thread", "changed"],
616 "post-type" => ["post", "post-type"],
617 "private" => ["post", "private"],
618 "visible" => ["post", "visible"],
619 "deleted" => ["post", "deleted"],
620 "global" => ["post", "global"],
621 "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post-thread`.`uri-id`)",
622 "network" => ["post-thread", "network"],
623 "vid" => ["post", "vid"],
624 "verb" => "IF (`post`.`vid` IS NULL, '', `verb`.`name`)",
625 "title" => ["post-content", "title"],
626 "content-warning" => ["post-content", "content-warning"],
627 "raw-body" => ["post-content", "raw-body"],
628 "body" => ["post-content", "body"],
629 "rendered-hash" => ["post-content", "rendered-hash"],
630 "rendered-html" => ["post-content", "rendered-html"],
631 "language" => ["post-content", "language"],
632 "plink" => ["post-content", "plink"],
633 "location" => ["post-content", "location"],
634 "coord" => ["post-content", "coord"],
635 "app" => ["post-content", "app"],
636 "object-type" => ["post-content", "object-type"],
637 "object" => ["post-content", "object"],
638 "target-type" => ["post-content", "target-type"],
639 "target" => ["post-content", "target"],
640 "resource-id" => ["post-content", "resource-id"],
641 "contact-id" => ["post-thread", "author-id"],
642 "contact-uri-id" => ["author", "uri-id"],
643 "contact-link" => ["author", "url"],
644 "contact-addr" => ["author", "addr"],
645 "contact-name" => ["author", "name"],
646 "contact-nick" => ["author", "nick"],
647 "contact-avatar" => ["author", "thumb"],
648 "contact-network" => ["author", "network"],
649 "contact-blocked" => ["author", "blocked"],
650 "contact-hidden" => ["author", "hidden"],
651 "contact-readonly" => ["author", "readonly"],
652 "contact-archive" => ["author", "archive"],
653 "contact-pending" => ["author", "pending"],
654 "contact-rel" => ["author", "rel"],
655 "contact-uid" => ["author", "uid"],
656 "contact-contact-type" => ["author", "contact-type"],
657 "writable" => "IF (`post`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `author`.`writable`)",
659 "cid" => ["author", "id"],
660 "alias" => ["author", "alias"],
661 "photo" => ["author", "photo"],
662 "name-date" => ["author", "name-date"],
663 "uri-date" => ["author", "uri-date"],
664 "avatar-date" => ["author", "avatar-date"],
665 "thumb" => ["author", "thumb"],
666 "author-id" => ["post-thread", "author-id"],
667 "author-uri-id" => ["author", "uri-id"],
668 "author-link" => ["author", "url"],
669 "author-addr" => ["author", "addr"],
670 "author-name" => ["author", "name"],
671 "author-nick" => ["author", "nick"],
672 "author-alias" => ["author", "alias"],
673 "author-avatar" => ["author", "thumb"],
674 "author-network" => ["author", "network"],
675 "author-blocked" => ["author", "blocked"],
676 "author-hidden" => ["author", "hidden"],
677 "author-updated" => ["author", "updated"],
678 "author-gsid" => ["author", "gsid"],
679 "owner-id" => ["post-thread", "owner-id"],
680 "owner-uri-id" => ["owner", "uri-id"],
681 "owner-link" => ["owner", "url"],
682 "owner-addr" => ["owner", "addr"],
683 "owner-name" => ["owner", "name"],
684 "owner-nick" => ["owner", "nick"],
685 "owner-alias" => ["owner", "alias"],
686 "owner-avatar" => ["owner", "thumb"],
687 "owner-network" => ["owner", "network"],
688 "owner-blocked" => ["owner", "blocked"],
689 "owner-hidden" => ["owner", "hidden"],
690 "owner-updated" => ["owner", "updated"],
691 "owner-gsid" => ["owner", "gsid"],
692 "owner-contact-type" => ["owner", "contact-type"],
693 "causer-id" => ["post-thread", "causer-id"],
694 "causer-uri-id" => ["causer", "uri-id"],
695 "causer-link" => ["causer", "url"],
696 "causer-addr" => ["causer", "addr"],
697 "causer-name" => ["causer", "name"],
698 "causer-nick" => ["causer", "nick"],
699 "causer-alias" => ["causer", "alias"],
700 "causer-avatar" => ["causer", "thumb"],
701 "causer-network" => ["causer", "network"],
702 "causer-blocked" => ["causer", "blocked"],
703 "causer-hidden" => ["causer", "hidden"],
704 "causer-gsid" => ["causer", "gsid"],
705 "causer-contact-type" => ["causer", "contact-type"],
706 "question-id" => ["post-question", "id"],
707 "question-multiple" => ["post-question", "multiple"],
708 "question-voters" => ["post-question", "voters"],
709 "question-end-time" => ["post-question", "end-time"],
710 "has-categories" => "0",
711 "has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-thread`.`uri-id`)",
712 "total-comments" => "(SELECT COUNT(*) FROM `post` WHERE `parent-uri-id` = `post-thread`.`uri-id` AND `gravity` = 6)",
713 "total-actors" => "(SELECT COUNT(DISTINCT(`author-id`)) FROM `post` WHERE `parent-uri-id` = `post-thread`.`uri-id` AND `gravity` = 6)",
714 "signed_text" => ["diaspora-interaction", "interaction"],
715 "parent-guid" => ["parent-item-uri", "guid"],
716 "parent-network" => ["post-thread", "network"],
717 "parent-author-id" => ["post-thread", "author-id"],
718 "parent-author-link" => ["author", "url"],
719 "parent-author-name" => ["author", "name"],
720 "parent-author-nick" => ["author", "nick"],
721 "parent-author-network" => ["author", "network"],
723 "query" => "FROM `post-thread`
724 INNER JOIN `post` ON `post`.`uri-id` = `post-thread`.`uri-id`
725 STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread`.`author-id`
726 STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread`.`owner-id`
727 LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread`.`causer-id`
728 LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread`.`uri-id`
729 LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post`.`thr-parent-id`
730 LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post`.`parent-uri-id`
731 LEFT JOIN `item-uri` AS `conversation-item-uri` ON `conversation-item-uri`.`id` = `post-thread`.`conversation-id`
732 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post`.`external-id`
733 LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
734 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread`.`uri-id`
735 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread`.`uri-id`
736 LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
737 LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread`.`uri-id`"
741 "uri-id" => ["post-category", "uri-id"],
742 "uid" => ["post-category", "uid"],
743 "type" => ["post-category", "type"],
744 "tid" => ["post-category", "tid"],
745 "name" => ["tag", "name"],
746 "url" => ["tag", "url"],
748 "query" => "FROM `post-category`
749 LEFT JOIN `tag` ON `post-category`.`tid` = `tag`.`id`"
751 "collection-view" => [
753 "uri-id" => ["post-collection", "uri-id"],
754 "type" => ["post-collection", "type"],
755 "cid" => ["post-collection", "author-id"],
756 "received" => ["post", "received"],
757 "created" => ["post", "created"],
758 "commented" => ["post-thread", "commented"],
759 "private" => ["post", "private"],
760 "visible" => ["post", "visible"],
761 "deleted" => ["post", "deleted"],
762 "thr-parent-id" => ["post", "thr-parent-id"],
763 "author-id" => ["post-collection", "author-id"],
764 "gravity" => ["post", "gravity"],
766 "query" => "FROM `post-collection`
767 INNER JOIN `post` ON `post-collection`.`uri-id` = `post`.`uri-id`
768 INNER JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`"
772 "uri-id" => ["post-media", "uri-id"],
773 "type" => ["post-media", "type"],
774 "received" => ["post", "received"],
775 "created" => ["post", "created"],
776 "private" => ["post", "private"],
777 "visible" => ["post", "visible"],
778 "deleted" => ["post", "deleted"],
779 "thr-parent-id" => ["post", "thr-parent-id"],
780 "author-id" => ["post", "author-id"],
781 "gravity" => ["post", "gravity"],
783 "query" => "FROM `post-media`
784 INNER JOIN `post` ON `post-media`.`uri-id` = `post`.`uri-id`"
788 "uri-id" => ["post-tag", "uri-id"],
789 "type" => ["post-tag", "type"],
790 "tid" => ["post-tag", "tid"],
791 "cid" => ["post-tag", "cid"],
792 "name" => "CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END",
793 "url" => "CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END",
794 "tag-type" => "CASE `cid` WHEN 0 THEN `tag`.`type` ELSE 1 END",
796 "query" => "FROM `post-tag`
797 LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
798 LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`"
800 "network-item-view" => [
802 "uri-id" => ["post-user", "uri-id"],
803 "parent" => ["post-thread-user", "post-user-id"],
804 "received" => ["post-user", "received"],
805 "commented" => ["post-thread-user", "commented"],
806 "created" => ["post-user", "created"],
807 "uid" => ["post-user", "uid"],
808 "starred" => ["post-thread-user", "starred"],
809 "mention" => ["post-thread-user", "mention"],
810 "network" => ["post-user", "network"],
811 "unseen" => ["post-user", "unseen"],
812 "gravity" => ["post-user", "gravity"],
813 "contact-id" => ["post-user", "contact-id"],
814 "contact-type" => ["ownercontact", "contact-type"],
816 "query" => "FROM `post-user`
817 INNER JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
818 STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
819 STRAIGHT_JOIN `contact` AS `authorcontact` ON `authorcontact`.`id` = `post-thread-user`.`author-id`
820 STRAIGHT_JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
821 WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
822 AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
823 AND (`post-user`.`hidden` IS NULL OR NOT `post-user`.`hidden`)
824 AND NOT `authorcontact`.`blocked` AND NOT `ownercontact`.`blocked`
825 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`))
826 AND NOT EXISTS(SELECT `gsid` FROM `user-gserver` WHERE `uid` = `post-thread-user`.`uid` AND `gsid` IN (`authorcontact`.`gsid`, `ownercontact`.`gsid`) AND `ignored`)"
828 "network-thread-view" => [
830 "uri-id" => ["post-thread-user", "uri-id"],
831 "parent" => ["post-thread-user", "post-user-id"],
832 "received" => ["post-thread-user", "received"],
833 "commented" => ["post-thread-user", "commented"],
834 "created" => ["post-thread-user", "created"],
835 "uid" => ["post-thread-user", "uid"],
836 "starred" => ["post-thread-user", "starred"],
837 "mention" => ["post-thread-user", "mention"],
838 "network" => ["post-thread-user", "network"],
839 "contact-id" => ["post-thread-user", "contact-id"],
840 "contact-type" => ["ownercontact", "contact-type"],
842 "query" => "FROM `post-thread-user`
843 INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
844 STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
845 STRAIGHT_JOIN `contact` AS `authorcontact` ON `authorcontact`.`id` = `post-thread-user`.`author-id`
846 STRAIGHT_JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
847 WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
848 AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
849 AND (`post-thread-user`.`hidden` IS NULL OR NOT `post-thread-user`.`hidden`)
850 AND NOT `authorcontact`.`blocked` AND NOT `ownercontact`.`blocked`
851 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`))
852 AND NOT EXISTS(SELECT `gsid` FROM `user-gserver` WHERE `uid` = `post-thread-user`.`uid` AND `gsid` IN (`authorcontact`.`gsid`, `ownercontact`.`gsid`) AND `ignored`)"
856 "id" => ["contact", "id"],
857 "uid" => ["contact", "uid"],
858 "created" => ["contact", "created"],
859 "updated" => ["contact", "updated"],
860 "self" => ["contact", "self"],
861 "remote_self" => ["contact", "remote_self"],
862 "rel" => ["contact", "rel"],
863 "network" => ["contact", "network"],
864 "protocol" => ["contact", "protocol"],
865 "name" => ["contact", "name"],
866 "nick" => ["contact", "nick"],
867 "location" => ["contact", "location"],
868 "about" => ["contact", "about"],
869 "keywords" => ["contact", "keywords"],
870 "xmpp" => ["contact", "xmpp"],
871 "matrix" => ["contact", "matrix"],
872 "attag" => ["contact", "attag"],
873 "avatar" => ["contact", "avatar"],
874 "photo" => ["contact", "photo"],
875 "thumb" => ["contact", "thumb"],
876 "micro" => ["contact", "micro"],
877 "header" => ["contact", "header"],
878 "url" => ["contact", "url"],
879 "nurl" => ["contact", "nurl"],
880 "uri-id" => ["contact", "uri-id"],
881 "addr" => ["contact", "addr"],
882 "alias" => ["contact", "alias"],
883 "pubkey" => ["contact", "pubkey"],
884 "prvkey" => ["contact", "prvkey"],
885 "batch" => ["contact", "batch"],
886 "request" => ["contact", "request"],
887 "notify" => ["contact", "notify"],
888 "poll" => ["contact", "poll"],
889 "confirm" => ["contact", "confirm"],
890 "poco" => ["contact", "poco"],
891 "subhub" => ["contact", "subhub"],
892 "hub-verify" => ["contact", "hub-verify"],
893 "last-update" => ["contact", "last-update"],
894 "success_update" => ["contact", "success_update"],
895 "failure_update" => ["contact", "failure_update"],
896 "name-date" => ["contact", "name-date"],
897 "uri-date" => ["contact", "uri-date"],
898 "avatar-date" => ["contact", "avatar-date"],
899 "picdate" => ["contact", "avatar-date"], /// @todo Replaces all uses of "picdate" with "avatar-date"
900 "term-date" => ["contact", "term-date"],
901 "last-item" => ["contact", "last-item"],
902 "priority" => ["contact", "priority"],
903 "blocked" => ["user", "blocked"],
904 "block_reason" => ["contact", "block_reason"],
905 "readonly" => ["contact", "readonly"],
906 "writable" => ["contact", "writable"],
907 "forum" => ["contact", "forum"],
908 "prv" => ["contact", "prv"],
909 "contact-type" => ["contact", "contact-type"],
910 "manually-approve" => ["contact", "manually-approve"],
911 "hidden" => ["contact", "hidden"],
912 "archive" => ["contact", "archive"],
913 "pending" => ["contact", "pending"],
914 "deleted" => ["contact", "deleted"],
915 "unsearchable" => ["contact", "unsearchable"],
916 "sensitive" => ["contact", "sensitive"],
917 "baseurl" => ["contact", "baseurl"],
918 "reason" => ["contact", "reason"],
919 "info" => ["contact", "info"],
920 "bdyear" => ["contact", "bdyear"],
921 "bd" => ["contact", "bd"],
922 "notify_new_posts" => ["contact", "notify_new_posts"],
923 "fetch_further_information" => ["contact", "fetch_further_information"],
924 "ffi_keyword_denylist" => ["contact", "ffi_keyword_denylist"],
925 "parent-uid" => ["user", "parent-uid"],
926 "guid" => ["user", "guid"],
927 "nickname" => ["user", "nickname"], /// @todo Replaces all uses of "nickname" with "nick"
928 "email" => ["user", "email"],
929 "openid" => ["user", "openid"],
930 "timezone" => ["user", "timezone"],
931 "language" => ["user", "language"],
932 "register_date" => ["user", "register_date"],
933 "login_date" => ["user", "login_date"],
934 "last-activity" => ["user", "last-activity"],
935 "default-location" => ["user", "default-location"],
936 "allow_location" => ["user", "allow_location"],
937 "theme" => ["user", "theme"],
938 "upubkey" => ["user", "pubkey"],
939 "uprvkey" => ["user", "prvkey"],
940 "sprvkey" => ["user", "sprvkey"],
941 "spubkey" => ["user", "spubkey"],
942 "verified" => ["user", "verified"],
943 "blockwall" => ["user", "blockwall"],
944 "hidewall" => ["user", "hidewall"],
945 "blocktags" => ["user", "blocktags"],
946 "unkmail" => ["user", "unkmail"],
947 "cntunkmail" => ["user", "cntunkmail"],
948 "notify-flags" => ["user", "notify-flags"],
949 "page-flags" => ["user", "page-flags"],
950 "account-type" => ["user", "account-type"],
951 "prvnets" => ["user", "prvnets"],
952 "maxreq" => ["user", "maxreq"],
953 "expire" => ["user", "expire"],
954 "account_removed" => ["user", "account_removed"],
955 "account_expired" => ["user", "account_expired"],
956 "account_expires_on" => ["user", "account_expires_on"],
957 "expire_notification_sent" => ["user", "expire_notification_sent"],
958 "def_gid" => ["user", "def_gid"],
959 "allow_cid" => ["user", "allow_cid"],
960 "allow_gid" => ["user", "allow_gid"],
961 "deny_cid" => ["user", "deny_cid"],
962 "deny_gid" => ["user", "deny_gid"],
963 "openidserver" => ["user", "openidserver"],
964 "publish" => ["profile", "publish"],
965 "net-publish" => ["profile", "net-publish"],
966 "hide-friends" => ["profile", "hide-friends"],
967 "prv_keywords" => ["profile", "prv_keywords"],
968 "pub_keywords" => ["profile", "pub_keywords"],
969 "address" => ["profile", "address"],
970 "locality" => ["profile", "locality"],
971 "region" => ["profile", "region"],
972 "postal-code" => ["profile", "postal-code"],
973 "country-name" => ["profile", "country-name"],
974 "homepage" => ["profile", "homepage"],
975 "homepage_verified" => ["profile", "homepage_verified"],
976 "dob" => ["profile", "dob"],
978 "query" => "FROM `user`
979 INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
980 INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid`"
984 "id" => ["contact", "id"],
985 "url" => ["contact", "url"],
986 "nurl" => ["contact", "nurl"],
987 "uri-id" => ["contact", "uri-id"],
988 "guid" => ["item-uri", "guid"],
989 "addr" => ["contact", "addr"],
990 "alias" => ["contact", "alias"],
991 "name" => ["contact", "name"],
992 "nick" => ["contact", "nick"],
993 "about" => ["contact", "about"],
994 "keywords" => ["contact", "keywords"],
995 "xmpp" => ["contact", "xmpp"],
996 "matrix" => ["contact", "matrix"],
997 "avatar" => ["contact", "avatar"],
998 "photo" => ["contact", "photo"],
999 "thumb" => ["contact", "thumb"],
1000 "micro" => ["contact", "micro"],
1001 "header" => ["contact", "header"],
1002 "created" => ["contact", "created"],
1003 "updated" => ["contact", "updated"],
1004 "network" => ["contact", "network"],
1005 "protocol" => ["contact", "protocol"],
1006 "location" => ["contact", "location"],
1007 "attag" => ["contact", "attag"],
1008 "pubkey" => ["contact", "pubkey"],
1009 "prvkey" => ["contact", "prvkey"],
1010 "subscribe" => ["contact", "subscribe"],
1011 "last-update" => ["contact", "last-update"],
1012 "success_update" => ["contact", "success_update"],
1013 "failure_update" => ["contact", "failure_update"],
1014 "failed" => ["contact", "failed"],
1015 "last-item" => ["contact", "last-item"],
1016 "last-discovery" => ["contact", "last-discovery"],
1017 "contact-type" => ["contact", "contact-type"],
1018 "manually-approve" => ["contact", "manually-approve"],
1019 "unsearchable" => ["contact", "unsearchable"],
1020 "sensitive" => ["contact", "sensitive"],
1021 "baseurl" => ["contact", "baseurl"],
1022 "gsid" => ["contact", "gsid"],
1023 "info" => ["contact", "info"],
1024 "bdyear" => ["contact", "bdyear"],
1025 "bd" => ["contact", "bd"],
1026 "poco" => ["contact", "poco"],
1027 "name-date" => ["contact", "name-date"],
1028 "uri-date" => ["contact", "uri-date"],
1029 "avatar-date" => ["contact", "avatar-date"],
1030 "term-date" => ["contact", "term-date"],
1031 "global-ignored" => ["contact", "hidden"],
1032 "global-blocked" => ["contact", "blocked"],
1033 "hidden" => ["contact", "hidden"],
1034 "archive" => ["contact", "archive"],
1035 "deleted" => ["contact", "deleted"],
1036 "blocked" => ["contact", "blocked"],
1037 "dfrn-notify" => ["contact", "notify"],
1038 "dfrn-poll" => ["contact", "poll"],
1039 "diaspora-guid" => ["item-uri", "guid"],
1040 "diaspora-batch" => ["diaspora-contact", "batch"],
1041 "diaspora-notify" => ["diaspora-contact", "notify"],
1042 "diaspora-poll" => ["diaspora-contact", "poll"],
1043 "diaspora-alias" => ["diaspora-contact", "alias"],
1044 "ap-uuid" => ["apcontact", "uuid"],
1045 "ap-type" => ["apcontact", "type"],
1046 "ap-following" => ["apcontact", "following"],
1047 "ap-followers" => ["apcontact", "followers"],
1048 "ap-inbox" => ["apcontact", "inbox"],
1049 "ap-outbox" => ["apcontact", "outbox"],
1050 "ap-sharedinbox" => ["apcontact", "sharedinbox"],
1051 "ap-generator" => ["apcontact", "generator"],
1052 "ap-following_count" => ["apcontact", "following_count"],
1053 "ap-followers_count" => ["apcontact", "followers_count"],
1054 "ap-statuses_count" => ["apcontact", "statuses_count"],
1055 "site_name" => ["gserver", "site_name"],
1056 "platform" => ["gserver", "platform"],
1057 "version" => ["gserver", "version"],
1058 "server-blocked" => ["gserver", "blocked"],
1059 "server-failed" => ["gserver", "failed"],
1061 "query" => "FROM `contact`
1062 LEFT JOIN `item-uri` ON `item-uri`.`id` = `contact`.`uri-id`
1063 LEFT JOIN `apcontact` ON `apcontact`.`uri-id` = `contact`.`uri-id`
1064 LEFT JOIN `diaspora-contact` ON `diaspora-contact`.`uri-id` = contact.`uri-id`
1065 LEFT JOIN `gserver` ON `gserver`.`id` = contact.`gsid`
1066 WHERE `contact`.`uid` = 0"
1068 "account-user-view" => [
1070 "id" => ["ucontact", "id"],
1071 "pid" => ["contact", "id"],
1072 "uid" => ["ucontact", "uid"],
1073 "url" => ["contact", "url"],
1074 "nurl" => ["contact", "nurl"],
1075 "uri-id" => ["contact", "uri-id"],
1076 "guid" => ["item-uri", "guid"],
1077 "addr" => ["contact", "addr"],
1078 "alias" => ["contact", "alias"],
1079 "name" => ["contact", "name"],
1080 "nick" => ["contact", "nick"],
1081 "about" => ["contact", "about"],
1082 "keywords" => ["contact", "keywords"],
1083 "xmpp" => ["contact", "xmpp"],
1084 "matrix" => ["contact", "matrix"],
1085 "avatar" => ["contact", "avatar"],
1086 "photo" => ["contact", "photo"],
1087 "thumb" => ["contact", "thumb"],
1088 "micro" => ["contact", "micro"],
1089 "header" => ["contact", "header"],
1090 "created" => ["contact", "created"],
1091 "updated" => ["contact", "updated"],
1092 "self" => ["ucontact", "self"],
1093 "remote_self" => ["ucontact", "remote_self"],
1094 "rel" => ["ucontact", "rel"],
1095 "network" => ["contact", "network"],
1096 "protocol" => ["ucontact", "protocol"],
1097 "location" => ["contact", "location"],
1098 "attag" => ["ucontact", "attag"],
1099 "pubkey" => ["contact", "pubkey"],
1100 "prvkey" => ["contact", "prvkey"],
1101 "subscribe" => ["contact", "subscribe"],
1102 "last-update" => ["contact", "last-update"],
1103 "success_update" => ["contact", "success_update"],
1104 "failure_update" => ["contact", "failure_update"],
1105 "failed" => ["contact", "failed"],
1106 "last-item" => ["contact", "last-item"],
1107 "last-discovery" => ["contact", "last-discovery"],
1108 "contact-type" => ["contact", "contact-type"],
1109 "manually-approve" => ["contact", "manually-approve"],
1110 "unsearchable" => ["contact", "unsearchable"],
1111 "sensitive" => ["contact", "sensitive"],
1112 "baseurl" => ["contact", "baseurl"],
1113 "gsid" => ["contact", "gsid"],
1114 "info" => ["ucontact", "info"],
1115 "bdyear" => ["contact", "bdyear"],
1116 "bd" => ["contact", "bd"],
1117 "poco" => ["contact", "poco"],
1118 "name-date" => ["contact", "name-date"],
1119 "uri-date" => ["contact", "uri-date"],
1120 "avatar-date" => ["contact", "avatar-date"],
1121 "term-date" => ["contact", "term-date"],
1122 "global-ignored" => ["contact", "hidden"],
1123 "global-blocked" => ["contact", "blocked"],
1124 "hidden" => ["ucontact", "hidden"],
1125 "archive" => ["ucontact", "archive"],
1126 "pending" => ["ucontact", "pending"],
1127 "deleted" => ["ucontact", "deleted"],
1128 "notify_new_posts" => ["ucontact", "notify_new_posts"],
1129 "fetch_further_information" => ["ucontact", "fetch_further_information"],
1130 "ffi_keyword_denylist" => ["ucontact", "ffi_keyword_denylist"],
1131 "rating" => ["ucontact", "rating"],
1132 "readonly" => ["ucontact", "readonly"],
1133 "blocked" => ["ucontact", "blocked"],
1134 "block_reason" => ["ucontact", "block_reason"],
1135 "subhub" => ["ucontact", "subhub"],
1136 "hub-verify" => ["ucontact", "hub-verify"],
1137 "reason" => ["ucontact", "reason"],
1138 "dfrn-notify" => ["contact", "notify"],
1139 "dfrn-poll" => ["contact", "poll"],
1140 "diaspora-guid" => ["item-uri", "guid"],
1141 "diaspora-batch" => ["diaspora-contact", "batch"],
1142 "diaspora-notify" => ["diaspora-contact", "notify"],
1143 "diaspora-poll" => ["diaspora-contact", "poll"],
1144 "diaspora-alias" => ["diaspora-contact", "alias"],
1145 "diaspora-interacting_count" => ["diaspora-contact", "interacting_count"],
1146 "diaspora-interacted_count" => ["diaspora-contact", "interacted_count"],
1147 "diaspora-post_count" => ["diaspora-contact", "post_count"],
1148 "ap-uuid" => ["apcontact", "uuid"],
1149 "ap-type" => ["apcontact", "type"],
1150 "ap-following" => ["apcontact", "following"],
1151 "ap-followers" => ["apcontact", "followers"],
1152 "ap-inbox" => ["apcontact", "inbox"],
1153 "ap-outbox" => ["apcontact", "outbox"],
1154 "ap-sharedinbox" => ["apcontact", "sharedinbox"],
1155 "ap-generator" => ["apcontact", "generator"],
1156 "ap-following_count" => ["apcontact", "following_count"],
1157 "ap-followers_count" => ["apcontact", "followers_count"],
1158 "ap-statuses_count" => ["apcontact", "statuses_count"],
1159 "site_name" => ["gserver", "site_name"],
1160 "platform" => ["gserver", "platform"],
1161 "version" => ["gserver", "version"],
1162 "server-blocked" => ["gserver", "blocked"],
1163 "server-failed" => ["gserver", "failed"],
1165 "query" => "FROM `contact` AS `ucontact`
1166 INNER JOIN `contact` ON `contact`.`uri-id` = `ucontact`.`uri-id` AND `contact`.`uid` = 0
1167 LEFT JOIN `item-uri` ON `item-uri`.`id` = `ucontact`.`uri-id`
1168 LEFT JOIN `apcontact` ON `apcontact`.`uri-id` = `ucontact`.`uri-id`
1169 LEFT JOIN `diaspora-contact` ON `diaspora-contact`.`uri-id` = `ucontact`.`uri-id`
1170 LEFT JOIN `gserver` ON `gserver`.`id` = contact.`gsid`"
1174 "id" => ["register", "id"],
1175 "hash" => ["register", "hash"],
1176 "created" => ["register", "created"],
1177 "uid" => ["register", "uid"],
1178 "password" => ["register", "password"],
1179 "language" => ["register", "language"],
1180 "note" => ["register", "note"],
1181 "self" => ["contact", "self"],
1182 "name" => ["contact", "name"],
1183 "url" => ["contact", "url"],
1184 "micro" => ["contact", "micro"],
1185 "email" => ["user", "email"],
1186 "nick" => ["contact", "nick"],
1188 "query" => "FROM `register`
1189 INNER JOIN `contact` ON `register`.`uid` = `contact`.`uid`
1190 INNER JOIN `user` ON `register`.`uid` = `user`.`uid`"
1192 "tag-search-view" => [
1194 "uri-id" => ["post-tag", "uri-id"],
1195 "uid" => ["post-user", "uid"],
1196 "iid" => ["post-user", "id"],
1197 "private" => ["post-user", "private"],
1198 "wall" => ["post-user", "wall"],
1199 "origin" => ["post-user", "origin"],
1200 "global" => ["post-user", "global"],
1201 "gravity" => ["post-user", "gravity"],
1202 "received" => ["post-user", "received"],
1203 "network" => ["post-user", "network"],
1204 "author-id" => ["post-user", "author-id"],
1205 "name" => ["tag", "name"],
1207 "query" => "FROM `post-tag`
1208 INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid`
1209 STRAIGHT_JOIN `post-user` ON `post-user`.`uri-id` = `post-tag`.`uri-id`
1210 WHERE `post-tag`.`type` = 1"
1212 "workerqueue-view" => [
1214 "pid" => ["process", "pid"],
1215 "priority" => ["workerqueue", "priority"],
1217 "query" => "FROM `process`
1218 INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`
1219 WHERE NOT `workerqueue`.`done`"
1221 "profile_field-view" => [
1223 "id" => ["profile_field", "id"],
1224 "uid" => ["profile_field", "uid"],
1225 "label" => ["profile_field", "label"],
1226 "value" => ["profile_field", "value"],
1227 "order" => ["profile_field", "order"],
1228 "psid"=> ["profile_field", "psid"],
1229 "allow_cid" => ["permissionset", "allow_cid"],
1230 "allow_gid" => ["permissionset", "allow_gid"],
1231 "deny_cid" => ["permissionset", "deny_cid"],
1232 "deny_gid" => ["permissionset", "deny_gid"],
1233 "created" => ["profile_field", "created"],
1234 "edited" => ["profile_field", "edited"],
1236 "query" => "FROM `profile_field`
1237 INNER JOIN `permissionset` ON `permissionset`.`id` = `profile_field`.`psid`"
1239 "diaspora-contact-view" => [
1241 "uri-id" => ["diaspora-contact", "uri-id"],
1242 "url" => ["item-uri", "uri"],
1243 "guid" => ["item-uri", "guid"],
1244 "addr" => ["diaspora-contact", "addr"],
1245 "alias" => ["diaspora-contact", "alias"],
1246 "nick" => ["diaspora-contact", "nick"],
1247 "name" => ["diaspora-contact", "name"],
1248 "given-name" => ["diaspora-contact", "given-name"],
1249 "family-name" => ["diaspora-contact", "family-name"],
1250 "photo" => ["diaspora-contact", "photo"],
1251 "photo-medium" => ["diaspora-contact", "photo-medium"],
1252 "photo-small" => ["diaspora-contact", "photo-small"],
1253 "batch" => ["diaspora-contact", "batch"],
1254 "notify" => ["diaspora-contact", "notify"],
1255 "poll" => ["diaspora-contact", "poll"],
1256 "subscribe" => ["diaspora-contact", "subscribe"],
1257 "searchable" => ["diaspora-contact", "searchable"],
1258 "pubkey" => ["diaspora-contact", "pubkey"],
1259 "baseurl" => ["gserver", "url"],
1260 "gsid" => ["diaspora-contact", "gsid"],
1261 "created" => ["diaspora-contact", "created"],
1262 "updated" => ["diaspora-contact", "updated"],
1263 "interacting_count" => ["diaspora-contact", "interacting_count"],
1264 "interacted_count" => ["diaspora-contact", "interacted_count"],
1265 "post_count" => ["diaspora-contact", "post_count"],
1267 "query" => "FROM `diaspora-contact`
1268 INNER JOIN `item-uri` ON `item-uri`.`id` = `diaspora-contact`.`uri-id`
1269 LEFT JOIN `gserver` ON `gserver`.`id` = `diaspora-contact`.`gsid`"