2020-06-06 00:03:37 +02:00
|
|
|
"use strict";
|
2016-10-22 10:03:38 +02:00
|
|
|
|
2020-06-06 00:03:37 +02:00
|
|
|
const api = require("../api.js");
|
|
|
|
const topNavigation = require("../models/top_navigation.js");
|
|
|
|
const EmptyView = require("../views/empty_view.js");
|
2016-10-22 10:03:38 +02:00
|
|
|
|
|
|
|
class BasePostController {
|
|
|
|
constructor(ctx) {
|
2020-06-06 00:03:37 +02:00
|
|
|
if (!api.hasPrivilege("posts:view")) {
|
2016-10-22 10:03:38 +02:00
|
|
|
this._view = new EmptyView();
|
2020-06-06 00:03:37 +02:00
|
|
|
this._view.showError("You don't have privileges to view posts.");
|
2016-10-22 10:03:38 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-06-06 00:03:37 +02:00
|
|
|
topNavigation.activate("posts");
|
|
|
|
topNavigation.setTitle("Post #" + ctx.parameters.id.toString());
|
2016-10-22 10:03:38 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = BasePostController;
|