Move nostr pubkeys to LDAP attribute #183

Merged
raucao merged 3 commits from feature/173-nostr_ldap into feature/custom_ldap_attributes 2024-03-19 14:43:03 +00:00
5 changed files with 11 additions and 11 deletions
Showing only changes of commit 3715cb518b - Show all commits

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
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' }
before do
@@ -9,7 +9,7 @@ RSpec.describe 'Experimental Settings', type: :feature do
describe 'Adding a nostr pubkey' 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_css('button[data-settings--nostr-pubkey-target=setPubkey]:disabled')
end
@@ -26,7 +26,7 @@ RSpec.describe 'Experimental Settings', type: :feature do
end
scenario 'Remove nostr pubkey from account' do
visit setting_path(:experiments)
visit setting_path(:nostr)
expect(page).to have_field("nostr_public_key",
with: "npub1qlsc3g0lsl8pw8230w8d9wm6xxcax3f6pkemz5measrmwfxjxteslf2hac",
disabled: true)

View File

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