you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 3 insightful - 1 fun3 insightful - 0 fun4 insightful - 1 fun -  (12 children)

Or, how about this d3rr, we make it so that when Orangutan unchecks the box while submitting, it remembers that preference. And we don't add anything to the Preferences page at all.

Oh shit, that's it. Love it. So we'll still use a preference for this, we just won't add it to the preferences page at all. Let me dig up some code examples.

[–]magnora7[S] 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 1 fun -  (11 children)

Maybe we can add

 pref_post_sends_replies=Vboolean("post_sends_replies"),

in to preferences.py

Then we just have to add this line to the start of newlink.html, which is also at the start of prefoptions.html

 <%def name="checkbox(text, name, disabled = False, disabled_text = '', prefix = 'pref_')">

then also later in the file at the checkbox add

${checkbox(_("send replies to my inbox"), "post_sends_replies")}

This might be a problem with users who don't have an account though? And how to we set it default to on?

[–][deleted] 3 insightful - 1 fun3 insightful - 0 fun4 insightful - 1 fun -  (10 children)

I think we can skip any preferences.py changes since we're not going to be showing this preference.

So I think we'd want

${checkbox(_("send replies to my inbox"), c.user.pref_sendreplies)}

So the final missing piece is hooking into the post submit functionality, to set the user's preference to whatever checkbox state they just used.

[–]magnora7[S] 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 1 fun -  (6 children)

c.user.pref_sendreplies

Do we have to create this first somewhere?

pref_post_sends_replies=VBoolean("post_sends_replies"),

has to be added to the top of newlink.html or something then? Doesn't that need to be in a python file?

[–][deleted] 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 1 fun -  (5 children)

Do we have to create this first somewhere?

Yes, see here https://github.com/libertysoft3/reddit-ae/blob/88b6edc4e2361a903215ed57ce4767043f4ef5c3/r2/r2/models/account.py#L166

pref_post_sends_replies=VBoolean("post_sends_replies"),

I don't think we need this at all, this is only to validate form input for the preferences page. "post_sends_replies" would be the form field name, but it doesn't exist.

[–]magnora7[S] 3 insightful - 1 fun3 insightful - 0 fun4 insightful - 1 fun -  (4 children)

Oh okay. See you in chat

[–][deleted] 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 1 fun -  (3 children)

alright this feature is live and appears to be working https://github.com/libertysoft3/reddit-ae/commit/a911826c6939a7ab6b63955435cabb4c49e2dc7e edit: I didn't tell Orangutan go for it.

[–]magnora7[S] 3 insightful - 1 fun3 insightful - 0 fun4 insightful - 1 fun -  (2 children)

Nice! I tested it out and it works! I'll let him know.

[–][deleted] 3 insightful - 1 fun3 insightful - 0 fun4 insightful - 1 fun -  (1 child)

Sweet, I feel like we've gotten over a little dry spell, starting with your sorting changes.

I also think I mislead you a bit last night by talking about that checkbox field which we didn't end up changing at all, so sorry about that. I was confusing it with the new post page checkbox.

[–]magnora7[S] 3 insightful - 1 fun3 insightful - 0 fun4 insightful - 1 fun -  (0 children)

No worries, we got there in the end. Nice work.

[–]magnora7[S] 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 1 fun -  (2 children)

So the final missing piece is hooking into the post submit functionality, to set the user's preference to whatever checkbox state they just used.

That's the exact functionality we have in the preferences page, so I think your code should already accomplish that, as long as c.user.pref_sendreplies is defined correctly as a preference somewhere

[–][deleted] 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 1 fun -  (1 child)

I don't know if we're on the same page anymore. I was imagining this with no preferences page interactions. Wanna chat in saiditdev?

[–]magnora7[S] 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 1 fun -  (0 children)

sure. No preference page stuff, but storing the preferences in preferences.py because that's where all the pref_ stuff is defined