Skip to content

Commit

Permalink
Update author information when private
Browse files Browse the repository at this point in the history
  • Loading branch information
JoonasAapro committed May 28, 2024
1 parent 6b0b2f9 commit 78c54d1
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 233 deletions.
9 changes: 9 additions & 0 deletions app/cells/decidim/author/avatar_image.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<% if model.is_a?(Decidim::User) %>
<% if mode.public? %>
<%= image_tag model.avatar_url, alt: t("decidim.author.avatar", name: display_name), class: "author__avatar" %>
<% else %>
<%= image_tag model.default_avatar_url, alt: t("decidim.author.avatar", name: display_name), class: "author__avatar" %>
<% end %>
<% else %>
<%= image_tag model.avatar_url, alt: t("decidim.author.avatar", name: display_name), class: "author__avatar" %>
<% end %>
32 changes: 32 additions & 0 deletions app/cells/decidim/author/profile_minicard.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<div class="author__tooltip" role="tooltip">
<div class="author__container">
<%= render :avatar %>

<div>
<%= render :name %>
<span class="text-md"><%= model.nickname %></span>
</div>
</div>

<% if model.public? %>
<div class="author__tooltip-links">
<%= link_to decidim.profile_followers_path(raw_model.nickname) do %>
<%= content_tag(:span, model.followers_count, id: dom_id(raw_model, :followers_count)) %> <%= t("decidim.profiles.show.followers") %>
<% end %>
<% if model.can_follow? %>
<%= link_to decidim.profile_following_path(raw_model.nickname) do %>
<%= model.following_count %> <%= t("decidim.profiles.show.following") %>
<% end %>
<% end %>
</div>
<% end %>

<% if model.direct_messages_enabled?(context) %>
<%= link_to current_or_new_conversation_path_with(model), class: "button button__sm button__transparent" do %>
<span><%= t("decidim.profiles.show.send_private_message") %></span>
<%= icon "mail-send-line" %>
<% end %>
<% end %>

<%= follow_button_for(raw_model, false, button_classes: "button button__sm button__transparent") %>
</div>
64 changes: 0 additions & 64 deletions app/cells/decidim/comments/comment/show.erb

This file was deleted.

10 changes: 5 additions & 5 deletions app/cells/decidim/privacy/publish_account_modal/show.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<div class="reveal" id="publishAccountModal" data-reveal role="dialog" aria-modal="true" aria-labelledby="privacy-modal-label">
<div class="reveal__header">
<h2 id="privacy-consent-label" class="reveal__title"><%= t("make_profile_public", scope:"decidim.privacy.partials.privacy_consent") %></h2>
<%= decidim_modal id: "publish-account-modal" do %>
<div data-dialog-container>
<h2 id="privacy-consent-label"><%= t("make_profile_public", scope:"decidim.privacy.partials.privacy_consent") %></h2>
<button class="close-button" data-close aria-label="<%= t("close_modal", scope: "decidim.privacy.partials.privacy_consent") %>"
type="button">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="row columns">
<%= t("content_html", scope:"decidim.privacy.partials.privacy_consent") %>
<%= t("content_html", scope:"decidim.privacy.partials.privacy_consent") %>
</div>
<div class="row">
<div class="columns medium-12">
Expand All @@ -26,4 +26,4 @@
<% end %>
</div>
</div>
</div>
<% end %>
3 changes: 0 additions & 3 deletions app/packs/src/decidim/privacy/decidim_privacy_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@ $(() => {
if (accountPublicity && accountPublicity.dataset.publicity === "true") {
privacyMessagingText.style.display = "block";
} else {
console.log(accountPublicity.dataset)
privacyMessagingText.style.display = "none";
}

const toggleVisibility = () => {
if (privacyMessagingText.style.display === "none"){
privacyMessagingText.style.display = "block";
console.log("NÄYTÄ")
} else {
privacyMessagingText.style.display = "none";
console.log("PIILOTA")
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ def profile_url
decidim.profile_url(__getobj__.nickname)
end

def avatar_url(variant = nil)
return default_avatar_url if __getobj__.blocked?
return default_avatar_url unless avatar.attached?
return default_avatar_url unless public_user?

avatar.url(variant: variant)
end

def profile_path
return "" unless public_user?
return "" if respond_to?(:deleted?) && deleted?
Expand Down
46 changes: 0 additions & 46 deletions app/views/decidim/messaging/conversations/_conversation.html.erb

This file was deleted.

23 changes: 0 additions & 23 deletions app/views/decidim/messaging/conversations/_messages.html.erb

This file was deleted.

47 changes: 0 additions & 47 deletions app/views/decidim/messaging/conversations/_show.html.erb

This file was deleted.

12 changes: 0 additions & 12 deletions app/views/decidim/messaging/conversations/new.html.erb

This file was deleted.

24 changes: 0 additions & 24 deletions app/views/decidim/messaging/conversations/show.html.erb

This file was deleted.

2 changes: 2 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ en:
profile: My public profile
message: "Your profile is set as public on this platform and other people can see details about you, such as your name, nickname, profile picture and your public activity on this platform. You can change the visibility of your profile through the privacy settings page. Your profile is available at:"
shared:
layout_two_col:
private_account: Private account
layout_center:
save_privacy_settings: Save privacy settings
decidim:
Expand Down
2 changes: 1 addition & 1 deletion lib/decidim/privacy/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Engine < ::Rails::Engine
end
end

initializer "decidim_privacy.add_cells_view_paths", before: "decidim_comments.add_cells_view_paths" do
initializer "decidim_privacy.add_cells_view_paths", before: "decidim_core.add_cells_view_paths" do
Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Privacy::Engine.root}/app/cells")
Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Privacy::Engine.root}/app/views")
end
Expand Down

0 comments on commit 78c54d1

Please sign in to comment.