User Settings: Rename Experiments to Nostr
All checks were successful
continuous-integration/drone/push Build is passing

And use a nostr icon
This commit is contained in:
Râu Cao 2024-03-16 16:03:15 +01:00
parent 2c9ecc1fef
commit 3715cb518b
Signed by: raucao
GPG Key ID: 37036C356E56CC51
5 changed files with 11 additions and 11 deletions

View File

@ -12,7 +12,7 @@ class SettingsController < ApplicationController
end end
def show def show
if @settings_section == "experiments" if @settings_section == "nostr"
session[:shared_secret] ||= SecureRandom.base64(12) session[:shared_secret] ||= SecureRandom.base64(12)
end end
end end
@ -120,7 +120,7 @@ class SettingsController < ApplicationController
def remove_nostr_pubkey def remove_nostr_pubkey
current_user.update! nostr_pubkey: nil current_user.update! nostr_pubkey: nil
redirect_to setting_path(:experiments), flash: { redirect_to setting_path(:nostr), flash: {
success: 'Public key removed from account' success: 'Public key removed from account'
} }
end end
@ -134,8 +134,8 @@ class SettingsController < ApplicationController
def set_settings_section def set_settings_section
@settings_section = params[:section] @settings_section = params[:section]
allowed_sections = [ allowed_sections = [
:profile, :account, :xmpp, :email, :lightning, :remotestorage, :profile, :account, :xmpp, :email,
:experiments :lightning, :remotestorage, :nostr
] ]
unless allowed_sections.include?(@settings_section.to_sym) unless allowed_sections.include?(@settings_section.to_sym)

View File

@ -34,7 +34,7 @@
<% end %> <% end %>
<% if Setting.nostr_enabled %> <% if Setting.nostr_enabled %>
<%= render SidenavLinkComponent.new( <%= render SidenavLinkComponent.new(
name: "Experiments", path: setting_path(:experiments), icon: "science", name: "Nostr", path: setting_path(:nostr), icon: "nostrich-head",
active: @settings_section.to_s == "experiments" active: @settings_section.to_s == "nostr"
) %> ) %>
<% end %> <% end %>

View File

@ -1,6 +1,6 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe 'Experimental Settings', type: :feature do RSpec.describe 'Nostr Settings', type: :feature do
let(:user) { create :user, cn: 'jimmy', ou: 'kosmos.org' } let(:user) { create :user, cn: 'jimmy', ou: 'kosmos.org' }
before do before do
@ -9,7 +9,7 @@ RSpec.describe 'Experimental Settings', type: :feature do
describe 'Adding a nostr pubkey' do describe 'Adding a nostr pubkey' do
scenario 'Without nostr browser extension available' do scenario 'Without nostr browser extension available' do
visit setting_path(:experiments) visit setting_path(:nostr)
expect(page).to have_content("No browser extension found") expect(page).to have_content("No browser extension found")
expect(page).to have_css('button[data-settings--nostr-pubkey-target=setPubkey]:disabled') expect(page).to have_css('button[data-settings--nostr-pubkey-target=setPubkey]:disabled')
end end
@ -26,7 +26,7 @@ RSpec.describe 'Experimental Settings', type: :feature do
end end
scenario 'Remove nostr pubkey from account' do scenario 'Remove nostr pubkey from account' do
visit setting_path(:experiments) visit setting_path(:nostr)
expect(page).to have_field("nostr_public_key", expect(page).to have_field("nostr_public_key",
with: "npub1qlsc3g0lsl8pw8230w8d9wm6xxcax3f6pkemz5measrmwfxjxteslf2hac", with: "npub1qlsc3g0lsl8pw8230w8d9wm6xxcax3f6pkemz5measrmwfxjxteslf2hac",
disabled: true) disabled: true)

View File

@ -7,9 +7,9 @@ RSpec.describe "Settings", type: :request do
login_as user, :scope => :user login_as user, :scope => :user
end end
describe "GET /settings/experiments" do describe "GET /settings/nostr" do
it "works" do it "works" do
get setting_path(:experiments) get setting_path(:nostr)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
end end
end end