Remove current partial

This commit is contained in:
Oliver Günther
2025-06-12 16:22:52 +02:00
parent d62f001897
commit 28434f7cc9
3 changed files with 0 additions and 119 deletions
@@ -1,29 +0,0 @@
<opce-enterprise-active-saved-trial
data-subscriber="<%= @current_token.subscriber %>"
data-email="<%= @current_token.mail %>"
data-company="<%= @current_token.try(:company) %>"
data-domain="<%= @current_token.try(:domain) %>"
data-plan="<%= enterprise_token_plan_name(@current_token) %>"
data-user-count="<%= @current_token.restrictions.nil? ? t("js.admin.enterprise.upsell.unlimited") : @current_token.restrictions[:active_user_count] %>"
data-starts-at="<%= format_date @current_token.starts_at %>"
data-expires-at="<%= @current_token.will_expire? ? (format_date @current_token.expires_at) : t("js.admin.enterprise.upsell.unlimited") %>"
data-is-expired="<%= @current_token.expired?(reprieve: false) %>"
data-additional-features="<%= enterprise_plan_additional_features(@current_token) %>"
data-reprieve-days-left="<%= @current_token.reprieve_days_left %>">
</opce-enterprise-active-saved-trial>
<%= form_tag(
enterprise_token_path(@current_token),
method: :delete,
data: augmented_confirmation_dialog(
danger_zone: true,
text: t("admin.enterprise.delete_token_modal.text"),
title: t("admin.enterprise.delete_token_modal.title"),
button_continue: t(:button_delete),
icon_continue: "delete"
)
) do %>
<%= styled_button_tag t(:button_delete),
method: :delete,
class: "-with-icon icon-delete" %>
<% end %>
@@ -35,7 +35,6 @@
<% if EnterpriseToken.all_tokens.any? %>
<%= render Admin::EnterpriseTokens::TableComponent.new(rows: EnterpriseToken.all_tokens) %>
<%= render partial: "current" if @current_token.present? %>
<% else %>
<%= render partial: "info" %>
<% end %>
@@ -1,89 +0,0 @@
# frozen_string_literal: true
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
#++
require "spec_helper"
# TODO: delete this file once the partial "current" is removed
RSpec.describe "enterprise_tokens/current" do
let(:current_user) { create(:admin) }
let(:ee_token) { "v1_expired_with_7_days_reprieve_at_2021_09_01.token" }
let(:current_time) { DateTime.now }
before do
allow(User).to receive(:current).and_return current_user
encoded = Rails.root.join("spec/fixtures/ee_tokens/#{ee_token}").read
token = EnterpriseToken.new(id: 42, encoded_token: encoded)
assign :current_token, token
Timecop.travel(current_date) do
render partial: "enterprise_tokens/current"
end
end
context "with token still valid" do
let(:current_date) { "2021-08-28".to_datetime }
it "renders the token as not expired and with no reprieve days" do
expect(rendered.to_s).to include 'data-is-expired="false"'
expect(rendered.to_s).to include 'data-reprieve-days-left=""'
end
end
context "with token just expired (within grace period)" do
let(:current_date) { "2021-09-02".to_datetime }
it "renders the token as expired and with 6 reprieve days" do
expect(rendered.to_s).to include 'data-is-expired="true"'
expect(rendered.to_s).to include 'data-reprieve-days-left="6"'
end
end
context "with token expired past reprieve" do
let(:current_date) { "2021-09-08".to_datetime }
it "renders the token as expired and with 0 reprieve days" do
expect(rendered.to_s).to include 'data-is-expired="true"'
expect(rendered.to_s).to include 'data-reprieve-days-left="0"'
end
end
context "with token expired and no reprieve" do
let(:ee_token) { "v1_expired_without_reprieve_at_2021_09_01.token" }
let(:current_date) { "2021-09-08".to_datetime }
it "renders the token as expired and with no reprieve days" do
expect(rendered.to_s).to include 'data-is-expired="true"'
expect(rendered.to_s).to include 'data-reprieve-days-left=""'
end
end
end