Replace "Always show content warning" option with Mastodon-styled content warning button #293

Closed
s0ulf3re wants to merge 12 commits from s0ulf3re/akkoma-fe:s0ulf3re/contentWarningRework into develop
First-time contributor

So I decided to rewrite a little bit of the Akkoma Frontend to include an actual content warning button much like on Mastodon. I thought it looked a little odd to have the content warning out all the time. I'm sorry if this isn't something that's wanted. I just decided to work on it to learn the code a little bit and figured that since it seems to be working so far (tested with the main panel), I would at least upload it here.

Basically, this pull request removes the "always show content warning" option from settings. And in it's place, a content warning button is added directly under the post field. When it's clicked, the field then appears and can have a warning typed in. When it isn't shown, nothing is sent.

So I decided to rewrite a little bit of the Akkoma Frontend to include an actual content warning button much like on Mastodon. I thought it looked a little odd to have the content warning out all the time. I'm sorry if this isn't something that's wanted. I just decided to work on it to learn the code a little bit and figured that since it seems to be working so far (tested with the main panel), I would at least upload it here. Basically, this pull request removes the "always show content warning" option from settings. And in it's place, a content warning button is added directly under the post field. When it's clicked, the field then appears and can have a warning typed in. When it isn't shown, nothing is sent.
s0ulf3re added 11 commits 2023-03-22 23:52:19 +00:00
ci/woodpecker/push/woodpecker Pipeline was successful Details
9c9b4cc07c
Merge branch 'develop' into stable
ci/woodpecker/push/woodpecker Pipeline was successful Details
8569b5946e
Merge branch 'develop' into stable
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/tag/woodpecker Pipeline was successful Details
85abc62213
Merge branch 'develop' into stable
ci/woodpecker/pr/woodpecker Pipeline was successful Details
cd5a09935e
Removed "Always show Content Warning" option
s0ulf3re added 1 commit 2023-03-26 23:54:19 +00:00
ci/woodpecker/pr/woodpecker Pipeline was successful Details
2713ca0c3e
Merge branch 'develop' into s0ulf3re/contentWarningRework
floatingghost reviewed 2023-03-30 10:11:58 +00:00
floatingghost left a comment
Owner

i actually like the general style of this

i've got some feedback on the code itself, but there's also the question of how to make it consistent within the application - the hide image icon that appears over content-warning images is currently a cross, you might want to switch this to an eye to unify it with the icon chosen for the CW input itself

i actually like the general style of this i've got some feedback on the code itself, but there's also the question of how to make it consistent within the application - the `hide image` icon that appears over content-warning images is currently a `cross`, you might want to switch this to an eye to unify it with the icon chosen for the CW input itself
@ -100,6 +100,7 @@ const PostStatusForm = {
'isRedraft'
],
emits: [
'contentWarningFieldVisible',

i don't think you're actually emitting this event anywhere, so you can probably remove this

i don't think you're actually emitting this event anywhere, so you can probably remove this
@ -679,0 +689,4 @@
showContentWarningField() {
if (this.showingContentWarning === true) {
console.log(this.showingContentWarning)
this.$refs['contentWarningField'].focus()

due to the field being hidden under a v-if, we'll need to wait for the next rendering tick for focus to do anything

also, because you check the show condition before switching it, it'll try and focus when it's not visible

this.showingContentWarning = !this.showingContentWarning
if (this.showingContentWarning) {
  this.$nextTick(() => this.$refs['contentWarningField'].focus())
}

should solve this i think

due to the field being hidden under a v-if, we'll need to wait for the next rendering tick for `focus` to do anything also, because you check the show condition _before_ switching it, it'll try and focus when it's not visible ```javascript this.showingContentWarning = !this.showingContentWarning if (this.showingContentWarning) { this.$nextTick(() => this.$refs['contentWarningField'].focus()) } ``` should solve this i think
@ -263,0 +272,4 @@
<!-- Content Warning Button -->
<button
class="emoji-icon button-unstyled"
:title="$t('Add content warning')"

translated strings are done via keys into the i18n json - see src/i18n/en.json

so you'd probably want this to be $('post_status.add_content_warning_button') or similar

translated strings are done via keys into the i18n json - see src/i18n/en.json so you'd probably want this to be `$('post_status.add_content_warning_button')` or similar
Contributor

this pull request removes the "always show content warning" option from settings

Can we keep both? We can have "always show content warning" on -> the field always shows, no button and "always show content warning" off -> the field is hidden until you click the button.

One of the things I like about Pleroma/Akkoma FE is its customizability; I don't find it necessary to remove this option.

> this pull request removes the "always show content warning" option from settings Can we keep both? We can have "always show content warning" on -> the field always shows, no button and "always show content warning" off -> the field is hidden until you click the button. One of the things I like about Pleroma/Akkoma FE is its customizability; I don't find it necessary to remove this option.
Mergan added the
Feature
label 2023-04-12 00:32:57 +00:00

superceded by #362

superceded by #362
floatingghost closed this pull request 2023-12-20 18:50:02 +00:00
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful

Pull request closed

Sign in to join this conversation.
No description provided.