Fix multiple issues with shared task [SCI-8983]

- Circumvent authentication by using direct URL Users' avatars
- Change wrong completed-on icon
- Parse dates in browser's format
This commit is contained in:
sboursen-scinote 2023-08-05 19:44:48 +02:00
parent b365553a14
commit 7b2a752d60
5 changed files with 7 additions and 7 deletions

View file

@ -2,12 +2,13 @@
(function() { (function() {
$('.iso-formatted-date').each(function() { $('.iso-formatted-date').each(function() {
const userLang = navigator.language || navigator.userLanguage || 'en-US';
let text = $(this).text().trim(); let text = $(this).text().trim();
if (!text) { if (!text) {
return; return;
} }
$(this).text(moment(text).local().format()); $(this).text(moment(text).local(userLang).format('LLL'));
}); });
}()); }());

View file

@ -181,7 +181,8 @@ module ApplicationHelper
File.open(file_path) do |file| File.open(file_path) do |file|
Base64.strict_encode64(file.read) Base64.strict_encode64(file.read)
end end
"data:#{avatar_link.split('.').last};base64,#{encoded_data}"
"data:image/svg+xml;base64,#{encoded_data}"
else else
avatar_link avatar_link
end end

View file

@ -3,7 +3,7 @@
<div class="comment-container" data-comment-id="<%= comment.id %>"> <div class="comment-container" data-comment-id="<%= comment.id %>">
<% unless user == comment.user%> <% unless user == comment.user%>
<div class="comment-header"> <div class="comment-header">
<%= image_tag avatar_path(comment.user, :icon_small), class: 'user-avatar' %> <%= image_tag user_avatar_absolute_url(comment.user, :icon_small, true), class: 'user-avatar' %>
<div class="user-name"> <div class="user-name">
<%= comment.user.full_name %> <%= comment.user.full_name %>
</div> </div>

View file

@ -1,5 +1,3 @@
<% my_module_editable = false %>
<div class="flex-block date-block"> <div class="flex-block date-block">
<div class="flex-block-label"> <div class="flex-block-label">
<span class="sn-icon block-icon sn-icon-calendar mr-2.5"></span> <span class="sn-icon block-icon sn-icon-calendar mr-2.5"></span>
@ -31,7 +29,7 @@
<% if @my_module.completed? %> <% if @my_module.completed? %>
<div class="flex-block date-block" > <div class="flex-block date-block" >
<div class="flex-block-label"> <div class="flex-block-label">
<span class="fas block-icon fa-calendar-day"></span> <span class="sn-icon block-icon sn-icon-calendar mr-2.5"></span>
<span class="hidden-xs hidden-sm hidden-md"><%= t('my_modules.details.completed_date') %></span> <span class="hidden-xs hidden-sm hidden-md"><%= t('my_modules.details.completed_date') %></span>
</div> </div>
<div class="datetime-container"> <div class="datetime-container">

View file

@ -2,7 +2,7 @@
<% my_module.user_my_modules.each do |um| %> <% my_module.user_my_modules.each do |um| %>
<% user = um.user %> <% user = um.user %>
<div class="inline-flex gap-2 flex-nowrap h-6 px-2 py-1 items-center select-none" title="<%= user.full_name %>"> <div class="inline-flex gap-2 flex-nowrap h-6 px-2 py-1 items-center select-none" title="<%= user.full_name %>">
<img class="block rounded-full h-5" src="<%= avatar_path(user, :icon_small)%>" alt="<%= user.full_name %>"> <img class="block rounded-full h-5" src="<%= user_avatar_absolute_url(user, :icon_small, true) %>" alt="<%= user.full_name %>">
<span style="block"><%= user.full_name %></span> <span style="block"><%= user.full_name %></span>
</div> </div>
<% end %> <% end %>