Commit graph

20618 commits

Author SHA1 Message Date
William Carroll
239ff24c95 Use ORDER BY to sort the response for GET /trips
SQL is quite useful.
2020-08-02 19:50:28 +01:00
William Carroll
0cb9642a8a Use valid dates for Trips.endDate in trips.csv
TL;DR: My trips.csv had invalid dates for the endDate column. "2020-15-30" is an
"invalid date" (according to FromField instance for Calendar.Day) bc 15 is not a
valid month (i.e. [1,12]).

@dmjio helped me take a look. When we poked around the SQL, we discovered:

```sql
SELECT endDate FROM TRIPS;       -- shows three records
SELECT date(endDate) FROM TRIPS; -- shows two records
```
2020-08-02 19:44:23 +01:00
William Carroll
1d5cf2e4b5 Support Admins inviting users from the client
The title says it all.
2020-08-02 18:02:15 +01:00
William Carroll
a3d783025a Add friendlier and more accurate instructions in invitation email
Copy Example:

To accept the invitation:
  POST /accept-invitation username=<username>
    password=<password> email=you@domain.tld
    secret=8c6b5719-7b1c-471c-bdea-7807b6c0866c
2020-08-02 18:00:29 +01:00
William Carroll
2632dc10fd Ensure /accept-invitation is POST and not GET
Debugged this bug!
2020-08-02 18:00:05 +01:00
William Carroll
90d1451895 Render "<count> days until" for upcoming trips
Per the assignment spec.
2020-08-02 17:45:34 +01:00
William Carroll
e9e84f6a08 Support POST /accept-invitation
Allow users to accept invitations that we email to them.

TL;DR:
- I learned how to write FromHttpApiData instances, which allows me to
  parse/validate data at the edges of my application; this substantially cleans
  up my Handler code.
2020-08-02 16:30:28 +01:00
William Carroll
25334080b9 Support POST /invite
Allow Admin accounts to invite users to the application.
2020-08-02 16:07:35 +01:00
William Carroll
fe609bbe58 Support CRUDing records on Admin page
TL;DR:
- Prefer the more precise verbiage, "Accounts", to "Users"
- Add username field to Trip instead of relying on session.username
- Ensure that decodeRole can JD.fail for invalid inputs
2020-08-02 15:15:01 +01:00
William Carroll
81c3db20d4 Allow managers to CRUD all account types (not just admins)
Per the assignment's instructions.
2020-08-02 14:31:00 +01:00
William Carroll
803db7a5b2 Support printing user's itinerary
- Define print.css with media=print type (note: could've been handled with
  @media queries)
- Define printPage port to interop with window.print() JS function
- Support UI.wrapNoPrint to wrap components with a the no-print CSS
2020-08-02 14:23:38 +01:00
William Carroll
699892883c Support deleting trips from the client
TL;DR:
- Ensure Types.TripPK in Types.hs uses Calendar.Day for startDate
- Prefer verbiage "GotCreateTrip" to "CreatedTrip"
- Extend Utils.deleteWithCredentials to accept a body parameter
- Support a delete button in the UI
2020-08-02 11:16:24 +01:00
William Carroll
d5bc6f963d Protect views from a State with an empty Session
This should simplify UserHome among other views.
2020-08-02 11:13:54 +01:00
William Carroll
57b6472e2f Define defaults for init in State.elm
Problem: When I'm working on a feature, I save my code, and elm-live reloads the
browser. This is usually good, except that the application state is
reinitialized, which usually means that the view changes.

I defined two state configurations, and I expect to define more:
- prod: The initial state for the application
- userHome: The state I'd like to use when developing a feature for the UserHome
  page.

Idea: For more ad-hoc configurations, I can store the application state in
LocalStorage and restore it in between page refreshes.
2020-08-02 10:51:26 +01:00
William Carroll
ac9629cad0 Assign fixed width to error banners
This makes the banners easier to center horizontally.
2020-08-02 10:33:42 +01:00
Griffin Smith
7aebba7531 feat(web/panettone): Add direct anchor links to comments
Fixes: #31
Change-Id: I5a8228229eb2b68bdfc5addd305ab055443aa5a6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1581
Reviewed-by: lukegb <lukegb@tvl.fyi>
Tested-by: BuildkiteCI
2020-08-02 02:57:41 +00:00
Vincent Ambo
688d4c6be3 refactor(paroxysm): Move lazy_static regex definitions to the top
Change-Id: If04cc7ee72230f6b5163d33ef683bcb90bd9bc26
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1554
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-08-02 02:16:24 +00:00
Vincent Ambo
f9840fe2d0 chore(paroxysm): Bump minimum versions of some dependencies
Most of these had already been updated due to how dep constraints are
solved, but it can't hurt to make it explicit.

Change-Id: I1928f5e43a360505e9205f98d007674f6eaf9830
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1553
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-08-02 02:16:24 +00:00
Vincent Ambo
88f69da3ce chore(paroxysm): Remove no-op minor version constraints
... these don't do anything anyways.

Change-Id: Id0b21443eda10361bfb384e876bbbf8fa2e97e15
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1551
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-08-02 02:16:24 +00:00
Vincent Ambo
e663ca4128 refactor(paroxysm): Use derive macros from serde crate
serde_derive is deprecated, the macros have moved behind a
feature-gate in serde itself.

Change-Id: Ib42e7463a81006e23a4fe8a0e48f494610dc8e4c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1550
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-08-02 02:16:24 +00:00
Vincent Ambo
194c498d53 refactor(paroxysm): Explicitly macro imports, no more 'extern crate'
Removes all but one occurence of `extern crate`, to conform with Rust
2018.

The last one is necessary because Diesel is a giant jungle of
complicated macros re-exported from private crates, and the current
version makes it hard to import those directly instead.

Change-Id: Id14165a456d5c3ce6f7a4e0222c611640113eb11
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1549
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-08-02 02:16:24 +00:00
Vincent Ambo
660a02947f chore(paroxysm): Bump Cargo dependencies within constraint
This is just a `cargo update` call.

Change-Id: I3b780cd76d97bf69b793a4c573eb3b9c1d59f88b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1548
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-08-02 02:16:24 +00:00
Griffin Smith
e0d25449e3 fix(3p/nix): Don't reuse ClientContext
It turns out these aren't supposed to be reused after the first request
- reusing it was causing things to blow up.

Change-Id: I935f1ee82ed4e7f26528ae105c8fa2501fa81b97
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1559
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Tested-by: BuildkiteCI
2020-08-02 02:12:14 +00:00
Griffin Smith
b6bab664db feat(web/panettone): Allow editing issues
Allow editing both the subject and the body of issues, recording events
indicating the edit and displaying those events in the issue history.

Fixes: #14
Change-Id: I9ed05271ce9bf6bda4e56f15e249c0f28c862b27
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1517
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2020-08-02 02:08:39 +00:00
Griffin Smith
2646e57aae fix(3p/nix): Prepend unix:// to daemon socket
Prepend the unix:// URI scheme to the daemon socket so that grpc knows
we want to connect to a unix socket rather than another type of URI. As
part of debugging this I made the failure message for the RPCStore
include the URI, which I'm leaving in since it'll be nice to have.

Change-Id: I6e70596895117b9a0d53fe2a61d8542ceb64c940
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1543
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Tested-by: BuildkiteCI
2020-08-02 02:03:24 +00:00
Luke Granger-Brown
1094e356df fix(besadii): Don't add people back to attention set.
This uses the not very documented ignore_default_attention_set_rules review API.

Change-Id: I650777bbbd24a1922f26967fbbd7da06d14b6782
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1513
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2020-08-02 01:18:37 +00:00
Luke Granger-Brown
173f2c8f76 chore(gerrit): Update to latest HEAD.
Change-Id: I650777bbbd24a1922f26967fbbd7da06d14b6786
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1516
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
2020-08-02 01:01:08 +00:00
Kane York
d2eff4153d chore(3p/nix): disable modernize-use-trailing-return-type
Change-Id: I47cba88de5c82923a57804432bdd4f787b78ac8c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1552
Reviewed-by: glittershark <grfn@gws.fyi>
Tested-by: BuildkiteCI
2020-08-01 23:52:45 +00:00
Kane York
72fc2fd27e fix(3p/nix): revert "apply all clang-tidy fixes"
This reverts commit ef54f5da9f.

Resolved conflicts:
	third_party/nix/src/libexpr/eval.cc
	third_party/nix/src/libstore/builtins/fetchurl.cc
	third_party/nix/src/libstore/references.cc
	third_party/nix/src/libutil/hash.cc
	third_party/nix/src/nix-daemon/nix-daemon.cc

Change-Id: Ib9cf6e96a79a23bde3983579ced3f92e530cb011
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1547
Reviewed-by: glittershark <grfn@gws.fyi>
Tested-by: BuildkiteCI
2020-08-01 22:45:15 +00:00
Vincent Ambo
cc3c45f739 fix(whitby): Move Restic's cache into /var/backup/restic
It tries to write this to ~/.cache otherwise, which worked for the git
user but does not work for root (??)

Change-Id: I02d04da7d8e2b8782ce70bc72bce0b90c3961aa0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1546
Reviewed-by: glittershark <grfn@gws.fyi>
Tested-by: BuildkiteCI
2020-08-01 22:28:50 +00:00
Vincent Ambo
cc8033f592 fix(whitby): Make timer unit match the unit it should start
Oversight in the previous CL.

Change-Id: I8767322d7d860fc410796f8d63b7a6c38a8ab447
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1545
Reviewed-by: glittershark <grfn@gws.fyi>
Tested-by: BuildkiteCI
2020-08-01 22:25:05 +00:00
William Carroll
249e3113ff Support creating Trips from the frontend
*sigh* ... spent way too much time encoding/decoding date types...

I need my database, server, client, and JSON need to agree on types.

TL;DR:
- Add CSS for elm/datepicker library
- Create Common.allErrors to display UI errors
- Prefer Data.Time.Calendar.Day instead of newtype Date wrapper around Text
2020-08-01 23:04:06 +01:00
Vincent Ambo
09b3d20031 feat(whitby): Include PostgreSQL dumps in Restic backups
Changes the restic backup service to run as root, rather than git, and
include the PostgreSQL dumps in its scope.

The on-machine credentials have already been placed in the right
location in /var/backup/restic

Fixes: 27
Change-Id: Iae76357442f07596a2297ce7b6d51aae392d2074
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1541
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Reviewed-by: glittershark <grfn@gws.fyi>
Tested-by: BuildkiteCI
2020-08-01 21:50:15 +00:00
Kane York
f7a85c5060 fix(3p/nix/expr): use traceable_allocator for btree_map
The prior use of gc_allocator meant that the btree nodes themselves were being collected. Additionally, have Attr (contains a Value) and Bindings explicitly inherit from gc, even though Bindings is always allocated under `new (GC)`.

Detected by running under GC_ENABLE_INCREMENTAL=1.

Change-Id: Iacf13b34b5aa12e417ea87c9b46e2bf9199fdb26
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1544
Reviewed-by: glittershark <grfn@gws.fyi>
Tested-by: BuildkiteCI
2020-08-01 21:16:29 +00:00
Griffin Smith
3fdce7c6be feat(3p/nix): Implement a few more RPC calls
Implement the RPC client calls for QueryPathFromHashPart,
QuerySubstitutablePaths, and QuerySubstitutablePathInfos, and the
handler for QuerySubstitutablePathInfos.

Refs: #29
Change-Id: Idf383b771f159f267d8f65367bc4af3d239e32b7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1515
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-08-01 19:00:08 +00:00
Kane York
ee48e830e6 fix(3p/nix/libexpr): fix GC tracing in valueSize
Change-Id: I2f6bef7b090d44f50bd27fbd19b50f9cf100b238
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1506
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
Reviewed-by: tazjin <mail@tazj.in>
2020-08-01 18:54:50 +00:00
Kane York
64f6bb6951 feat(3p/nix): remove External values feature
External values are only useful when using the plugin framework, which we are not interested in carrying forward.

Reverts commit 320659b0cd

Change-Id: Ib4929c349bbb33f16224fc674e94c7b7d5953c6a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1505
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
Reviewed-by: tazjin <mail@tazj.in>
2020-08-01 18:54:50 +00:00
Kane York
770034042a fix(3p/nix): Use a proper pointer in Env to carry with-attrs
This eliminates the value-smuggling that would trip up the GC.

Change-Id: I8057df78cf0bf6bea9faf1b44233aa9820ae44f5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1504
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
Reviewed-by: tazjin <mail@tazj.in>
2020-08-01 18:54:50 +00:00
Kane York
dc4c0bad65 chore(3p/nix/libexpr): Cleanups and notes in eval.cc
Add two more garbage-collection flags. Annotate how terrible tExternal is. Prepare to fix the smuggle casting in ExprWith. Add a static_cast.

Change-Id: I20f980abc8cb192e094f539185900a6df5457c29
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1503
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
Reviewed-by: tazjin <mail@tazj.in>
2020-08-01 18:54:50 +00:00
Griffin Smith
be8c883673 feat(gs/emacs): Use semantic imenu in cpp buffers
Change-Id: Icec8ddb8230102286510d6af025bf19cdb33d0d0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1542
Reviewed-by: glittershark <grfn@gws.fyi>
Tested-by: BuildkiteCI
2020-08-01 18:37:34 +00:00
Vincent Ambo
717d12f2f3 feat(whitby): Enable daily PostgreSQL backups
... daily is just the default cron pattern for this, but we might also
want this to happen more frequently. Not sure yet.

Change-Id: I4e433fefebd93488891e765b5842fdb6537e3c6d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1518
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-08-01 16:52:00 +00:00
Luke Granger-Brown
f7d5d5c542 fix(gerrit): Don't do a deep fetch
I don't know what I was smoking.

Change-Id: I650777bbbd24a1922f26967fbbd7da06d14b6781
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1514
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
2020-08-01 15:02:05 +00:00
Vincent Ambo
c9701da602 feat(tazjin/frog): Install screen & xsecurelock
rather than using nix-shell each time ...

Change-Id: If84a84bca4ed892d0d38c5dcfc23a073cbb89e64
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1512
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2020-08-01 14:13:14 +00:00
Vincent Ambo
e2c72e91ed chore(tazjin): Move wallpapers into my user folder
Change-Id: I30901967ff0d65ae4a12a5b74c3baec9a6406971
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1511
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2020-08-01 14:13:14 +00:00
Griffin Smith
05e44c121d feat(3p/nix): Implement AddToStore proto handler
Implement the proto handler for AddToStore, which adds a nix path to the
store. This is implemented by adding a new (probably
soon-to-be-generalized) Source concretion that wraps a grpc ServerReader
for the stream of data we're receiving from the client - this is less
than ideal, as it's perpetuating the source/sink thing that's going on
and storing entire nars in memory, but is at the very worst an
incremental step towards a functioning nix that we can refactor in the
future.

Paired-With: Perry Lorier <isomer@tvl.fyi>
Paired-With: Vincent Ambo <mail@tazj.in>
Change-Id: I48db734e7460a47aee4a85dd5137b690980859e3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1441
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Reviewed-by: tazjin <mail@tazj.in>
2020-08-01 14:11:41 +00:00
William Carroll
54eb29eae0 Prefer RecordWildCard syntax for toFields functions
Refactoring old code to conform to the latest fashion.
2020-08-01 12:29:31 +01:00
William Carroll
83f4f8e9d6 Prevent non-admins from creating Manager or Admin accounts
Client-side, I'm not exposing the role option to users. Server-side, I'm
asserting that requests to create Manager and Admin accounts are attempted by
users with a session tied to an admin account.
2020-08-01 11:48:55 +01:00
William Carroll
a3732300e1 Add exhaustive patterns to FromJSON Role instance
When someone enters something like role=mgr, return a helpful error message to
the user.

Note: I should enable the exhaustive patterns check for GHC.
2020-08-01 11:46:41 +01:00
Vincent Ambo
1fe4a47aa2 fix(ops/paroxysm): Ensure paroxysm is started on boot
Change-Id: Iba6557cbf4e0001277bd996df59318b4308fc92e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1510
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
2020-08-01 02:46:20 +00:00
Griffin Smith
c29f60a350 fix(web/panettone): Don't try to markdownify events
Events - which are interleaved with comments - don't have bodies, so
they can't be converted to markdown.

Change-Id: Iba818b95dab59cae5a08c8b4eca94955e11e584b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1509
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2020-08-01 02:37:34 +00:00