Page MenuHomePhabricator

Add `badges.edit` and `badges.search` to Conduit API
ClosedPublic

Authored by lpriestley on Apr 5 2016, 6:26 PM.
Tags
None
Referenced Files
F13059510: D15622.diff
Fri, Apr 19, 4:22 PM
Unknown Object (File)
Thu, Apr 18, 8:48 AM
Unknown Object (File)
Fri, Apr 12, 1:06 PM
Unknown Object (File)
Thu, Apr 11, 9:13 AM
Unknown Object (File)
Mon, Apr 1, 12:58 AM
Unknown Object (File)
Sat, Mar 30, 1:26 AM
Unknown Object (File)
Thu, Mar 21, 7:16 PM
Unknown Object (File)
Thu, Mar 21, 7:15 PM
Subscribers

Details

Summary

Ref T10671

Test Plan

Open Conduit application, open badges.edit or badges.search, create, edit, or query for a badge.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

lpriestley retitled this revision from to Add `badges.edit` and `badges.search` to Conduit API.
lpriestley updated this object.
lpriestley edited the test plan for this revision. (Show Details)
lpriestley added a reviewer: epriestley.
epriestley edited edge metadata.
epriestley added inline comments.
src/applications/badges/storage/PhabricatorBadgesBadge.php
212

Small copy/paste issue, paste -> badge.

Also arhived is missing a letter, maybe an issue in Paste too?

225–228

Omit this; PasteContent doesn't make sense in the context of badges. Just return array(), badges have no attachments for now.

This revision is now accepted and ready to land.Apr 5 2016, 6:29 PM
lpriestley marked an inline comment as done.
lpriestley edited edge metadata.

Copy pasta

src/applications/badges/storage/PhabricatorBadgesBadge.php
225–228

Aren't awards attachments?

"Attachments" are a generic way to ask for extra data when you issue a query.

For example, you can ask for the "projects" attachment to get information about project tags, or the "subscribers" attachment to get information about subscribers. These attachments are automatically provided and work on any object which can be tagged with projects or have subscribers.

Some applications provide additional attachments. For example, Paste provides a "paste content" attachment, which lets you fetch the content of the paste. By default, we don't return that, since it could be large and you don't need it for some use cases (like showing a list of pastes).

There are at least three ways badges could return awards:

Attachments: We could add an "awards" attachment. However, this runs into trouble because attachments don't have a standard mechanism for limits/pages, so we'd be forced to return a million rows if a badge had been awarded to a million users. This isn't great.

Separate Method: We could implement something like badges.awards.search to query for badge awards separately. This would work fine, but it's kind of clunky and awkward, and not clearly valuable on its own.

Separate Infrastructure: T5873 discusses possibly introducing new edge/relationship-oriented infrastructure for automatically constructing endpoints that query this type of data. This could potentially cover subscribers, awards, and other kinds of "potentially infinitely many" relationships.

None of these ways are clearly the right way, and we don't actually need this capability, so my recommendation for now is to simply not implement anything. We don't have enough information to choose the best approach and don't need to choose one, so we're best off just delaying the choice until later when we have more information.

(We don't really need these endpoints right now either, but the way forward for them is clear, and they're straightforward to implement, so they make sense to get through before unprototyping.)

This revision was automatically updated to reflect the committed changes.