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