Trading Buttons

Can you check your preferences page to see if the category has been muted for your user?

1 Like

I was about to protest, because the reason I even discovered the problem was that users of the forum (I’m an admin) started complaining about the missing Classifieds section (Category). But you’re right, it is muted for my user. The thing is, I never muted it. Also, it must be muted for other users as well then, since they’re complaining.

How could that have happened?

Thanks!

Did you previously have the category set to be suppressed from the latest page? If so, the category was probably muted for all users on your site by a migration that occurred after that setting was removed. If this is the case, it can be fixed from the rails console.

2 Likes

Nothing in the logs, no. Having re-found the Category (see previous message), I tried posting an ad. It worked but there are no buttons.

I can still see the buttons mentioned (and they’re all checked) in the Category Settings, but they don’t show up on my listings.

Any idea how that could be fixed?

Thanks!

No, at least not as far as I know. Users are complaining though, so it seems as if it has been muted for everyone. How can I fix that from the rails console?

Thanks!

First take a backup of your site in case anything goes wrong. Then:

# Get the category and assign it to a variable
c = Category.find_by(name: "<your category name>")

# Unmute the category for all users
CategoryUser.where(category_id: c.id, notification_level: 0).destroy_all

Edit:
If you’d like to see how many users the category has been muted for, before running the second command, try running

CategoryUser.where(category_id: c.id, notification_level: 0).count

That will return a count of users who have the category muted.

3 Likes

the buttons are visible for topic author when he/she opens the topic… not in the topic list. Or what listing are you talikng about?

Never mind! After I unmuted the Category, the buttons are now showing. Or maybe it was the restart that cleared it. Either way, things are working again now. Sorry to have bothered you with this, thanks for your help!

Gunnar

1 Like

I’m going to give that a try as soon as I get a chance. Thanks!

It’s @simon you should thank. He did the heavy lifting :wink:

2 Likes

Simon,

=> 43653

Oops. :wink:

I have to admit, that .destroy_all part of the above command looks scary. What does it do, just remove the mute flag?

Thanks again!

Any destructive actions run on the console are a little scary. Make sure you take a backup before running them.

A CategoryUser record describes a user’s notification level for a category. A notification_level of 0 means that the category is muted for the user. You can find more information here: (Obsolete) Set category tracking level defaults historically.

Deleting all CategoryUser records for a given category_id with a notification_level of 0, will remove that category from the muted list for all users on your site.

When I run a command like this, I usually add an extra step that I didn’t post above. Instead of running

CategoryUser.where(category_id: c.id, notification_level: 0).destroy_all

in a single step, I’ll assign the records to a variable so that I can double check that I’m dealing with the correct data. Something like this:

# Get the category and assign it to a variable
c = Category.find_by(name: "<your category name>")

# Assign the category_users to a variable and examine the data. Make sure the records have the
# correct category_id etc.
muted_category_users = CategoryUser.where(category_id: c.id, notification_level: 0)

# When you are certain that the data is correct run
muted_category_users.destroy_all
3 Likes

Hi @Janno_Liivak , thank you so much for plugin!

Please add Russain translation. I put in plain text below.

server.ru.yml

ru:
  site_settings:
    topic_trade_buttons_enabled: "Включить кнопки управления продажей?"
  topic_trading:
    sold: Продано
    purchased: Куплено
    exchanged: Обменено
    cancelled: Снято с продажи

client.ru.yml

ru:
  js:
    topic_trading:
      enable_sold_button: Включить кнопку 'Продано' 
      enable_purchased_button: Включить кнопку 'Куплено'
      enable_exchanged_button: Включить кнопку 'Обменено'
      enable_cancelled_button: Включить кнопку 'Снято с продажи'
      sold: Продано
      purchased: Куплено
      exchanged: Обменено
      cancelled: Снято с продажи
      error_while_marked_as_sold: Возникла ошибка при пометке 'Продано'
      error_while_marked_as_purchased: Возникла ошибка при пометке  'Куплено'
      error_while_marked_as_exchanged: Возникла ошибка при пометке  'Обменено'
      error_while_marked_as_cancelled: Возникла ошибка при пометке  'Снято с продажи'
      mark_as_sold_confirm: Вы хотите пометить  объявление как 'Продано'?
      mark_as_purchased_confirm: Вы хотите пометить объявление как 'Куплено'?
      mark_as_exchanged_confirm: Вы хотите пометить объявление как  'Обменено'?
      mark_as_cancelled_confirm: Вы хотите пометить объявление как 'Снято с продажи'?
3 Likes

Hi, and thank you @Dmitry_Krasnoperov ! I added the Russian translation.

For other plugin users… no need to update plugin if you don’t have Russian as a part of your allowed languages… as nothin’ else changed.

2 Likes

THAT WAS SUPERFAST!!! Put in production now.

3 Likes

Hi Janno

I’ve made a German Translation for your Plugin. Would it be possible for you to add them to your Plugin?

You just need to rename it to .yml, because Discourse doesn’t allow to upload it.
client.de.txt (1.1 KB)
server.de.txt (218 Bytes)

4 Likes

Hello, @Lagger_Gandalf! Thank you very much. I added German translations you provided :slight_smile:

3 Likes

Not working on my forum ( sad

Try restarting Discourse after enabling the plugin. If it still doesn’t work try to provide more information about your problem. You can write me a message in Russian …I understand it more or less :slight_smile:

1 Like

Greetings )) I enable all) and restarting discourse =/ nothing change!

1 Like