Ensure tags enabled

cache
Varun Patil 2022-10-07 10:46:09 -07:00
parent b39365d556
commit 4c684f1aef
3 changed files with 13 additions and 3 deletions

View File

@ -7,6 +7,7 @@ use OCP\AppFramework\Http\TemplateResponse;
use OCA\Viewer\Event\LoadViewer;
use OCA\Files\Event\LoadSidebar;
use OCP\AppFramework\Controller;
use OCP\App\IAppManager;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
use OCP\IUserSession;
@ -17,6 +18,7 @@ use OCA\Memories\AppInfo\Application;
class PageController extends Controller {
protected $userId;
protected $appName;
private IAppManager $appManager;
protected IEventDispatcher $eventDispatcher;
private IInitialState $initialState;
private IUserSession $userSession;
@ -26,6 +28,7 @@ class PageController extends Controller {
string $AppName,
IRequest $request,
$UserId,
IAppManager $appManager,
IEventDispatcher $eventDispatcher,
IInitialState $initialState,
IUserSession $userSession,
@ -34,6 +37,7 @@ class PageController extends Controller {
parent::__construct($AppName, $request);
$this->userId = $UserId;
$this->appName = $AppName;
$this->appManager = $appManager;
$this->eventDispatcher = $eventDispatcher;
$this->initialState = $initialState;
$this->userSession = $userSession;
@ -50,17 +54,21 @@ class PageController extends Controller {
return null;
}
// Scripts
Util::addScript($this->appName, 'memories-main');
$this->eventDispatcher->dispatchTyped(new LoadSidebar());
$this->eventDispatcher->dispatchTyped(new LoadViewer());
// Configuration
$uid = $user->getUid();
$timelinePath = \OCA\Memories\Util::getPhotosPath($this->config, $uid);
$this->initialState->provideInitialState('timelinePath', $timelinePath);
$this->initialState->provideInitialState('showHidden', $this->config->getUserValue(
$uid, Application::APPNAME, 'showHidden', false));
// Apps enabled
$this->initialState->provideInitialState('systemtags', $this->appManager->isEnabledForUser('systemtags') === true);
$response = new TemplateResponse($this->appName, 'main');
return $response;
}

View File

@ -27,7 +27,7 @@
:title="t('memories', 'On this day')">
<CalendarIcon slot="icon" :size="20" />
</NcAppNavigationItem>
<NcAppNavigationItem :to="{name: 'tags'}"
<NcAppNavigationItem :to="{name: 'tags'}" v-if="config_tagsEnabled"
:title="t('memories', 'Tags')">
<TagsIcon slot="icon" :size="20" />
</NcAppNavigationItem>
@ -71,6 +71,7 @@ import {
import Timeline from './components/Timeline.vue'
import Settings from './components/Settings.vue'
import GlobalMixin from './mixins/GlobalMixin';
import UserConfig from './mixins/UserConfig';
import ImageMultiple from 'vue-material-design-icons/ImageMultiple.vue'
import FolderIcon from 'vue-material-design-icons/Folder.vue'
@ -100,7 +101,7 @@ import TagsIcon from 'vue-material-design-icons/Tag.vue';
TagsIcon,
},
})
export default class App extends Mixins(GlobalMixin) {
export default class App extends Mixins(GlobalMixin, UserConfig) {
// Outer element
}
</script>

View File

@ -32,6 +32,7 @@ const eventName = 'memories:user-config-changed'
export default class UserConfig extends Vue {
config_timelinePath = loadState('memories', 'timelinePath') || '';
config_showHidden = loadState('memories', 'showHidden') === "true";
config_tagsEnabled = loadState('memories', 'systemtags');
created() {
subscribe(eventName, this.updateLocalSetting)