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
Unknown Object (File)
Thu, Mar 21, 7:16 PM
Unknown Object (File)
Thu, Mar 21, 7:15 PM
Unknown Object (File)
Sun, Mar 17, 2:27 PM
Unknown Object (File)
Sat, Mar 2, 9:21 AM
Unknown Object (File)
Fri, Mar 1, 12:50 AM
Unknown Object (File)
Feb 21 2024, 7:09 AM
Unknown Object (File)
Feb 6 2024, 6:52 AM
Unknown Object (File)
Feb 3 2024, 9:28 AM
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
Branch
badgesapi
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 11513
Build 14370: Run Core Tests
Build 14369: arc lint + arc unit

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.