helper_method :sort_column, :sort_direction
def index
- if @user.moderator?
+ if current_user.moderator?
@issue_types = @moderator_issues
@users = User.joins(:roles).where(:user_roles => { :role => "moderator" })
else
if check_report_params
@report = @issue.reports.build(report_params)
details = report_details
- @report.reporter_user_id = @user.id
+ @report.reporter_user_id = current_user.id
@report.details = details
# Checking if instance has been updated since last report
@last_report = @issue.reports.order(:updated_at => :desc).last
@issue = Issue.find_by(issue_params)
# Check if details provided are sufficient
if check_report_params
- @report = @issue.reports.where(:reporter_user_id => @user.id).first
+ @report = @issue.reports.where(:reporter_user_id => current_user.id).first
if @report.nil?
@report = @issue.reports.build(report_params)
- @report.reporter_user_id = @user.id
+ @report.reporter_user_id = current_user.id
notice = t("issues.update.new_report")
end
notice = t("issues.comment.provide_details")
else
@issue_comment = @issue.comments.build(issue_comment_params)
- @issue_comment.commenter_user_id = @user.id
+ @issue_comment.commenter_user_id = current_user.id
if params[:reassign]
reassign_issue
@issue_comment.reassign = true
end
@issue_comment.save!
- @issue.updated_by = @user.id
+ @issue.updated_by = current_user.id
@issue.save!
notice = t("issues.comment.comment_created")
end
def ignore
if @issue.ignore
- @issue.updated_by = @user.id
+ @issue.updated_by = current_user.id
@issue.save!
redirect_to @issue, :notice => t("issues.ignored")
else
def reopen
if @issue.reopen
- @issue.updated_by = @user.id
+ @issue.updated_by = current_user.id
@issue.save!
redirect_to @issue, :notice => t("issues.reopened")
else
def setup_user_role
# Get user role
- @user_role = @user.administrator? ? "administrator" : "moderator"
+ @user_role = current_user.administrator? ? "administrator" : "moderator"
end
def check_if_updated
end
def check_permission
- unless @user.administrator? || @user.moderator?
+ unless current_user.administrator? || current_user.moderator?
flash[:error] = t("application.require_admin.not_an_admin")
redirect_to root_path
end
<h2>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
<%= t('browse.changeset.title', :id => @changeset.id) %>
- <% if @user and @user.id != @changeset.user.id %>
+ <% if current_user and current_user.id != @changeset.user.id %>
<%= link_to new_issue_url(reportable_id: @changeset.id, reportable_type: @changeset.class.name, referer: request.fullpath), :title => t('browse.changeset.report') do %>
⚐
<% end %>
<h2>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
<%= t "browse.note.#{@note.status}_title", :note_name => @note.id %>
- <% if @user && @note.author && @user.id != @note.author.id %>
+ <% if current_user && @note.author && current_user.id != @note.author.id %>
<%= link_to new_issue_url(reportable_id: @note.id, reportable_type: @note.class.name, referer: request.fullpath), :title => t('browse.note.report') do %>
⚐
<% end %>
<div class="clearfix diary-comment">
<%= user_thumbnail diary_comment.user %>
<p class="deemphasize comment-heading" id="comment<%= diary_comment.id %>"><%= raw(t('diary_entry.diary_comment.comment_from', :link_user => (link_to h(diary_comment.user.display_name), :controller => 'user', :action => 'view', :display_name => diary_comment.user.display_name), :comment_created_at => link_to(l(diary_comment.created_at, :format => :friendly), :anchor => "comment#{diary_comment.id}"))) %>
- <% if @user and diary_comment.user.id != @user.id %>
+ <% if current_user and diary_comment.user.id != current_user.id %>
<%= link_to new_issue_url(reportable_id: diary_comment.id, reportable_type: diary_comment.class.name, referer: request.fullpath), :title => t('diary_entry.diary_comment.report') do %>
⚐
<% end %>
<h2><%= link_to h(diary_entry.title), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id %></h2>
- <% if @user and diary_entry.user.id != @user.id %>
+ <% if current_user and diary_entry.user.id != current_user.id %>
<%= link_to new_issue_url(reportable_id: diary_entry.id, reportable_type: diary_entry.class.name, referer: request.fullpath), :title => t('diary_entry.diary_entry.report') do %>
⚐
<% end %>
</div>
<br/>
<div class="comment">
- <%= form_for :issue_comment, :url => { :action => 'comment', :id => @issue.id, :user_id => @user.id } do |f| %>
+ <%= form_for :issue_comment, :url => { :action => 'comment', :id => @issue.id, :user_id => current_user.id } do |f| %>
<%= richtext_area :issue_comment, :body, :cols => 10, :rows => 8, :required => true %>
<%= label_tag t('issues.show.comments.reassign_param') %> <%= check_box_tag :reassign, true %>
<br/>
</nav>
<nav class='secondary'>
<ul>
- <% if @user and ( @user.administrator? or @user.moderator? ) %>
+ <% if current_user and ( current_user.administrator? or current_user.moderator? ) %>
<li class="compact-hide <%= current_page_class(issues_path) %>"><b><%= link_to t('layouts.reports'), issues_path %></b></li>
<% end %>
<li class="compact-hide <%= current_page_class(traces_path) %>"><%= link_to t('layouts.gps_traces'), traces_path %></li>
</p>
</div>
- <% if @user and @this_user.id != @user.id %>
+ <% if current_user and @this_user.id != current_user.id %>
<div class="report-button">
<%= link_to new_issue_url(reportable_id: @this_user.id, reportable_type: @this_user.class.name, referer: request.fullpath), :title => t('user.view.report') do%>
⚐