Basic RemoteStorage settings
This commit is contained in:
		
							parent
							
								
									a1b238e86b
								
							
						
					
					
						commit
						9b89101afc
					
				| @ -22,6 +22,7 @@ DISCOURSE_PUBLIC_URL='https://community.kosmos.org' | |||||||
| GITEA_PUBLIC_URL='https://gitea.kosmos.org' | GITEA_PUBLIC_URL='https://gitea.kosmos.org' | ||||||
| MASTODON_PUBLIC_URL='https://kosmos.social' | MASTODON_PUBLIC_URL='https://kosmos.social' | ||||||
| MEDIAWIKI_PUBLIC_URL='https://wiki.kosmos.org' | MEDIAWIKI_PUBLIC_URL='https://wiki.kosmos.org' | ||||||
|  | RS_STORAGE_URL='https://storage.kosmos.org' | ||||||
| 
 | 
 | ||||||
| EJABBERD_ADMIN_URL='https://xmpp.kosmos.org/admin' | EJABBERD_ADMIN_URL='https://xmpp.kosmos.org/admin' | ||||||
| EJABBERD_API_URL='https://xmpp.kosmos.org/api' | EJABBERD_API_URL='https://xmpp.kosmos.org/api' | ||||||
|  | |||||||
| @ -104,4 +104,14 @@ class Setting < RailsSettings::Base | |||||||
|   # |   # | ||||||
| 
 | 
 | ||||||
|   field :nostr_enabled, type: :boolean, default: true |   field :nostr_enabled, type: :boolean, default: true | ||||||
|  | 
 | ||||||
|  |   # | ||||||
|  |   # RemoteStorage | ||||||
|  |   # | ||||||
|  | 
 | ||||||
|  |   field :remotestorage_enabled, type: :boolean, | ||||||
|  |     default: (ENV["RS_STORAGE_URL"].present?.to_s || false) | ||||||
|  | 
 | ||||||
|  |   field :rs_storage_url, type: :string, | ||||||
|  |     default: ENV["RS_STORAGE_URL"].presence | ||||||
| end | end | ||||||
|  | |||||||
							
								
								
									
										17
									
								
								app/views/admin/settings/services/_remotestorage.html.erb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								app/views/admin/settings/services/_remotestorage.html.erb
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | |||||||
|  | <h3>RemoteStorage</h3> | ||||||
|  | <ul role="list"> | ||||||
|  |   <%= render FormElements::FieldsetToggleComponent.new( | ||||||
|  |     form: f, | ||||||
|  |     attribute: :remotestorage_enabled, | ||||||
|  |     enabled: Setting.remotestorage_enabled?, | ||||||
|  |     title: "Enable RemoteStorage integration", | ||||||
|  |     description: "RemoteStorage configuration present and features enabled" | ||||||
|  |   ) %> | ||||||
|  |   <% if Setting.remotestorage_enabled? %> | ||||||
|  |     <%= render FormElements::FieldsetComponent.new(title: "Storage URL") do %> | ||||||
|  |       <%= f.text_field :rs_storage_url, | ||||||
|  |         value: Setting.rs_storage_url, | ||||||
|  |         class: "w-full", disabled: true %> | ||||||
|  |     <% end %> | ||||||
|  |   <% end %> | ||||||
|  | </ul> | ||||||
| @ -47,3 +47,10 @@ | |||||||
|   icon: Setting.nostr_enabled? ? "check" : "x", |   icon: Setting.nostr_enabled? ? "check" : "x", | ||||||
|   active: current_page?(admin_settings_services_path(params: { s: "nostr" })), |   active: current_page?(admin_settings_services_path(params: { s: "nostr" })), | ||||||
| ) %> | ) %> | ||||||
|  | <%= render SidenavLinkComponent.new( | ||||||
|  |   level: 2, | ||||||
|  |   name: "RemoteStorage", | ||||||
|  |   path: admin_settings_services_path(params: { s: "remotestorage" }), | ||||||
|  |   icon: Setting.remotestorage_enabled? ? "check" : "x", | ||||||
|  |   active: current_page?(admin_settings_services_path(params: { s: "remotestorage" })), | ||||||
|  | ) %> | ||||||
|  | |||||||
| @ -46,5 +46,26 @@ RSpec.describe 'Admin/global settings', type: :feature do | |||||||
|       expect(page).to_not have_checked_field("setting[ejabberd_enabled]") |       expect(page).to_not have_checked_field("setting[ejabberd_enabled]") | ||||||
|       expect(page).to_not have_field("API URL", disabled: true) |       expect(page).to_not have_field("API URL", disabled: true) | ||||||
|     end |     end | ||||||
|  | 
 | ||||||
|  |     scenario "View remoteStorage settings" do | ||||||
|  |       visit admin_settings_services_path(params: { s: "remotestorage" }) | ||||||
|  | 
 | ||||||
|  |       expect(page).to have_content("Enable RemoteStorage integration") | ||||||
|  |       expect(page).to have_field("Storage URL", | ||||||
|  |         with: "https://storage.kosmos.org", | ||||||
|  |         disabled: true) | ||||||
|  |     end | ||||||
|  | 
 | ||||||
|  |     scenario "Disable remoteStorage integration" do | ||||||
|  |       visit admin_settings_services_path(params: { s: "remotestorage" }) | ||||||
|  |       expect(page).to have_checked_field("setting[remotestorage_enabled]") | ||||||
|  | 
 | ||||||
|  |       uncheck "setting[remotestorage_enabled]" | ||||||
|  |       click_button "Save" | ||||||
|  | 
 | ||||||
|  |       expect(current_url).to eq(admin_settings_services_url(params: { s: "remotestorage" })) | ||||||
|  |       expect(page).to_not have_checked_field("setting[remotestorage_enabled]") | ||||||
|  |       expect(page).to_not have_field("Storage URL", disabled: true) | ||||||
|  |     end | ||||||
|   end |   end | ||||||
| end | end | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user