Gay But Not Narrow (ruakh) wrote in lj_dev,
Gay But Not Narrow

S2: viewer_owns_style() : bool; journal_owns_style() : bool;

Arising from discussion here:

Currently, if a given style is being applied to given journal, that means either (1) that said style belongs to said journal account; or (2) that said style belongs to the logged-in viewer.

Now, in a custom style, it's easy for a layer to determine whether #1 is the case, by hardcoding the style's owner's username and comparing it to get_page().journal.username; and it's easy to use that to determine whether #2 is the case (#2 is the case whenever #1 is not, plus whenever viewer_is_owner()). (This isn't exactly best coding practice - their layer code will now be specific to them - but whatever.)

In a public style, there's no way to determine whether #1 or #2 is the case. Personally, I think it would be useful if a style like Component would only display the Free Text area (which is specific to the style owner) when #1 is the case (so that someone using Component with style=mine wouldn't see their Free Text area on others' journals). To this end, I think there should be a global function, journal_owns_style() : bool, to check if #1 is the case. Also, though I don't see a good use for it, and though it's easily derived from journal_owns_style() and viewer_is_owner(), I think symmetry would desire a global function viewer_owns_style() : bool to complement journal_owns_style().

What do you all think?

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded