mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
Merge branch 'master' into supporter_plan_display_after_signup
This commit is contained in:
commit
8fba5e7a9b
10 changed files with 55 additions and 9 deletions
|
@ -12,7 +12,7 @@ def browse_sites_dataset
|
|||
@current_page = @current_page.to_i
|
||||
@current_page = 1 if @current_page == 0
|
||||
|
||||
site_dataset = Site.filter(is_banned: false, is_crashing: false).filter(site_changed: true)
|
||||
site_dataset = Site.filter(is_deleted: false, is_banned: false, is_crashing: false).filter(site_changed: true)
|
||||
|
||||
if current_site
|
||||
if !current_site.blocking_site_ids.empty?
|
||||
|
|
|
@ -6,7 +6,8 @@ end
|
|||
|
||||
get '/site/:username/?' do |username|
|
||||
site = Site[username: username]
|
||||
not_found if site.nil? || site.is_banned
|
||||
# TODO: There should probably be a "this site was deleted" page.
|
||||
not_found if site.nil? || site.is_banned || site.is_deleted
|
||||
|
||||
@title = site.title
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@ module Sequel
|
|||
# so this adds the filter for the first time the class' dataset is accessed for the new model.
|
||||
def dataset
|
||||
if @_is_deleted_filter_set.nil?
|
||||
@dataset.filter! is_deleted: false
|
||||
#KD: I turned this off because I think it's easier to do this manually.
|
||||
#@dataset.filter! is_deleted: false
|
||||
@_is_deleted_filter_set = true
|
||||
end
|
||||
super
|
||||
|
|
|
@ -220,6 +220,7 @@ class Site < Sequel::Model
|
|||
site = get_with_identifier username_or_email
|
||||
|
||||
return false if site.nil?
|
||||
return false if site.is_deleted
|
||||
site.valid_password? plaintext
|
||||
end
|
||||
|
||||
|
@ -385,6 +386,8 @@ class Site < Sequel::Model
|
|||
|
||||
FileUtils.mv files_path, File.join(DELETED_SITES_ROOT, username)
|
||||
remove_all_tags
|
||||
#remove_all_events
|
||||
#Event.where(actioning_site_id: id).destroy
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -542,6 +545,7 @@ class Site < Sequel::Model
|
|||
matches = f.grep SPAM_MATCH_REGEX
|
||||
|
||||
if !matches.empty?
|
||||
=begin
|
||||
EmailWorker.perform_async({
|
||||
from: 'web@neocities.org',
|
||||
reply_to: email,
|
||||
|
@ -552,6 +556,7 @@ class Site < Sequel::Model
|
|||
https://#{self.host}/#{relative_path}
|
||||
}
|
||||
})
|
||||
=end
|
||||
end
|
||||
}
|
||||
end
|
||||
|
@ -656,6 +661,11 @@ class Site < Sequel::Model
|
|||
begin
|
||||
FileUtils.rm files_path(path)
|
||||
rescue Errno::EISDIR
|
||||
site_files.each do |site_file|
|
||||
if site_file.path.match /^#{path}\//
|
||||
site_file.destroy
|
||||
end
|
||||
end
|
||||
FileUtils.remove_dir files_path(path), true
|
||||
rescue Errno::ENOENT
|
||||
end
|
||||
|
|
|
@ -253,6 +253,7 @@
|
|||
font-size: 9px;
|
||||
position: relative;
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
display: inline-block;
|
||||
|
||||
>.fa-heart {
|
||||
display:none;
|
||||
|
|
|
@ -1497,6 +1497,7 @@ a.tag:hover {
|
|||
color: #e93250;
|
||||
vertical-align: .45em;
|
||||
margin-left: -.15em;
|
||||
display: inline;
|
||||
}
|
||||
.fa-user {
|
||||
margin-right: 0.25em;
|
||||
|
|
|
@ -29,7 +29,10 @@
|
|||
.username {
|
||||
float: left;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
width: 63%;
|
||||
height: 1.3em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.site-stats {
|
||||
float: right;
|
||||
|
@ -42,6 +45,9 @@
|
|||
height: 1.4em;
|
||||
float: left;
|
||||
margin-top: -4px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.site-tags .fa-tag {
|
||||
vertical-align: -2px;
|
||||
|
@ -54,6 +60,12 @@
|
|||
margin-top: 8px;
|
||||
margin-bottom: 2px;
|
||||
white-space: nowrap;
|
||||
a {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
width: 100%;
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
|
||||
&.int-Gall{
|
||||
|
@ -70,7 +82,8 @@
|
|||
width:32%
|
||||
}
|
||||
@media (max-device-width:480px), screen and (max-width:800px){
|
||||
width:49%
|
||||
width:48%;
|
||||
margin:0 1% 12px;
|
||||
}
|
||||
}
|
||||
&.suggestions {
|
||||
|
@ -86,6 +99,10 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-device-width:480px), screen and (max-width:800px){
|
||||
padding: 4% 2%;
|
||||
}
|
||||
}
|
||||
|
||||
.admin {
|
||||
|
|
|
@ -21,7 +21,7 @@ describe '/' do
|
|||
@another_site = Fabricate :site
|
||||
@followed_site.toggle_follow @another_site
|
||||
visit '/'
|
||||
find('.news-item', match: :first).text.must_match /#{@followed_site.username} followed #{@another_site.username}/i
|
||||
find('.news-item', match: :first).text.must_match /#{@followed_site.username} started following the site of #{@another_site.username}/i
|
||||
end
|
||||
|
||||
it 'loads my activities only' do
|
||||
|
@ -37,7 +37,7 @@ describe '/' do
|
|||
@followed_site = Fabricate :site
|
||||
@site.toggle_follow @followed_site
|
||||
visit "/?event_id=#{@followed_site.events.first.id}"
|
||||
find('.news-item').text.must_match /you followed #{@followed_site.username}/i
|
||||
find('.news-item').text.must_match /you started following the site of #{@followed_site.username}/i
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -31,6 +31,20 @@ describe 'site_files' do
|
|||
File.exists?(file_path).must_equal false
|
||||
SiteFile[site_id: @site.id, path: 'test.jpg'].must_be_nil
|
||||
end
|
||||
|
||||
it 'deletes all files in a directory' do
|
||||
upload(
|
||||
'dir' => 'test',
|
||||
'files[]' => Rack::Test::UploadedFile.new('./tests/files/test.jpg', 'image/jpeg')
|
||||
)
|
||||
upload(
|
||||
'dir' => '',
|
||||
'files[]' => Rack::Test::UploadedFile.new('./tests/files/test.jpg', 'image/jpeg')
|
||||
)
|
||||
delete_file filename: 'test'
|
||||
@site.site_files.select {|f| f.path =~ /^test\//}.length.must_equal 0
|
||||
@site.site_files.select {|f| f.path =~ /^test/}.length.must_equal 1
|
||||
end
|
||||
end
|
||||
|
||||
describe 'upload' do
|
||||
|
|
|
@ -27,11 +27,12 @@
|
|||
<a href="/site/<%= actioning_site.username %>" class="user" title="<%= actioning_site.title %>"><i class="fa fa-user"><% if actioning_site.supporter? %><i class="fa fa-heart"></i><% end %></i><%= actioning_site.username %></a>
|
||||
<% end %>
|
||||
|
||||
followed
|
||||
started following
|
||||
|
||||
<% if current_site && event_site.id == current_site.id %>
|
||||
<a href="/site/<%= current_site.username %>" class="you">you</a>
|
||||
<% else %>
|
||||
the <a class="user" href="http://<%= event_site.host %>" title="<%= event_site.title %>">site</a> of
|
||||
<a href="/site/<%= event_site.username %>" class="user" title="<%= event_site.title %>"><i class="fa fa-user"><% if event_site.supporter? %><i class="fa fa-heart"></i><% end %></i><%= event_site.username %></a>
|
||||
<% end %>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue