From 890bf4e455192dadda001200dac5bcf8a16bbfc3 Mon Sep 17 00:00:00 2001
From: Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de>
Date: Thu, 12 May 2022 14:04:12 +0000
Subject: [PATCH] fix conditions for showing oer suggestions, re #1048

Closes #1048

Merge request studip/studip!616
---
 lib/filesystem/StandardFile.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/filesystem/StandardFile.php b/lib/filesystem/StandardFile.php
index 3f9ae39d982..73ba43bbe75 100644
--- a/lib/filesystem/StandardFile.php
+++ b/lib/filesystem/StandardFile.php
@@ -302,9 +302,9 @@ class StandardFile implements FileType, ArrayAccess
             );
         }
 
-        if (Config::get()->OER_ENABLE_SUGGESTIONS &&
-            ($this->getTermsOfUse()->id === 'SELFMADE_NONPUB' || $this->getTermsOfUse()->id === 'FREE_LICENSE') &&
-            $this->fileref->getAuthorName() != User::findCurrent()->getFullName('no_title_rev')
+        if (Config::get()->OERCAMPUS_ENABLED && Config::get()->OER_ENABLE_SUGGESTIONS &&
+            $GLOBALS['user']->id !== 'nobody' && $this->fileref->user_id !== $GLOBALS['user']->id &&
+            in_array($this->fileref->content_terms_of_use_id, ['SELFMADE_NONPUB', 'FREE_LICENSE'])
         ) {
             $actionMenu->addLink(
                 URLHelper::getURL('dispatch.php/file/suggest_oer/' . $this->fileref->id),
-- 
GitLab