#metabrainz

/

      • CatQuest
        :hmm: you know wouldn't it be really interesting to have a stat graph like https://beta.bookbrainz.org/editor/16 but on musicbrainz? for seeing edits in time?
      • 2021-08-04 21634, 2021

      • reosarevok
        Oh, that's kind of neat
      • 2021-08-04 21627, 2021

      • CatQuest
        ikr?
      • 2021-08-04 21642, 2021

      • yyoung
        reosarevok: Maybe annotate irrelevantLinkTypes with type definition?
      • 2021-08-04 21611, 2021

      • yyoung fought againt flowtype last night and gained some experience.
      • 2021-08-04 21624, 2021

      • bitmap
        reosarevok: you can assign irrelevantLinkTypes[targetType] to a var and check that instead
      • 2021-08-04 21610, 2021

      • reosarevok
        bitmap: I originally had this but had the same error:
      • 2021-08-04 21612, 2021

      • reosarevok
      • 2021-08-04 21628, 2021

      • yyoung
        bitmap: Also is there any workaround for Object.entries, Object.values etc?
      • 2021-08-04 21628, 2021

      • reosarevok
        It doesn't like that I'm trying to do irrelevantLinkTypes[targetType] in the first place
      • 2021-08-04 21658, 2021

      • bitmap
        reosarevok: what's the error?
      • 2021-08-04 21613, 2021

      • reosarevok
      • 2021-08-04 21618, 2021

      • reosarevok
        Same for the rest of the CoreEntityTs
      • 2021-08-04 21638, 2021

      • reosarevok
        I mean, I could just add empty maps for the other entity types, of course, but
      • 2021-08-04 21642, 2021

      • bitmap
        oh right
      • 2021-08-04 21650, 2021

      • bitmap
        I'd just add a $FlowIgnore
      • 2021-08-04 21609, 2021

      • bitmap
        it's not wrong, but we know it's irrelevant
      • 2021-08-04 21618, 2021

      • reosarevok
        ok
      • 2021-08-04 21639, 2021

      • bitmap
        yyoung: usually I just use a type cast and add // $FlowIssue[foo] comment
      • 2021-08-04 21605, 2021

      • bitmap
        alternatively if it's used as a map you can just use a Map, which is easier to type
      • 2021-08-04 21626, 2021

      • reosarevok
        So it should be ok to leave const irrelevantTypesForTargetType = irrelevantLinkTypes[targetType]; and just add the FlowIssue? :)
      • 2021-08-04 21627, 2021

      • bitmap
      • 2021-08-04 21608, 2021

      • bitmap
        reosarevok: yup
      • 2021-08-04 21604, 2021

      • reosarevok
        Thanks! :)
      • 2021-08-04 21643, 2021

      • reosarevok
        bitmap: also, did you see my question about MBS-11844?
      • 2021-08-04 21644, 2021

      • BrainzBot
        MBS-11844: The "Add another relationship" button doesn't include attributes when used under two or more relationships https://tickets.metabrainz.org/browse/MBS-11844
      • 2021-08-04 21650, 2021

      • bitmap
        was just looking
      • 2021-08-04 21647, 2021

      • bitmap
        iiuc this is actually something I fixed in the new rel editor, so I don't think it was entirely intentional
      • 2021-08-04 21606, 2021

      • bitmap
        what did you mean by "so that this doesn't happen if there's more than two relationships with the same attributes above the button"?
      • 2021-08-04 21645, 2021

      • ruaok
      • 2021-08-04 21646, 2021

      • reosarevok
        this doesn't happen - the reusing of the attributes
      • 2021-08-04 21659, 2021

      • reosarevok
        But maybe it was a bug all along, in which case goddamnit, why didn't I fix it like a few years ago
      • 2021-08-04 21611, 2021

      • MRiddickW joined the channel
      • 2021-08-04 21635, 2021

      • yyoung
        reosarevok: Would this work? https://bit.ly/3A6JKmn
      • 2021-08-04 21643, 2021

      • bitmap
        oh nvm I was reading it as 'it was intentional because x'
      • 2021-08-04 21619, 2021

      • reosarevok
        yyoung: we can have relationships to all types, so I would not be able to restrict the target type like this I don't think :)
      • 2021-08-04 21632, 2021

      • reosarevok
        But the flowignore works
      • 2021-08-04 21626, 2021

      • bitmap
        well I guess his point is that adding a {[foo]: ...} (indexer) annotation allows you to access any key, which is true
      • 2021-08-04 21644, 2021

      • yyoung
        Exactly.
      • 2021-08-04 21647, 2021

      • bitmap
        without the annotation flow sees it as a record with specific keys
      • 2021-08-04 21653, 2021

      • reosarevok
        Oh, I see.
      • 2021-08-04 21614, 2021

      • reosarevok
        Well, that seems to work, so why not
      • 2021-08-04 21640, 2021

      • reosarevok
        Was confused by the type CoreEntityTypeT = 'work' | 'recording' | 'url' | 'artist' but i guess that was just for the flowtry, lol
      • 2021-08-04 21653, 2021

      • yyoung
        Yes :D
      • 2021-08-04 21600, 2021

      • reosarevok
        Thanks!
      • 2021-08-04 21641, 2021

      • reosarevok
        bitmap: are you available to look at a bit more of the guess case mess? :)
      • 2021-08-04 21601, 2021

      • bitmap
        yup
      • 2021-08-04 21618, 2021

      • reosarevok
        So, I did Output, seems to work fine
      • 2021-08-04 21622, 2021

      • bitmap was looking at old rel editor code 'cause I could've sworn it used to use the attributes
      • 2021-08-04 21631, 2021

      • reosarevok
        (that also had some methods which we weren't using, etc)
      • 2021-08-04 21645, 2021

      • reosarevok
        Oh, by all means also continue to do that when I stop bothering you :D That's an annoying one
      • 2021-08-04 21630, 2021

      • bitmap
        (it is fixed in the new code at least)
      • 2021-08-04 21619, 2021

      • bitmap
        are Flow types passing on that branch?
      • 2021-08-04 21621, 2021

      • reosarevok
        When are we releasing the new code? :)
      • 2021-08-04 21646, 2021

      • bitmap
        when it's done :D
      • 2021-08-04 21611, 2021

      • reosarevok
        The guess-case-refactoring branch?
      • 2021-08-04 21614, 2021

      • reosarevok
        Currently yes
      • 2021-08-04 21621, 2021

      • bitmap
        cool
      • 2021-08-04 21632, 2021

      • reosarevok
        But I want to get rid of declare type GuessCaseModeT = any;
      • 2021-08-04 21655, 2021

      • bitmap
        declare type GuessCaseOutputT = GuessCaseOutput; <- probably isn't particularly useful anymore
      • 2021-08-04 21631, 2021

      • reosarevok
        Oh. Fair point.
      • 2021-08-04 21629, 2021

      • reosarevok
        But yeah, so
      • 2021-08-04 21630, 2021

      • reosarevok
        root/static/scripts/guess-case/modes.js
      • 2021-08-04 21655, 2021

      • reosarevok
        I guess rather than object assign DefaultMode and whatnot, here we should have a class DefaultMode and other classes that extend it, right?
      • 2021-08-04 21635, 2021

      • bitmap
        hmm, well
      • 2021-08-04 21649, 2021

      • bitmap
        I think we can just leave them as objects since we don't need need/use multiple instances
      • 2021-08-04 21618, 2021

      • bitmap
        in fact Output/Input don't either but they were already written like classes so it was easier to convert them that way
      • 2021-08-04 21613, 2021

      • reosarevok
        I'm just not sure how to even type these so that we can actually use them for flow types :D
      • 2021-08-04 21633, 2021

      • bitmap
        I'd just define a GuessCaseModeT object type based on DefaultMode
      • 2021-08-04 21644, 2021

      • bitmap
        and change these `Object.assign({}, DefaultMode, {...})` to `{...DefaultMode, ...}`, Flow has less issues with spreads now
      • 2021-08-04 21646, 2021

      • bitmap
        as long as they don't add any new properties/methods they should all just be exportable as GuessCaseModeT?
      • 2021-08-04 21659, 2021

      • Etua joined the channel
      • 2021-08-04 21603, 2021

      • reosarevok
        Ok, let's see
      • 2021-08-04 21638, 2021

      • bitmap
        English adds fixEnglishKeyNames but we could probably merge that into runPostProcess since it's only called from there
      • 2021-08-04 21648, 2021

      • bitmap
        we'll have to do that anyway since Flow no longer lets you use 'this' inside object methods
      • 2021-08-04 21613, 2021

      • reosarevok
        Ok, I'll do that
      • 2021-08-04 21652, 2021

      • CatQuest
        ruaok: lol
      • 2021-08-04 21624, 2021

      • CatQuest votes for that being rob's new icon
      • 2021-08-04 21600, 2021

      • reosarevok
      • 2021-08-04 21617, 2021

      • reosarevok
        That's just "string", right?
      • 2021-08-04 21644, 2021

      • reosarevok
        But how do I indicate the type?
      • 2021-08-04 21643, 2021

      • bitmap
        string, yea
      • 2021-08-04 21644, 2021

      • reosarevok
        Yeah, but how did we indicate it exactly?
      • 2021-08-04 21635, 2021

      • reosarevok
        Also, sigh
      • 2021-08-04 21637, 2021

      • reosarevok
      • 2021-08-04 21658, 2021

      • reosarevok
      • 2021-08-04 21609, 2021

      • reosarevok
        Flow, we literally checked it's not null 😢
      • 2021-08-04 21601, 2021

      • reosarevok
        to be fair, I'm sure this can be written in a nicer way
      • 2021-08-04 21603, 2021

      • reosarevok
      • 2021-08-04 21608, 2021

      • reosarevok
        bitmap: help appreciated :)
      • 2021-08-04 21656, 2021

      • bitmap
        +description: string,?
      • 2021-08-04 21641, 2021

      • reosarevok
        Oh. Oh. Duh.
      • 2021-08-04 21601, 2021

      • reosarevok
        I'm typing the functions inside the object, such as
      • 2021-08-04 21604, 2021

      • reosarevok
      • 2021-08-04 21642, 2021

      • reosarevok
        So I guess I was expecting a similar way for the description
      • 2021-08-04 21607, 2021

      • reosarevok
        I guess maybe I need to do that as a separate type, but then does that also require typing the functions there instead?
      • 2021-08-04 21608, 2021

      • bitmap
        I guess for the matches thing you can do the assignment inside an else-branch
      • 2021-08-04 21631, 2021

      • Etua has quit
      • 2021-08-04 21649, 2021

      • reosarevok
        Oh, just like
      • 2021-08-04 21651, 2021

      • reosarevok
      • 2021-08-04 21600, 2021

      • bitmap
        yup
      • 2021-08-04 21603, 2021

      • reosarevok
        Sure, that works, I had thought of that but I was wondering about the while above
      • 2021-08-04 21618, 2021

      • reosarevok
        Like, flow is happy with that one, but wondering if there's a better way or we should leave it be :)
      • 2021-08-04 21636, 2021

      • bitmap
        it seems alright if Flow is ok with it
      • 2021-08-04 21640, 2021

      • reosarevok
        Ok
      • 2021-08-04 21624, 2021

      • reosarevok
        Oh, it says
      • 2021-08-04 21626, 2021

      • reosarevok
      • 2021-08-04 21651, 2021

      • bitmap
        hmm yeah, I was thinking of defining the type separately so that you can do French: GuessCaseModeT =
      • 2021-08-04 21603, 2021

      • bitmap
        otherwise it'll have those issues
      • 2021-08-04 21606, 2021

      • reosarevok
        I guess we could
      • 2021-08-04 21611, 2021

      • reosarevok
        So for the functions, that'd be, say
      • 2021-08-04 21621, 2021

      • Etua joined the channel
      • 2021-08-04 21627, 2021

      • reosarevok
        isLowerCaseWord: (string) => boolean?
      • 2021-08-04 21636, 2021

      • bitmap
        yeah
      • 2021-08-04 21609, 2021

      • reosarevok
        So
      • 2021-08-04 21611, 2021

      • reosarevok
      • 2021-08-04 21624, 2021

      • reosarevok
        (dunno if all of those should be +?)
      • 2021-08-04 21629, 2021

      • reosarevok
        Same for all of
      • 2021-08-04 21631, 2021

      • reosarevok
      • 2021-08-04 21633, 2021

      • reosarevok
        for that matter
      • 2021-08-04 21644, 2021

      • bitmap
        yea I'd make them + unless we intend to overwrite the properties
      • 2021-08-04 21628, 2021

      • bitmap
        like CFG_KEEP_UPPERCASED should probably stay writable
      • 2021-08-04 21609, 2021

      • reosarevok
        bitmap: what do you think about root/static/scripts/guess-case/MB/GuessCase/Main.js?
      • 2021-08-04 21620, 2021

      • reosarevok
        Seems like another thing that wants to be a class
      • 2021-08-04 21647, 2021

      • reosarevok
        At the same time, that's just the current GuessCaseT, so maybe it should be an object? I dunno
      • 2021-08-04 21630, 2021

      • bitmap
        true, let's just keep it as an object
      • 2021-08-04 21634, 2021

      • bitmap
        not sure where to put all these entity handlers though
      • 2021-08-04 21653, 2021

      • peterhil has quit
      • 2021-08-04 21620, 2021

      • bitmap
        we do stuff like (MB.GuessCase: any)[entityType].sortname so I suppose they should stay in an object like that, just not MB.GuessCase
      • 2021-08-04 21635, 2021

      • reosarevok
        Hmm. Can it be an object though?
      • 2021-08-04 21645, 2021

      • reosarevok
      • 2021-08-04 21653, 2021

      • reosarevok
        Can an object do anything like that self. thing?
      • 2021-08-04 21659, 2021

      • reosarevok
        You said flow blocks this.
      • 2021-08-04 21619, 2021

      • reosarevok
        I guess I could just do modes[getCookie('guesscase_mode') || 'English']
      • 2021-08-04 21618, 2021

      • bitmap
        right, or you can assign modeName to a var first
      • 2021-08-04 21628, 2021

      • peterhil joined the channel
      • 2021-08-04 21601, 2021

      • reosarevok
        Oh, I guess
      • 2021-08-04 21636, 2021

      • bitmap
        the thing about Flow blocking 'this' inside methods? this is neither a method nor using 'this'
      • 2021-08-04 21609, 2021

      • reosarevok
        Hmm
      • 2021-08-04 21616, 2021

      • reosarevok
        What about input = new Input(self)?
      • 2021-08-04 21626, 2021

      • reosarevok
        Also do it from the outside?
      • 2021-08-04 21639, 2021

      • bitmap
        oh, circular references. annoying
      • 2021-08-04 21601, 2021

      • bitmap
        is that even possible, since self == GuessCase, right?
      • 2021-08-04 21629, 2021

      • reosarevok
        Yes
      • 2021-08-04 21659, 2021

      • reosarevok
        Well, self, by that time, was an empty object to which modeName, mode and CFG_KEEP_UPPERCASED had been added :p
      • 2021-08-04 21647, 2021

      • reosarevok looks at this code weird
      • 2021-08-04 21638, 2021

      • reosarevok
        outsidecontext: https://twitter.com/chagmed/status/14229176780340… - I assume so but I don't actually know, can you confirm?
      • 2021-08-04 21645, 2021

      • bitmap
        does input/output need to be on the gc object? can't we just import input/output from those files where they're used?
      • 2021-08-04 21601, 2021

      • bitmap
        that'd avoid the circular dependency afaict
      • 2021-08-04 21650, 2021

      • reosarevok
        They're used a lot, but probably don't need to be as such?